How using a blockchain as a general purpose database is the slowest, least scalable, least private, and most costly solution
Just in case it wasn’t clear:
- Web 1.0 most people think of as HTML and data retrieval in the Netscape and HTML era (up until the late 90s)
- Web 2.0 is evolving with JS/DHTML and modern dynamic frameworks like React.js.
- Web 3.0 is building web apps using blockchain as the backend transaction and data store (driven by Etherium)
- Web 4.0 is vaguely claimed to be the “Symbiotic Web”
- Web 5.0 was mentioned by Jack Dorsey as a BTC-based version of Web 3
There are a few central ideas in Web 3.0, including the following:
- Using blockchains to store and process arbitrary data (e.g., Smart Contracts)
- Decentralizing the web with blockchain-based data storage, so a single entity does not wholly own data and platforms
- Using blockchain tender as the “equity” and “payment” medium for transactions, data storage, and site management — leading to the utopian state of decentralized control (DAO — Decentralized Autonomous Organizations)
I took a starter kit from DAPUniversity and rewrote bits of it to create my own Web3 App. The idea was for a new online chat service like Reddit:
- People can post messages
- People can like messages
- People can reply to messages
I didn’t finish the third feature, but the first two required creating a new Smart Contract definition, figuring out how to compile and register it, then building the interface from the UI to the web3 APIs.
The tech stack was pretty simple:
- ReactJS on the front end, using web3 libraries to operate blockchain contracts
- MetaMask wallet to interact with blockchains and pay for contract writes
- Ropsten tests ETH network to register and test the app for free
- A few other tools like Truffle, Infurio, and Ganache for dev support
Writing the contract is pretty easy using Solidity. The code looks like any IDL to define an interface/contract. It may be a “Turing Complete language” (not a fan of abusing the fancy term), but its functionality is pretty primitive. You can store scalars and structures but can’t do simple things like iterate through a collection so easily.
Using Truffle is more streamlined but requires a bit more setup — linking your wallet to a blockchain node like Infura.io which means yet another system to create an account on (setup a node locally with Ganache). Once setup, you can compile, deploy and inspect and test the blockchain contracts using the Truffle CLI.
The example above is pretty self-explanatory; it enables access to your ETH wallet (via MetaMask), gets a ref to the Chat contract, then allows direct API access to do reads like
messages(id), and executes blockchain writes like
createMessage(msg, id) and
Building this demo was fun, as is any hack development project intended just for learning (as opposed to production software where > 50% of the effort is error handling and testing). A few areas where I see problems are:
- Reading is really slow — just reading ten contract messages off the blockchain takes a few seconds.
- Writing is really slow — ETH is way faster than BTC, but it is still really slow. On Ropsten, it takes 5–10 seconds to increment the “like counter” on my contract object.
- Database scale — as my prior points convey, it is way too slow with ETH contract operations, so a significant infra is needed to build cache and performance layers on top of the raw blockchain.
- Transaction cost — every write costs ETH, which is fine for Ropstein because it’s free, but I can’t imagine paying real ETH every time a user writes something.
- No privacy — the great part about blockchain is transparency, but how do I ever write any private data, like if I wrote a P2P chat app? I suppose you can add your own encryption layer on top?
- Contract API is primitive — it seems cumbersome to find and iterate thru objects on the blockchain and imagine a more robust revision is needed to support indexing, fast hash lookups, etc.
- Toolchains are primitive — while I’m sure it has grown 500% in a year, it is quite a bit of Googling and hunting to understand how to connect Truffle to Infurio and what versions of tools to install.
I imagine the real applications won’t have client-side Web3 API calls and client-side wallets, but instead, Web3 app servers that manage your wallets and enable robust caching layers on top of the rudimentary blockchain APIs.
Web3 is an interesting merger of Web + Blockchains, but I doubt this is the sole evolution of the web — hence I’d prefer changing the name from Web 3.0 to something like Web 2.21b to avoid misleading the public.