Building full stack dApps

Bridging Web2 & Web3
28
Aug

Building full stack dApps today

Decentralized applications (also called “dApps”) are quickly growing in popularity, despite the frequent challenges that come with early stage technologies. What is the current state of building Dapps? Do Dapps scale? Are they worthwhile to build? What are some common development considerations? Let’s evaluate the current maturity of this rapidly evolving ecosystem.

 

Blockchain and Distributed Ledger Technology (DLT) have promised the internet several significant improvements:

  • Manageable transparency and governance of data
  • Bulletproof security, through trustless systems
  • Significantly decreased transaction costs

In reality though, a significant amount of traditional “web2” technology is still needed in order to build a dApp, due to the ecosystem’s temporary lack of decentralized scalability.

We will reference Ethereum’s smart contract platform, since it captures a large majority of today’s dApp market. Ethereum provides a completely decentralized computation service, using smart contracts and a proof of work consensus protocol. It provides more transparency, better security, and [sometimes] lower transaction costs, compared to existing web2 technology. The only problem: it doesn’t scale yet.

Today’s challenges building dApps at scale:

  • Ethereum network performance is limited to ~20 transactions per second.
  • Querying Ethereum’s 90+GB blockchain can be extremely slow.
  • Real time updates are not feasible, because transaction times are often 12+ seconds long.
  • Interacting with the blockchain requires interfacing with a trusted node, and self-hosting nodes is still an unreasonable barrier to entry for most users.
  • Lack of secure and affordable decentralized data storage.

This doesn’t sound like a very efficient tech stack yet; however, thousands of passionate teams are working night and day to improve these issues, in order to unlock the underlying value mentioned above. Researchers and developers around the world are prototyping sharding solutions, new protocols like Plasma, and off-chain solutions like Raiden Network. Being part of blockchain innovation also means granting trust that this community will scale their networks over the coming years.

 

Want more exclusive knowledge? Sign up now!

 

Bridging Web2 & Web3

In the meantime, there’s no way to avoid bridging web2 technology with your dApp. Here are the primary pieces to consider when building a hybrid web2 / web3 dApp:

  • Queryable index
  • Traditional database
  • Trusted gateways
  • Blockchain event subscriber

 

Queryable Index

Building an index service allows for performant end-user search. Searching directly on-chain is much slower, and requires a fully synced Ethereum node. The most performant dApps today are storing Ethereum transaction data, events, and off-chain data references in traditional web2 search indices like Elasticsearch and Solr.

 

Database

A traditional database allows for performant and complex data reads. Making an atomic read call to an Ethereum smart contract can be quick; however, building complex queries that join domain models on-chain can become painfully slow, or even timeout and fail. Storing domain model data in a traditional database provides massive performance gains when rendering data in your dApp.

 

Ethereum / IPFS Gateway

Although Ethereum and IPFS aim to provide a completely decentralized and trustless system, current users usually don’t host their own Ethereum or IPFS nodes. This brings up a considerable security issue, breaking the essence of a trustless system. Some services offer a semi-centralized option for the short term. For example, the popular browser wallet, MetaMask, has relied on Infura’s Ethereum gateway to read and write to Ethereum’s mainnet. Until there are stabilized and decentralized methods of implementing this handshake, it’s not a bad idea to host your own Ethereum and IPFS nodes, in order to ensure reliability and security.

 

Blockchain Event Subscriber

A event subscriber listens to new transactions and events on the blockchain, and saves relevant data in your search indices or database. These are relatively simple to build, especially with the addition of socket pub/sub support in web3.js and respective Ethereum node clients. A common pattern here is to store data using Solidity events, rather than contract storage variables, because it costs less “gas”, meaning it’s cheaper.

 

Final Considerations

These challenges are temporary, and their respective solutions are rapidly evolving. The speed at which improvements are made is staggering, due to many of these same problems having already been solved during the web2 revolution. Scale is the largest problem, and it will require a considerable amount of research and development to solve. In the meantime, there are countless opportunities to apply hybrid web2/web3 dApp technology to existing enterprise scale. Doing so can still bring the value of transparent governance of data, improved trust and security, as well as transaction cost savings to all sizes of business.

STAY TUNED!

BEHIND THE TRACKS

Blockchain Advanced Development

Advanced step-by-step technical guide: Sharing the know-how

Blockchain Impact & Strategy

Experimenting with blockchain technology: Real-world inspiring use cases

Blockchain Technology 101

Principles, tools–frameworks & libraries–and implementation