Skip to content

Instantly share code, notes, and snippets.

@jcnelson
Last active June 5, 2023 22:22
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcnelson/edc40f883b9105aac4e04420cc4d536a to your computer and use it in GitHub Desktop.
Save jcnelson/edc40f883b9105aac4e04420cc4d536a to your computer and use it in GitHub Desktop.
Blockchains Do Not Scale

Blockchains Do Not Scale

(Warning: rant)

Let me say that again for the people in the back. Blockchains. Do. Not. Scale. Period. Full Stop. Do not pass Go; do not collect $200. A scalable blockchain is a digital Philosopher's Stone -- a sought-after but non-existant substance surrounded by crazies, grifters, and the occult. If you gave these people money to buy their magic gold-transmuting eternal-live-producing crystalized spice melange, all you got was a rock.

The whole point of building anything at all on a blockchain is to make it so anyone who wants to can easily run a full replica of the code. This, and this alone, is what keeps blockchain networks both resilient and accountable to their users, since users by and large hold each other accountable. The easier it is to run a node, the more people will run nodes, and thus the more resilient the system will be to node failures, network partitions, and nefarious actors. The downside is that, because blockchains are a type of replicated state machine, the rate at which they can process transactions is bound by the speed of their slowest replicas -- that is, the minimum supported node hardware. If a blockchain can run on a Rasperry Pi, then it will not go any faster than a Raspberry Pi. Having everyone run a full node, and thereby achieving high resiliency and accountability, also necessarily means that transactions have to be processed slowly enough that everyone can keep up.

So what does this mean?

Lesson 1: Use The Chain Sparingly

Anything you do on-chain is going to get expensive the minute it becomes popular. Try and do as many things off-chain as you can, and focus on using the chain to represent a digest of lots of off-chain activity. For example, don't store images on a blockchain; instead, store them on a Web host somewhere, and provide a link and a digest on-chain. As another example, don't put a DEX on-chain as a smart contract; instead, implement the DEX as a separate peer-to-peer network whereby trade-processors have to periodically agree on and commit to the state of the order book on-chain in order to permit users to enter and exit. Yes, this is harder than just writing a smart contract, but there is no such thing as a free lunch. No matter how big blocks are, they will never be big enough to host all the data and code everyone will ever want to store, so you're gonna have to get creative.

Lesson 2: Scalability Comes From Multiple Networks

The key to increasing total transaction capacity is to make it so that safety and liveness can be maintained without requiring everyone to process everything. This means building out transaction-processing networks that run in parallel.

The challenge is to find ways to transfer state from one network to another without trusting a third party to relay that state. This means transferring state between chains without third-party custodians, bridges, or centralized exchanges. PoX is one way to do this: Bitcoin state is readable in Stacks without the need for a trusted relay, and Stacking payouts enable Clarity code to control the flow of BTC to Bitcoin users without the need for a trusted custodian. The ability to do both of these safely depends only on the reasonable asumption that a majority of Stacks miners and Bitcoin miners are honest.

Other ongoing work in this space includes off-chain rollups, Lightning, sidechains, drivechains, subnets, appchains, and so on.

Lesson 3: Bigger Blocks Do Not Scale

There is no such thing as a big-enough block size. Just as 640k RAM was not, in fact, enough for everyone, a 1 TB block size will one day not be enough for everyone either. People can always find use for free space.

The way to ensure that block capacity is fairly allotted is to implement a fee market, and let the market discover the current price of block capacity.

Lesson 4: On-chain Rollups Do Not Scale

On-chain rollups increase the information density of blocks by a constant factor, but do not make it so they can store an unbound number of transactions. It's basically the same as increasing the block size, but for a special subset of transactions.

Lesson 5: Transactions Were Never Going to be Free

Once there is more demand for block capacity than space to store transactions, a fee market will emerge to allocate that space to the highest bidders. Because there's no such thing as a big-enough block size, the rise of a fee market is the mark of an in-demand blockchain that's solving real problems for users. Blockchains that do not have fee markets are blockchains that no one cares about.

Lesson 6: Grifters Gonna Grift

Because the desire for more chain capacity will always be felt, transaction fees on successful blockchains will never be zero. But because no one wants to pay fees, there will always be an endless stream of grifters who make their livelihoods by stirring up and capitalizing on fee resentment. They'll promise you a blockchain with no/low fees, take your money, and leave you with a worse system than what you started with. See also: BigChainDB, EOS, BCH, BSV, Dfinity, IOTA, and Solana (just give it a few years).

Remember, mother nature cannot be fooled. If someone is promising you something that science shows to be impossible, they are either (1) a grifter, (2) an idiot, or (3) both.

Lesson 7: Talk To Your Doctor Before Eating Digital Horse Dewormer

If you see some other blockchain claim to have zero fees or infinite block capacity, and start to feel jealous of them, ask your friendly neighborhood distributed systems computer scientist about whether or not a particular blockchain network actually lives up to is hype. Just as how horse dewormer does not fix COVID, making blocks infinitely big does not fix scalability.

@norgelikegeorge
Copy link

πŸ‘πŸ‘πŸ‘

@devbydixon
Copy link

πŸ‘πŸ‘πŸ‘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment