Need help understanding Bitcoin DeFi?
→ START HERE
Need help understanding Bitcoin DeFi?
→ START HERE
Need help understanding Bitcoin DeFi?
→ START HERE
Need help understanding Bitcoin DeFi?
→ START HERE
Need help understanding Bitcoin DeFi?
→ START HERE

A Comprehensive Guide to the Web3 Stack for Developers

In the internet today, users are the products whose data is farmed out for profit. But thanks to Web3, the internet is returning to its more egalitarian origins.

Type
Deep dive
Topic(s)
Published
January 26, 2024
Author(s)
Lead Content Manager
An intro to the Web3 tech stack
Contents

Web3 is an open-source internet in which users have ownership of their data and permissionless access to applications without going through intermediaries. Instead of going through centralized intermediaries, blockchain-powered decentralized programs drive peer-to-peer trustless economic networks for exchanging value and information.

Web3 reduces the influence and power of centralized monopolies and makes the internet a more democratic place. In this guide, we describe the different components of the Web3 stack to demystify the Web3 app development process.

The Internet (R)evolution: From Web1 to Web3

To understand Web3 and what it means for the future of the internet, let’s take a step back in time to understand how the internet has evolved.

  • Web1 (~1989–2004), the “read” era:The internet functioned as a portal of static web pages that presented information to the public in “read-only” formats. Web1 users could consume content but couldn’t interact with it, or with each other. 
  • Web2 (~2005–2020), the “read-write” era: Web users evolved from being “readers” to “creators,” and websites evolved from being “read-only” static information portals to “read-write” platforms through which users could consume, create, and interact with information, and with each other.
  • Web3 (~2021–present), the “read-write-own” era: Now the internet is transforming from “read-write” platforms to “read-write-own” networks. In this era, “users” and “creators” are also “owners”, not only of their own data but also of the very platforms and apps they use. Decentralization in Web3 enables networks to align incentives with their users, so both participate in the rewards of growth and market adoption.

As a developer, building Web3 apps for this new paradigm may seem daunting because the underlying blockchain technology is new and complex, but if you know how to build Web2 apps, you already have the foundational knowledge you need. If you’re interested in building the next generation of web applications, this post provides a comprehensive introduction to the Web3 stack.

What Is the Web3 Stack for Developers?

A tech stack refers to all of the technology and services used to build an application. A tech stack generally includes components like development frameworks, programming languages, and technical infrastructure.

The main components of the Web3 tech stack for decentralized applications are:

  • Blockchain
  • Smart contracts
  • Development environments
  • Testing frameworks
  • File storage
  • User identity management
  • UI/UX components

Blockchain: the Foundation for Web3 Apps

The blockchain is the foundational block for the Web3 tech stack and will serve as an important data and settlement layer in your application: it’s where your users keep their on-chain identity with their account balances and where assets move between accounts. 

There are many different blockchains for you to choose from. Those options have different tradeoffs, ranging from different programming languages, varying levels of security, contrasting approaches to consensus, and more.

The closest equivalent in Web2 to the blockchain layer is the operating system, with the most dominant being iOS, Android, macOS, Windows, Linux, and WebOS. The operating system often influences both the design and implementation decisions that developers make when designing Web2 applications, and the same is true with how the blockchain layer influences the applications built on top of it. 

As a result, the blockchain that serves as the foundation of a Web3 app has important ramifications for the adoption and success of the project. Here are some of the options developers can choose from:

Picking a Blockchain

Building for Bitcoin

Bitcoin is the most dominant blockchain in terms of adoption and market capitalization, and it is gradually evolving to support Web3 apps. Developers who want to build Web3 apps for Bitcoin can build them through Bitcoin layers, such as Stacks, which functions as a programmable layer for Bitcoin.

Through Stacks, developers can build applications that tap into $800B of latent capital locked in the Bitcoin ecosystem, as well as build on the most secure and decentralized blockchain released to date.

Building for Ethereum

Ethereum is the first smart contract platform, and as a result, a large number of decentralized applications run on Ethereum today. Ethereum has the largest developer community out of any blockchain and an even larger community of users.

As a result of its popularity, many alternative blockchains to Ethereum are still compatible with Ethereum and the Ethereum Virtual Machine (EVM), such as Solana, Avalanche, and Fantom, which makes it easier to bridge applications between those blockchains.

Other Blockchain Platforms

Beyond Bitcoin and Ethereum, there are dozens of other blockchain platforms you can choose from, such as Cosmos, Polkadot, and NEAR. There is also a growing debate between monolithic and modular blockchain architecture, the latter of which is a relatively new entrant to the space.

  • A monolithic blockchain (such as Bitcoin and Ethereum) are blockchains that handle execution, settlement, consensus, and data availability all in the same place. This design is simpler, but comes at the cost of inflexibility, limited block space, and other design challenges.
  • A modular blockchain (such as Celestia and rollups) are blockchains that separate these functions into separate layers. By separating those functions, each layer can specialize, improving throughput, latency, bootstrapping speed, and more.

However, for the sake of brevity, we will limit our exploration of the Web3 stack in this article to Bitcoin and Ethereum, the two largest blockchains, both of which are monoliths.

Interacting with Blockchains

To interact with a blockchain, you’ll use a blockchain API, whether to fetch data or to broadcast transactions on behalf of your app’s users. Each blockchain has a built-in API that you can use as a default, and within each blockchain ecosystem, you often have developer tools companies that provide dedicated API services to developers as well.

For example, at Hiro, we build and maintain a Blockchain API and a Token Metadata API for the Bitcoin layer Stacks, as well as an Ordinals API for developers building with Bitcoin ordinals. In the world of Ethereum, you have third party API providers like Alchemy and Infura.

Smart Contracts: the Codebase for Web3 Apps

After the blockchain, the next most important component in the tech stack is smart contracts. A smart contract refers to a program deployed on a blockchain that is designed to self-execute when predetermined conditions are met. What makes them “smart” is their self-execution: these programs do not have administrators or controllers—they are fully autonomous code.

Since Web2 applications are centralized, there is no need for the autonomous, self-executing functionality of smart contracts. Therefore, the closest “equivalent” to the smart contract layer is the actual code of the applications themselves. Smart contracts run in the ‘backend’ of decentralized applications, and they enable apps to interact with on-chain assets and user accounts.

There are many different programming languages for writing software code. Developers choose programming languages based on the type of application they intend to build, their technical sophistication, and their personal preferences. 

The same is true for smart contract programming languages for Web3 applications. However, it’s worth noting that the choice of programming language is often dependent on the blockchain layer chosen.

Note: a Web3 app’s code will not solely be smart contracts. The vast majority of Web3 apps use both smart contracts and traditional Web2 components (for example, using JavaScript to build their website). Not every part of an app needs to be or should be on-chain, and that means your app will not be entirely built via smart contracts.

Smart Contract Development in the Bitcoin Ecosystem

The Bitcoin ecosystem didn’t originally start out with smart contracts because Bitcoin had a limited scripting language by design. The arrival of Bitcoin layers brought scalability and smart contracts to Bitcoin, and now, developers can create and use smart contracts for Bitcoin to build apps on the most secure blockchain. 

Clarity Programming Language

To write smart contracts for Bitcoin, developers can use the language Clarity, an open-source programming language that is optimized for security and predictability. Clarity is heavily influenced by LISP and benefits from the time-tested strengths of other LISP-like languages, such as brevity, being easier to reason about, and better composability.

Overview of Bitcoin’s Smart Contract Traction

Since the launch of the Bitcoin layer Stacks in 2021, Clarity has grown in popularity for the development of smart contracts and dApps. More than 80,000 smart contracts have already been written in Clarity and deployed on the blockchain. Some live Web3 applications written with Clarity include ALEX, Arkadiko, Gamma, and dozens more.

Smart Contract Development on Ethereum

Ethereum popularized the idea of smart contracts by providing the first programming language to write them and a blockchain network on which they can be deployed. Ethereum is currently the most dominant smart contract platform, but its first-mover advantage is declining as it grapples with high transaction costs and scalability challenges.

Solidity Programming Language

Solidity is Ethereum’s programming language for writing smart contracts. Solidity is an object-oriented programming language with a syntax inspired by C++. The influence of C++ on Solidity’s syntax is apparent in concepts such as loops, overloading functions, and variable declarations, among others. Solidity is specified for the Ethereum Virtual Machine (EVM), and code written in Solidity must be compiled to EVM’s bytecode before it can run. This means that the language is not human-readable once deployed on the blockchain. 

Overview of Ethereum’s Smart Contract Traction

Ethereum currently leads other blockchains in the development of smart contracts (it has had a several-year head start after all). Electric Capital’s 2023 Developer Report observes that 71% of smart contract code in all of Web3 is deployed on Ethereum first. Some of the most popular Web3 apps, such as Uniswap, OpenSea, and Compound Finance, launched on Ethereum. 

The Development Environment in the Web3 Tech Stack

The development environments in Web3 are not that different from what you are used to in Web2. You’ll likely use a local or cloud-based editor that focuses on smart contract development and offers a number of helpful automation and debugging features. Additionally, most integrated development environments (IDEs) in Web3 have tools to help you test how your contract code will interact with a decentralized blockchain environment (such as with blockchain miners, nodes, or other elements of the core protocol).

Bitcoin Web3 Development Environment

In the world of Bitcoin layers, you have several options to choose from. If you are building on Stacks, you can choose to build with Clarinet or the Hiro Platform.

Clarinet is a local Clarity language runtime packaged as a command-line application for smart contract development, testing, and deployment. Once installed, you can use Clarinet to create a new project, add new contracts to your project, check the syntax of your contracts, measure cost coverage, and make cost optimizations, among many other features.

You can also choose to build with the Hiro Platform, a hosted development environment that removes all of the friction of installations from the experience and offers a number of powerful features, including deployment plans, chainhooks, and more.

If you build with the Bitcoin layer Lightning, you can use Polar, a dev environment which can configure multiple Lightning networks and offers drag and drop actions, so you can focus on building Lightning apps and not on the initial setup.

If you build with the Bitcoin layer Rootstock, you can actually use the Ethereum dev environments listed below, since Rootstock is an EVM-compatible chain.

If you want to learn more about Bitcoin dev tools, here’s a guide to learn Bitcoin Script and here’s a list of Bitcoin dev tools. Keep in mind that for more advanced Web3 functionality, you’ll need to use a Bitcoin layer like Stacks. 

Ethereum Web3 Development Environment

For Ethereum developers, there are a number of different development environments to choose from, including:

Hardhat is a development environment that provides a one-stop shop for writing, compiling, and debugging smart contract code. You can also leverage its flexibility to automate recurring tasks when writing your smart contract code.

Remix is an open-source tool for creating smart contracts and building Web3 apps with Solidity. Remix functions both as a compiler and IDE, and it is available as a browser and a desktop application that you can run locally.

Embark is a framework you can use to develop and deploy dApps on Ethereum, EVM chains, and decentralized storage networks such as IPFS and Swarm (more on those in a minute). 

The Testing Environment for Web3 Apps

Web3 applications don’t exist in isolation; they have logic that interacts with the network, including the blockchain’s global state, decentralized storage systems, miners, blocks, and other types of data. 

When you create a Web3 app, you don’t want to push your code directly into production. That’s expensive and puts real world on-chain assets at risk. Like any development cycle, you want a testing environment to debug your code. That’s where devnet and testnet come in.

In Web3 development, you start by deploying code on a devnet, which is a local instance of a blockchain network (these are usually packaged into the development environments mentioned above). Then you deploy on testnet, which is a public network with decentralized miners, nodes, and everything else (but no economic value). Finally, Web3 code gets deployed on mainnet, the production environment where users will interact with your app.

Since testnets are free testing environments, there are testnet “faucets” that provide free test tokens to developers and testnet users in order to enable transactions on the testnet.

The Web2 equivalent of a testnet is the pre-deployment testing in a staging environment when apps are tested for compatibility, performance, stress, security, and usability. Pre-deployment testing in Web2 is typically done via testing solutions such as Google App Engine or Selenium.

Bitcoin Testnets

Since testnets simulate the live blockchain network, it naturally follows that each blockchain has its own testnet (or several testnets!) to mimic the rules of that particular network. These testnets follow the behavior of the live production environment, mining blocks at a similar pace, maintaining a network history, and having the same consensus mechanism as mainnet. 

In the case of Bitcoin, there is a Bitcoin testnet, and each Bitcoin layer has their own testnet as well. For example, Stacks has a testnet, as does Rootstock.

Ethereum Testnets

Ethereum offers multiple testnets to developers, and Rinkeby is one of the most popular options. Other Ethereum testnets include Kovan and Ropsten.

File Storage Solutions in the Web3 Stack

Apps generate data that needs to be stored somewhere. Developers of both Web2 and Web3 applications need file storage, and different storage providers can have different prioritizations of scalability, availability, and usability. 

Web3 apps on Bitcoin, Ethereum, and other blockchain networks can use the same decentralized file storage options to securely store data. With decentralized storage providers, you can significantly reduce downtime risks and ensure consistent availability because millions of computers serve as nodes to deliver content as needed. Decentralized file storage solutions make your Web3 apps more resistant to censorship because it is difficult to shut down decentralized and distributed servers. Decentralized file storage includes:

  • IPFS is a distributed file system designed to help store and access data across a peer-to-peer network. IPFS empowers developers to store, timestamp, and secure large files without having to put the data itself on-chain.
  • Arweave takes the idea of decentralized file storage further by ensuring the permanence of data. Arweave is building a permaweb, managed by a global community of users and developers who are incentivized to maintain the data storage layer.
  • Gaia is a decentralized storage platform available to developers building apps on Stacks. The transactional metadata of the apps is stored on the blockchain itself, while user application data is stored in Gaia to ensure that users enjoy high performance and availability.

Developers can also use centralized storage solutions like Google Cloud or Microsoft Azure (commonly used in Web2 apps) to manage their storage needs. If you choose a centralized storage solution, you can generally expect cheaper costs relative to on-site self-storage and decentralized options.

You also get a solution that is optimized for performance. Centralized storage comes with product features like automated server-load balancing and extensive customizations to optimize app performance.

Identity Management in Web3 Apps

In order to fully realize the read-write-own promise of Web3, developers need a new way of managing digital identity for their users. Whether you are building DeFi apps, NFTs, DAOs, or other decentralized use cases, you need a way to identify your users.

Fundamentally, identity management revolves around user authentication and authorization to ensure that the right users have the correct privileges within the app and can access their accounts. Digital identity is critically important for the security and reliability of any application.

In Web1 applications, users needed to provide a unique login and password to identify themselves and access each application they used. Users were encouraged to have different passwords for every website for security. Good luck remembering 50 different passwords!

In Web2 applications, big tech companies, such as Google and Facebook, addressed that pain point and extended the portability of users’ identities to other apps. In many Web2 apps, users can leverage their Google or Facebook identities as credentials to sign in to other applications, but that ease comes with risk. If your Google account is hacked, for example, that could mean multiple accounts are compromised.

In Web3 applications, user identity is managed by wallets. A wallet is a unique address on a blockchain that provides a user with an identity and a place to store their digital assets. Wallets serve as a means of establishing users’ identities using public-private key cryptography. Public keys are used to encrypt data, and private keys are used to decrypt them. The possession of the correct combination of the public and private keys establishes the identity of the user.

Wallets also serve as the primary medium of interaction. They enable users to:

  • Buy, hold, and sell digital assets
  • Send and receive digital assets from other accounts
  • Connect to apps

In the Bitcoin ecosystem, users have many wallets they can choose from, including Leather and Xverse Wallet. In the Ethereum ecosystem, there is a range of wallet options too, including MetaMask and Rainbow, among others. In both ecosystems, these wallets are available as a combination of browser extensions, mobile applications, or desktop applications.

There are also emerging naming systems, which are another approach to identity management in Web3. These systems allow users to register a “name” which becomes associated with their blockchain address (or wallet).

For example, BNS on Bitcoin allows users to register a .btc name (like name.btc), and UMA is a universal money address on Lightning. In Ethereum, you have ENS, which enables you to create a .eth name. Note: these naming systems are often used in conjunction with a user’s wallet (e.g. a name is a human-readable identifier for a wallet’s corresponding blockchain address).

The UI/UX for Web3 Apps

The user interface and experience design define how users interact with applications on the frontend. In Web3, that user interface is fairly similar to what you’ll find in Web2. Developers will often use HTML to structure the app, CSS for styling, and React, regardless of whether the app is built on Bitcoin, Ethereum, or a different blockchain altogether.

Just as in Web2, a user’s email or phone number is used for identity management; in Web3, the user’s wallet address is used for identification and authorization.

A comparison of the login UI across eras of the web

Most blockchains also have Javascript libraries with general-purpose commands for building applications and managing the user experience.

For example, if you are working directly with Bitcoin, you can use BitcoinJS to simplify creating, managing, and signing transactions. If you are building with Stacks, you can use Stacks.js to access a wealth of packages for managing identity, authentication, storage, transactions, and more.

On the Ethereum network, Web3.js or Ethers.js are general-purpose libraries that you can use to manage the user experience of your Web3 app for access to local or remote Ethereum nodes. 

Start Building the Decentralized Future Today

In a vacuum, it’s difficult for individual developers or entrepreneurs to build Web3 applications that can viably compete with existing Web2 incumbents—think about the technical, economic, and social resources that would be needed to build a Facebook competitor from scratch.

However, the permissionless nature of Web3 means that there are lower barriers to entry, and independent developers can easily collaborate to build Web3 applications that create entirely new paradigms. By contributing to existing or building new Web3 applications, you can advance the evolution of the internet toward open, transparent, and democratic ownership.

The Web3 stack for dApps has familiar origins in the technology stack for Web2 apps, and if you already know how to build Web2 applications, you can easily become a Web3 developer.

Ready to continue your journey into Web3? Download our free guide to developing smart contracts.

Download the Guide
Copy link
Mailbox
Hiro news & product updates straight to your inbox
Only relevant communications. We promise we won’t spam.

Related stories