<100 subscribers
Share Dialog
Share Dialog


Note:
*This is a continuously growing document. It will be updated as I continue to learn and the ecosystem expands. If you have any questions or corrections, feel free to @ me on twitter or dm me @realsyedshah. *
Last Updated: Oct 27, 2022
Why this is Important to Understand
Consensus Algorithms
Brewer’s Theorem aka CAP theorem
Byzantine Generals Problem
Proof of Work vs Proof of Stake
Layer 1s
Bitcoin
The Problem with Bitcoin
Bitcoin Cash
The Problem with Bitcoin Cash
Bitcoin SV
The Problem with BitcoinSV
Ethereum
Separation of Consensus and Execution
How Ethereum’s Proof of Stake Works
Gasper
Future Scaling
EVM Compatibility
The Problem with Ethereum
Flow
Basics
Hotstuff BFT Consensus
The Problem with Flow
Polygon
Plasma Chain
The Problem with Polygon
Solana
I Can’t With This Chain
The Problem with Solana
Cardano
Ouroboros Proof of Stake
The Problem with Cardano
Cosmos
Tendermint BFT
The Problem with Cosmos
Polkadot
Nominated Proof of Stake
The Problem with Polkadot
Layer 2s
Ethereum
Optimism (Single Fraud Proof)
Arbitrum (Multi Fraud Proof)
Starknet (Zk-Rollup - Snark)
Validium
ZkSync (Zk-Rollup - Snark)
To put it bluntly, the blockchain world is full of grifters and marketers who will sell you on ideas and principles without any substance. The technology is powerful enough to attract the brightest minds. Despite the price volatility, interest in blockchain technology from students shows no sign of slowing. The idea of disrupting finance. The very plumbing of our society at the scale blockchain technology offers. The things that can be built on top of a new system. It’s the stuff of sci-fi, fantasy, make believe.
Everyone wants a piece and no one wants to be late to it. Especially given the backdrop of volatility the incumbent financial system is facing at the end of 2022, with central banks around the world going “bankrupt.” This creates an intense pressure to adopt or die. Even central banks are exploring the idea of digital currencies. Everyone wants a piece of the pie and no one wants to be late. This environment is the ideal scenario for anyone looking to take advantage and make quick money.
Having confidence with the technology underlying everything means it will be a lot harder for grifters to take advantage of you with the use of fancy buzzwords. You’ll be equipped to ask the simple questions that separate the grifters from those who are genuinely building the products and protocols that will change the course of human history.
At the heart of every single blockchain is a consensus algorithm. It’s the heartbeat on which everything else runs. Every blockchain solution is really just a package around a consensus mechanism. Why all the different implementations? Brewer’s Theorem aka CAP theorem.
This theorem states that any distributed data store (like a blockchain) can only guarantee 2 of the following 3:
Consistency - Every read receives most recent write/err
Availability - Every request receives a non-error response (without guarantee it’s most recent write)
Partition Tolerance - System continues to operate despite an arbitrary number of messages being dropped/delayed by network between nodes
What makes blockchains so powerful is that they can run on thousands of computers at the same time, and to take them down would mean taking down all the computers. The difficulty is in making sure all the computers agree on what the chain looks like currently. They have to be able to communicate with each other and agree on the current state of the chain. So even if there were computers in the network trying to mess everyone up, the computers would still be able to ignore the computers trying to mess them up and find genuine agreement.
This is another way of phrasing the Byzantine Generals Problem. A game theory problem around the idea that there are a group of generals each leading a portion of the army trying to coordinate. They are far apart and can only communicate by raven/pigeon. If they move together, they will win. If they make a split decision, they will lose. However, there are 1 or 2 generals who are trying to sabotage them and there’s no way to tell who the traitors are. How do you solve this problem? Aka trying to reach consensus with asynchronous communication and no central trusted leader.
There are 2 flavors of Consensus Algorithms, Proof of Work and Proof of Stake.
The first thing to clear up is what the consensus is that the network needs to reach. That is the order of the transaction blocks. As long as everyone has the blocks in the same order, the network will continue. This should be true even as people join and leave the network at will. Even if not everyone is online at the same time and not always able to communicate.
Bitcoin, the original blockchain, reached consensus using Proof of Work. The work would be to produce a hash number with a targeted number of 0s. This is by adding a random number to the block (the nonce) and changing it until the hash produced matches the target. This is easy to check because once you have the nonce, anyone can verify that it produces the right hash. Finding a nonce that satisfies the criteria is the hard part. The only way to do it is randomly. There is no formula or shortcut. It’s random. So just keep trying random numbers in the nonce until it works.
Then you use that block as an input into the next block. Since changing any block will change the hash of the following blocks, any computer can easily check to make sure none of the previous blocks have changed. If you wanted to change a single block in the past, you’d have to change every block afterwards, so you’d have to find the nonces fast enough to catch up to the system and go ahead.
This is because the nodes all look for and trust the longest chain they can find (the one with the most blocks). So if you made a change, you’d have to produce a longer chain than the honest chain. This is mathematically infeasible. The longest chain is the one that has the most “work” done on it, as producing a block means working out the nonce that produces the target result.
This is what Proof of Work (PoW) is (also referred to as Nakamoto Consensus after the mysterious creator of Bitcoin.) Just a bunch of computers guessing random numbers. The more computers there are to guess, the faster they find the target, and the system is programmed to adjust the difficulty so that it always averages around 10 min to find a block. Which means the more computers “mining” and trying to generate a block, the harder it will be. So this results in a LOT of electricity being used. A rather wasteful use of resources. Especially when there is the alternative of Proof of Stake. Whose security is based on economic game theory and probably just as secure if not more so, without the wasted resources.
Most of the blockchain’s after Bitcoin have experimented with various implementations of Proof of Stake (PoS). We will get into the different implementations of PoS later when we discuss the different layer 1 chains.
The basic idea is that different computers (nodes) in the system will put up a stake and volunteer to help generate and verify the next block. If they are discovered of malicious activity, they will lose their stake. The more they have at stake, the more they will be relied on to secure the network, the logic being they have the most to lose and are therefore more trustworthy. The rest is to have enough nodes checking the process so that statistically they are certain to catch malicious activity. For example, assuming there is at least one honest node, malicious activity will be caught and slashed (lose their stake). By taking the most conservative assumptions, PoS can be as close to statistically secure as possible.
The above description of Proof of Work is how Bitcoin’s consensus algorithm works. There are other chains that have taken Bitcoin’s PoW and added their variations. LiteCoin for example uses a more memory intensive hashing algorithm (Scrypt) and has a max supply of 84 million coins as opposed to Bitcoin’s 21 million. The system is also set up to target a difficulty of around 2.5 min to generate a new block. While Bitcoin is not as fancy as say Ethereum in that you can’t run smart contracts on it, it has something just as powerful going for it. Trust. It has existed for long enough and scaled large enough that when push comes to shove, there is an inherent trust the crypto/blockchain community has with Bitcoin. Not to mention the technological breakthrough that is Bitcoin is nothing to scoff at.
The problem with Bitcoin is simply that it doesn’t run smart contracts. So in the long run, will it still hold up as a store of value. Is not having smart contracts a feature or a bug? Does it make it more trustworthy? Or will people simply not bother and stay on Ethereum for example. Or will everyone develop smart contracts and Bitcoin becomes a kind of intermediary currency all the different chains use to move value between each other? Or would they simply just work with each other's native currencies using bridges (smart contracts that hold tokens that can be accessed by a contract that's controlled by a smart contract on another chain.)
Bitcoin Cash is an interesting chain because it came about as a result of a massive debate in the Bitcoin community. Namely around the maximum block size. There were those who wanted to increase the block size as the network grew more popular to be able to support the growing size of the network. Making it faster and cheaper as users wouldn’t have to compete on tx fees to try to get in the smaller blocks. Which would let Bitcoin work as a currency, as it was meant to. This is team Bitcoin Cash. The other side took a more traditional view; this went against Satoshi’s vision. If block size kept increasing, it would make running a node more difficult as requirements would mean eventually most people couldn’t run Bitcoin on their computer and only those who could afford it would. Making the network more centralized as a result.
This resulted in a fork where those who wanted to change the block size did so and continued the chain with the new block size and renamed it to Bitcoin Cash, so that it would work as a currency, the way they said Bitcoin was always meant to work. The battle in online communities during this time (2017) was legendary. Lots of psyops and online discourse manipulation by all kinds of powerful entities. For example, most of the core Bitcoin devs had been hired to work for 1 company over the past year before the debate that resulted in the Bitcoin Cash fork.
The problem with Bitcoin Cash is similar to the problem with Bitcoin but more so. As a currency, why wouldn’t I simply stick to Eth for example, since most of my work will be done there and Ethereum is much more deliberate about scaling the chain. Bitcoin Cash is an attempt to scale Bitcoin but if Bitcoin’s value resides in it not scaling up to allow more transactions, to enable it to act more as a store of value. Then Bitcoin Cash doesn’t make sense, as you would be better off on other chains that scale better.
However with the other chains focused on Proof of Stake, there is room for a Proof of Work alternative like Bitcoin Cash. Should the impossible happen and Proof of Stake proves to be corruptible.
Bitcoin Satoshi Vision is an attempt to bring smart contracts to Bitcoin. The idea behind this chain is to keep all the parameters (10 min block time, max coin supply, etc) the same as in Satoshi’s original Bitcoin whitepaper, but to use sCrypt as the language to allow adding smart contracts to Bitcoin. This chain is a fork of Bitcoin Cash as they wanted to increase the block size further which the Bitcoin Cash community did not agree to. Which makes sense as their vision is for Bitcoin to run as a currency and smart contracts seem superfluous to this. Resulting in the birth of BitcoinSV.
The official discord has 3k members at the time of writing (Oct of 2022) so it’s still a very small community. With the forum having double digit posts. Which matches my personal feelings of not understanding the use case of building smart contracts on a Bitcoin fork as opposed to Ethereum or zkEVM. However, in a world where Ethereum for whatever reason doesn’t work or there is a fall out in the community. There will definitely be a flight to different chains and the trust element that Bitcoin will have means BSV could certainly be a large player. This is an extremely unlikely scenario and there are other promising chains to move to that feel more technically impressive.
Ethereum, as of Sept 15, 2022, is no longer proof of work, but instead Proof of Stake. Ethereum’s flavor of Proof of Stake is built around two themes:
Separation of Consensus and Execution
Gasper: Managing Forks and Finalizing Blocks
The Execution layer is the same Ethereum as it exists today. This is where computers execute the smart contracts and transactions on the blocks that make up the chain. The difference is that before, the order of the blocks would be the one with the most work done on it (aka most blocks) and the reward would be automatically given to the node that solved the target problem (“mined” the block.)
With Proof of Stake, all the nodes wanting to participate in securing the system must lock up (stake) 32 Eth. This is to ensure honest behavior as dishonest behavior will result in losing the Eth you have staked. It is also possible to join a staking pool if you have less than 32 Eth and distribute the rewards between everyone in the pool. There is a complaint that in Proof of Work, you only need a computer and now you need 32 Eth to get rewards, so the rich get richer, centralization etc… Realistically unless you were part of a mining pool, you were not getting a reward and so, joining a mining pool is the same as joining a staking pool in terms of the reward you're getting. So when you stake your 32 Eth, you become a validator.
The way the network works is in 12 second slots and 32 slots make an epoch (6.4 min). Every slot there is a committee of minimum 128 validators, 1 of which will be randomly chosen to propose a block, another who will randomly be chosen to aggregate the messages the committee sends to each other.
So the proposer sends the block to the other nodes in the committee. They all check and validate that everything about the block is legitimate and sign off (sign attestation) on it and send the message to the aggregator. This block is then justified, but not finalized. That is where the epochs come in. After 32 slots (not all of which need to have a block, it is possible to have empty slots) the last block in the epoch (slot 32) is the finalizing block.
In order for a block to be finalized, ⅔ of the total Eth staked in the network has to sign off on it. Once a block is finalized, it is considered a checkpoint block and also finalizes all the blocks that came before it in the epoch. There is also an inactivity leak, in the event that more than ⅓ of the total staked Eth is not signing off on blocks and preventing the network from continuing. After 4 epochs, the validators who are not contributing will bleed away their Eth until there is ⅔ of the network signing off on blocks to continue the chain.
It’s possible for there to be temporarily two different chains since not every node can talk to every other node (downside to being decentralized and asynchronous.) Especially if one of the block proposers is being naughty. There needs to be a way to settle these temporary forks, which is where Gasper comes in. A combination of LMD-Ghost and Casper-FFG. Those are the names of the algorithms that basically tell the network: go with the fork that has the greatest accumulated weight of attestations (most staked yes votes) and if multiple messages are received from a validator, only the latest one is considered. This is an improvement on Casper which only looked at the longest chain (the one furthest from the genesis block.)
The future of scaling the network to handle more transactions will involve sharding and layer 2 rollups. The current plan I believe is to have 64 sharded chains who will handle data availability so that there isn’t one chain handling all the data of the world. With economic incentives and random sampling tests to ensure the right data is held for whichever node needs it. This is still being worked on so the specifics will have to wait for a later date when it’s finalized.
As for layer 2, this involves other chains whose transactions are periodically added to the main Ethereum chain. So for example you could have thousands of transactions on the layer 2 chain of which the final state gets rolled up and added as one transaction on Ethereum. Which is much cheaper than doing those transactions all on chain. There are different types of Layer 2 and rollups which we will talk about later when we get to the Layer 2 section.
Ethereum smart contracts are compiled to run on the Ethereum Virtual Machine that Ethereum nodes run. If something is EVM compatible, it means it can run on Layer 1 Ethereum. This is especially relevant with Layer 2s like those built on Zero Knowledge Proofs. There is still some work to be done before you can take Ethereum smart contracts and run them on layer 2. zk-EVM is the goal that’s being worked on at the moment to try to fix this problem. The idea being that any smart contract that runs on layer 1 can run on a layer 2 zk-EVM compatible chain without changing a single line of code.
There are also other chains like Polygon that have EVM compatibility. So even though they run on a different chain, they are compatible with Ethereum. This EVM compatibility is definitely a selling point especially for other chains trying to lure projects to their chain. It also makes it easier to start thinking about interoperability between chains, or between different layers of chains. Something to keep in mind. All depends on what the vision is. All EVM compatibility is saying is that the smart contract can run on the Ethereum Virtual Machine meaning it can be ported to Ethereum.
Proof of Stake is not proven at the level Ethereum is operating at. Which is the primary blockchain of the world. If the cost of attacking the network is billions of dollars, what happens when trillions move on chain? This is a problem every single blockchain faces in terms of what happens when the pinata becomes valuable enough for the giants to start taking a whack at it. Like what happened with Luna, where billions of dollars were lost in a day.** **
The difference is Luna had a very well known security flaw that the core team/founder did not take seriously as a risk, given that attacking it would cost billions of dollars. That is until someone launched a billion dollar attack.
Ethereum is theoretically safe but what happens if the price of Eth crashes however? At the same time as a large entity launches a very expensive attack? This is unlikely as the mere act of buying the Eth would send the price high enough to make an attack unrealistic again. Theoretically Ethereum is as safe as a blockchain can be right now, but time will tell whether this plays out in reality the same way. For the record I don’t think this is a concern but it’s not impossible.
Flow is interesting now just for its consensus mechanism but for how it handles scaling. When you join the network, you can choose one of 4 types of nodes and stake an amount that you will lose if you misbehave Proof of Stake). The reward given to each node is constantly adjusted to incentivize a target ratio of : Collection (16.8%), Consensus (51.8%), Execution (7.8%), Verification (23.6%). So you can let different nodes specialize for execution or collection for example by building giant servers, and not hurt decentralization and security. Separate that into consensus nodes that can run on a laptop whose only job is to determine the order of the blocks. The others can optimize for their task. The way it works is:
Collection nodes hold the data needed for Execution and Verification for as long as needed. They work in random clusters that all are assigned the same transactions randomly. These nodes also run the consensus algorithm (Hotstuff BFT) to agree on the order of the transactions they hold in their collection.
Consensus nodes coordinate everything and keep track of the stake of every node in the network. They also do the slashing if anyone misbehaves.
Execution nodes execute the code given to them. This is the brilliant insight the Flow team had. To separate Consensus from Execution in this way. They were I think the first to see this. That execution is deterministic, in that it doesn’t need to happen at the same time as consensus. If the order of the blocks and transactions is confirmed, the actual transactions can be done afterwards since the math doesn’t change. 2+2 will always equal 4.
Verification nodes verify the execution nodes did their job properly. If not, they can submit a challenge to the consensus nodes who will then coordinate to see if the challenge was successful or not, and slash the stake of the party that did their job incorrectly. Including the Collection nodes if they don’t supply the data needed to check the challenge.
In my opinion this is one of the most brilliantly designed chains that exist. Even more importantly, the team that built it was trying to solve a problem they felt on Ethereum. Their CryptoKitties at the height of popularity throttled the entire Ethereum network as it couldn’t handle the amount of people transacting.
They built a chain to solve a problem they personally felt in the real world. This is very different to most chains that were built on a theoretical/ideological basis. As always with new ventures, it’s always better to build based on real world data than theory. This is something ingrained in Flow from genesis and is probably the 3rd most interesting chain for me personally after Ethereum and Bitcoin. Especially with how elegantly they’ve solved the scaling problem blockchains suffer from.
Flow uses Hotstuff BFT as the consensus algorithm. This was developed by VMware and was originally used by FaceBook’s discontinued project Libra. A blockchain FaceBook was developing internally before they shut the project down.
The algorithm works in rounds. A random leader is chosen each round until consensus is reached or timeout. The leader moves the consensus forward in 3 phase commit protocol: prepare, pre-commit, and commit. Consensus at each round starts with a block proposal by the leader and ends when a consensus is reached (or timeout). The minimum effective vote of ⅔ is needed to progress the leader’s proposal.
Flow also has a Distributed Random Beacon (DRB) as the source of randomness in the system. This is done by using a collection of threshold signatures and an empty block called a protoblock whose sole purpose is to help with random number generation. Once the number of signatures crosses the threshold. The DRB set up is done. This DRB can be used by the nodes at various points to secure the system. For example, this is how the leader of the next round of consensus is chosen. You cannot guess who the next leader is. Unless you had all the keys used to generate the DRB, theoretically you could find out and the result wouldn’t be random. However you’d have to have ALL the private keys so this is not a realistic scenario.
The problem is all of this is being done by Flow. Meaning it’s not distributed/decentralized enough. Ethereum for example has IPFS. An independent project. Or the various Layer 2s and side chains. It is truly decentralized. While Flow is technically excellent, it does not feel as decentralized. This isn’t necessarily a deal breaker as the team is continuing to develop and build out a network of independent builders. So in the future it could very well be as decentralized as Ethereum. Especially as the technology and the philosophy of the team is at its core pro-decentralization. Whether this is a critical flaw or a simple growing pain that will disappear over time remains to be seen.
Polygon used to be called Matic and was one of the original Plasma chains for Ethereum. The speed of Plasma chains is achieved by having one operator to manage ordering and executing of transactions, while periodically publishing the final state to Ethereum. With a master contract on Ethereum to handle moving funds to and off plasma chains.
Plasma chains try to move data and computation off chain (where rollups try to move just computation off chain.) The difference between a plasma chain and a shard chain is that shard chains submit more detailed information when they commit to the Ethereum mainnet, allowing the network to verify and enforce the validity of transactions on data shards. Plasma chains submit only minimal information about their state, so the transactions on the plasma chain cannot be verified by the mainnet, only the final state. So the security of the individual transactions is left up to the Plasma chain. (Given how closely Polygon works with Eth, it goes without saying that Polygon is EVM compatible as it also uses Solidity.)
The problem with Polygon, like any plasma chains, is that they don’t have the security of Ethereum. This is why rollups are preferred in that they don’t sacrifice Ethereum’s security to scale up. With Plasma you would submit only the final state, optimistic rollups for example would allow you to submit both the final state AND the transactions that got you to that final state. Allowing the Ethereum network to verify the validity of those transactions. Where’s with Plasma, you would only submit and verify the final state of those transactions.
Proof of History is a way to prove a passage of time has occurred during two events. Proof of replication is something else. I honestly can not bother to learn more about this chain. Let’s just go straight to the problem with Solana.
The problem is that Solana has multiple times now been put on pause. Meaning it can directly be controlled by a central party. What is the point of calling it a blockchain? The whole point of blockchain’s is that no central party has control of the network. No one can stop it. This is without even mentioning that the network goes “down” constantly like its some backend server. No wonder it’s blazing fast. It’s not a blockchain. At that point I don’t understand why you wouldn’t just use Amazon Web Services. It’s much faster and cheaper than this fake blockchain.
Apparently a really good Proof of Stake implementation.
Just going to jump ahead here. I know there are a lot of passionate Cardano enthusiasts. I just don’t know why I wouldn’t focus on Ethereum and layer 2s. One day I’ll bother to learn more and update this section but for now, it’s a placeholder.
Something about wanting to be a blockchain of blockchains.
I just don’t know why I wouldn’t focus on Ethereum and layer 2s. One day I’ll bother to learn more and update this section but for now, it’s a placeholder.
Something about wanting to be a blockchain of blockchains.
I just don’t know why I wouldn’t focus on Ethereum and layer 2s. One day I’ll bother to learn more and update this section but for now, it’s a placeholder.
There are two types of rollups. Fraud proof and Zero-Knowledge (ZK) rollups. The difference is that with Fraud proofs, you have to wait a challenge period of ~1 week for someone to challenge the transactions as fraudulent. Only after this waiting period would the transactions be finalized and you’d be free to move your funds. With ZK rollups, you would submit the validity proofs for the transactions with the rollups, so your funds would be available relatively instantly (~30 min.) Since the verification is submitted with the transactions, there is no waiting period.
The reason optimistic rollups were preferred is because zk rollups relied on SNaRKS which were a lot less efficient before. Especially with one party “relayer/prover” having to do the expensive computation of constructing blocks with zk proofs. This relayer is cryptographically secured from submitting fraudulent transactions or “running away” with the funds. With SNaRKS becoming more efficient, the upsides of zk-Rollups are becoming much larger than the downsides. Moving forward it is likely zk-Rollups will be the de-facto scaling solution for Ethereum and when combined with data sharding, it is expected most of Ethereum’s scaling problems will be solved.
Optimism is a layer two rollup using optimistic rollups. These work like Plasma chains in that the work is done on a sidechain and periodically rolled up to the layer 1 chain. The difference being that optimistic rollups submit the final state AND the transactions that got us to the final state from the initial state so that BOTH can be verified.
Arbitrum is another optimistic rollup based layer 2 solution. The difference between Arbitrum is that it uses multi round fraud proof instead of one round. Supposedly it’s better but I don’t care enough to find out to be honest with you. ZK-Rollup seems to be the winning solution so I don’t feel like bothering too much with optimistic rollups. The 1 week withdrawal period is too long when an alternative lets me withdraw in 30 min. I’m sure optimistic rollups are working on solutions using bridges that allow for instant withdrawals but ZK-Rollups just seem more technologically secure.
Starknet is a ZK-Rollup based on SNaRKs (Succinct Non-Arguments of Knowledge.) Zero Knowledge proofs are proofs where I can prove I know something without telling you what that thing is. SNaRKS is the name of a ZK proof.
Validium is like a hybrid of Plasma and ZK. Where the data is stored somewhere else, but uses zk proofs as a rollup solution. It’s the cheapest solution but doesn’t have the data guarantees of something like Starknet or ZK. The data needs to be held off-chain. This lets Validium achieve throughputs that zk Rollups can only dream of. The price is of course that whoever controls where the data is stored can freeze funds. This can be mitigated but is an inherent tradeoff.
So it’s situationally useful when the given tradeoffs are acceptable. Like in gaming where a gaming company would run the Validium data provider. Gaming requires a lot of throughput and so you could trust the gaming company would keep the node running otherwise lose all its users. The important items could still be held on chain, but the day to day gaming could run on layer 2 validium solution. So you have the scale needed to operate the game and the valuable stuff would still be secured using layer 1 Ethereum.
ZkSync is another layer 2 project built on zk-SNaRKS.
Note:
*This is a continuously growing document. It will be updated as I continue to learn and the ecosystem expands. If you have any questions or corrections, feel free to @ me on twitter or dm me @realsyedshah. *
Last Updated: Oct 27, 2022
Why this is Important to Understand
Consensus Algorithms
Brewer’s Theorem aka CAP theorem
Byzantine Generals Problem
Proof of Work vs Proof of Stake
Layer 1s
Bitcoin
The Problem with Bitcoin
Bitcoin Cash
The Problem with Bitcoin Cash
Bitcoin SV
The Problem with BitcoinSV
Ethereum
Separation of Consensus and Execution
How Ethereum’s Proof of Stake Works
Gasper
Future Scaling
EVM Compatibility
The Problem with Ethereum
Flow
Basics
Hotstuff BFT Consensus
The Problem with Flow
Polygon
Plasma Chain
The Problem with Polygon
Solana
I Can’t With This Chain
The Problem with Solana
Cardano
Ouroboros Proof of Stake
The Problem with Cardano
Cosmos
Tendermint BFT
The Problem with Cosmos
Polkadot
Nominated Proof of Stake
The Problem with Polkadot
Layer 2s
Ethereum
Optimism (Single Fraud Proof)
Arbitrum (Multi Fraud Proof)
Starknet (Zk-Rollup - Snark)
Validium
ZkSync (Zk-Rollup - Snark)
To put it bluntly, the blockchain world is full of grifters and marketers who will sell you on ideas and principles without any substance. The technology is powerful enough to attract the brightest minds. Despite the price volatility, interest in blockchain technology from students shows no sign of slowing. The idea of disrupting finance. The very plumbing of our society at the scale blockchain technology offers. The things that can be built on top of a new system. It’s the stuff of sci-fi, fantasy, make believe.
Everyone wants a piece and no one wants to be late to it. Especially given the backdrop of volatility the incumbent financial system is facing at the end of 2022, with central banks around the world going “bankrupt.” This creates an intense pressure to adopt or die. Even central banks are exploring the idea of digital currencies. Everyone wants a piece of the pie and no one wants to be late. This environment is the ideal scenario for anyone looking to take advantage and make quick money.
Having confidence with the technology underlying everything means it will be a lot harder for grifters to take advantage of you with the use of fancy buzzwords. You’ll be equipped to ask the simple questions that separate the grifters from those who are genuinely building the products and protocols that will change the course of human history.
At the heart of every single blockchain is a consensus algorithm. It’s the heartbeat on which everything else runs. Every blockchain solution is really just a package around a consensus mechanism. Why all the different implementations? Brewer’s Theorem aka CAP theorem.
This theorem states that any distributed data store (like a blockchain) can only guarantee 2 of the following 3:
Consistency - Every read receives most recent write/err
Availability - Every request receives a non-error response (without guarantee it’s most recent write)
Partition Tolerance - System continues to operate despite an arbitrary number of messages being dropped/delayed by network between nodes
What makes blockchains so powerful is that they can run on thousands of computers at the same time, and to take them down would mean taking down all the computers. The difficulty is in making sure all the computers agree on what the chain looks like currently. They have to be able to communicate with each other and agree on the current state of the chain. So even if there were computers in the network trying to mess everyone up, the computers would still be able to ignore the computers trying to mess them up and find genuine agreement.
This is another way of phrasing the Byzantine Generals Problem. A game theory problem around the idea that there are a group of generals each leading a portion of the army trying to coordinate. They are far apart and can only communicate by raven/pigeon. If they move together, they will win. If they make a split decision, they will lose. However, there are 1 or 2 generals who are trying to sabotage them and there’s no way to tell who the traitors are. How do you solve this problem? Aka trying to reach consensus with asynchronous communication and no central trusted leader.
There are 2 flavors of Consensus Algorithms, Proof of Work and Proof of Stake.
The first thing to clear up is what the consensus is that the network needs to reach. That is the order of the transaction blocks. As long as everyone has the blocks in the same order, the network will continue. This should be true even as people join and leave the network at will. Even if not everyone is online at the same time and not always able to communicate.
Bitcoin, the original blockchain, reached consensus using Proof of Work. The work would be to produce a hash number with a targeted number of 0s. This is by adding a random number to the block (the nonce) and changing it until the hash produced matches the target. This is easy to check because once you have the nonce, anyone can verify that it produces the right hash. Finding a nonce that satisfies the criteria is the hard part. The only way to do it is randomly. There is no formula or shortcut. It’s random. So just keep trying random numbers in the nonce until it works.
Then you use that block as an input into the next block. Since changing any block will change the hash of the following blocks, any computer can easily check to make sure none of the previous blocks have changed. If you wanted to change a single block in the past, you’d have to change every block afterwards, so you’d have to find the nonces fast enough to catch up to the system and go ahead.
This is because the nodes all look for and trust the longest chain they can find (the one with the most blocks). So if you made a change, you’d have to produce a longer chain than the honest chain. This is mathematically infeasible. The longest chain is the one that has the most “work” done on it, as producing a block means working out the nonce that produces the target result.
This is what Proof of Work (PoW) is (also referred to as Nakamoto Consensus after the mysterious creator of Bitcoin.) Just a bunch of computers guessing random numbers. The more computers there are to guess, the faster they find the target, and the system is programmed to adjust the difficulty so that it always averages around 10 min to find a block. Which means the more computers “mining” and trying to generate a block, the harder it will be. So this results in a LOT of electricity being used. A rather wasteful use of resources. Especially when there is the alternative of Proof of Stake. Whose security is based on economic game theory and probably just as secure if not more so, without the wasted resources.
Most of the blockchain’s after Bitcoin have experimented with various implementations of Proof of Stake (PoS). We will get into the different implementations of PoS later when we discuss the different layer 1 chains.
The basic idea is that different computers (nodes) in the system will put up a stake and volunteer to help generate and verify the next block. If they are discovered of malicious activity, they will lose their stake. The more they have at stake, the more they will be relied on to secure the network, the logic being they have the most to lose and are therefore more trustworthy. The rest is to have enough nodes checking the process so that statistically they are certain to catch malicious activity. For example, assuming there is at least one honest node, malicious activity will be caught and slashed (lose their stake). By taking the most conservative assumptions, PoS can be as close to statistically secure as possible.
The above description of Proof of Work is how Bitcoin’s consensus algorithm works. There are other chains that have taken Bitcoin’s PoW and added their variations. LiteCoin for example uses a more memory intensive hashing algorithm (Scrypt) and has a max supply of 84 million coins as opposed to Bitcoin’s 21 million. The system is also set up to target a difficulty of around 2.5 min to generate a new block. While Bitcoin is not as fancy as say Ethereum in that you can’t run smart contracts on it, it has something just as powerful going for it. Trust. It has existed for long enough and scaled large enough that when push comes to shove, there is an inherent trust the crypto/blockchain community has with Bitcoin. Not to mention the technological breakthrough that is Bitcoin is nothing to scoff at.
The problem with Bitcoin is simply that it doesn’t run smart contracts. So in the long run, will it still hold up as a store of value. Is not having smart contracts a feature or a bug? Does it make it more trustworthy? Or will people simply not bother and stay on Ethereum for example. Or will everyone develop smart contracts and Bitcoin becomes a kind of intermediary currency all the different chains use to move value between each other? Or would they simply just work with each other's native currencies using bridges (smart contracts that hold tokens that can be accessed by a contract that's controlled by a smart contract on another chain.)
Bitcoin Cash is an interesting chain because it came about as a result of a massive debate in the Bitcoin community. Namely around the maximum block size. There were those who wanted to increase the block size as the network grew more popular to be able to support the growing size of the network. Making it faster and cheaper as users wouldn’t have to compete on tx fees to try to get in the smaller blocks. Which would let Bitcoin work as a currency, as it was meant to. This is team Bitcoin Cash. The other side took a more traditional view; this went against Satoshi’s vision. If block size kept increasing, it would make running a node more difficult as requirements would mean eventually most people couldn’t run Bitcoin on their computer and only those who could afford it would. Making the network more centralized as a result.
This resulted in a fork where those who wanted to change the block size did so and continued the chain with the new block size and renamed it to Bitcoin Cash, so that it would work as a currency, the way they said Bitcoin was always meant to work. The battle in online communities during this time (2017) was legendary. Lots of psyops and online discourse manipulation by all kinds of powerful entities. For example, most of the core Bitcoin devs had been hired to work for 1 company over the past year before the debate that resulted in the Bitcoin Cash fork.
The problem with Bitcoin Cash is similar to the problem with Bitcoin but more so. As a currency, why wouldn’t I simply stick to Eth for example, since most of my work will be done there and Ethereum is much more deliberate about scaling the chain. Bitcoin Cash is an attempt to scale Bitcoin but if Bitcoin’s value resides in it not scaling up to allow more transactions, to enable it to act more as a store of value. Then Bitcoin Cash doesn’t make sense, as you would be better off on other chains that scale better.
However with the other chains focused on Proof of Stake, there is room for a Proof of Work alternative like Bitcoin Cash. Should the impossible happen and Proof of Stake proves to be corruptible.
Bitcoin Satoshi Vision is an attempt to bring smart contracts to Bitcoin. The idea behind this chain is to keep all the parameters (10 min block time, max coin supply, etc) the same as in Satoshi’s original Bitcoin whitepaper, but to use sCrypt as the language to allow adding smart contracts to Bitcoin. This chain is a fork of Bitcoin Cash as they wanted to increase the block size further which the Bitcoin Cash community did not agree to. Which makes sense as their vision is for Bitcoin to run as a currency and smart contracts seem superfluous to this. Resulting in the birth of BitcoinSV.
The official discord has 3k members at the time of writing (Oct of 2022) so it’s still a very small community. With the forum having double digit posts. Which matches my personal feelings of not understanding the use case of building smart contracts on a Bitcoin fork as opposed to Ethereum or zkEVM. However, in a world where Ethereum for whatever reason doesn’t work or there is a fall out in the community. There will definitely be a flight to different chains and the trust element that Bitcoin will have means BSV could certainly be a large player. This is an extremely unlikely scenario and there are other promising chains to move to that feel more technically impressive.
Ethereum, as of Sept 15, 2022, is no longer proof of work, but instead Proof of Stake. Ethereum’s flavor of Proof of Stake is built around two themes:
Separation of Consensus and Execution
Gasper: Managing Forks and Finalizing Blocks
The Execution layer is the same Ethereum as it exists today. This is where computers execute the smart contracts and transactions on the blocks that make up the chain. The difference is that before, the order of the blocks would be the one with the most work done on it (aka most blocks) and the reward would be automatically given to the node that solved the target problem (“mined” the block.)
With Proof of Stake, all the nodes wanting to participate in securing the system must lock up (stake) 32 Eth. This is to ensure honest behavior as dishonest behavior will result in losing the Eth you have staked. It is also possible to join a staking pool if you have less than 32 Eth and distribute the rewards between everyone in the pool. There is a complaint that in Proof of Work, you only need a computer and now you need 32 Eth to get rewards, so the rich get richer, centralization etc… Realistically unless you were part of a mining pool, you were not getting a reward and so, joining a mining pool is the same as joining a staking pool in terms of the reward you're getting. So when you stake your 32 Eth, you become a validator.
The way the network works is in 12 second slots and 32 slots make an epoch (6.4 min). Every slot there is a committee of minimum 128 validators, 1 of which will be randomly chosen to propose a block, another who will randomly be chosen to aggregate the messages the committee sends to each other.
So the proposer sends the block to the other nodes in the committee. They all check and validate that everything about the block is legitimate and sign off (sign attestation) on it and send the message to the aggregator. This block is then justified, but not finalized. That is where the epochs come in. After 32 slots (not all of which need to have a block, it is possible to have empty slots) the last block in the epoch (slot 32) is the finalizing block.
In order for a block to be finalized, ⅔ of the total Eth staked in the network has to sign off on it. Once a block is finalized, it is considered a checkpoint block and also finalizes all the blocks that came before it in the epoch. There is also an inactivity leak, in the event that more than ⅓ of the total staked Eth is not signing off on blocks and preventing the network from continuing. After 4 epochs, the validators who are not contributing will bleed away their Eth until there is ⅔ of the network signing off on blocks to continue the chain.
It’s possible for there to be temporarily two different chains since not every node can talk to every other node (downside to being decentralized and asynchronous.) Especially if one of the block proposers is being naughty. There needs to be a way to settle these temporary forks, which is where Gasper comes in. A combination of LMD-Ghost and Casper-FFG. Those are the names of the algorithms that basically tell the network: go with the fork that has the greatest accumulated weight of attestations (most staked yes votes) and if multiple messages are received from a validator, only the latest one is considered. This is an improvement on Casper which only looked at the longest chain (the one furthest from the genesis block.)
The future of scaling the network to handle more transactions will involve sharding and layer 2 rollups. The current plan I believe is to have 64 sharded chains who will handle data availability so that there isn’t one chain handling all the data of the world. With economic incentives and random sampling tests to ensure the right data is held for whichever node needs it. This is still being worked on so the specifics will have to wait for a later date when it’s finalized.
As for layer 2, this involves other chains whose transactions are periodically added to the main Ethereum chain. So for example you could have thousands of transactions on the layer 2 chain of which the final state gets rolled up and added as one transaction on Ethereum. Which is much cheaper than doing those transactions all on chain. There are different types of Layer 2 and rollups which we will talk about later when we get to the Layer 2 section.
Ethereum smart contracts are compiled to run on the Ethereum Virtual Machine that Ethereum nodes run. If something is EVM compatible, it means it can run on Layer 1 Ethereum. This is especially relevant with Layer 2s like those built on Zero Knowledge Proofs. There is still some work to be done before you can take Ethereum smart contracts and run them on layer 2. zk-EVM is the goal that’s being worked on at the moment to try to fix this problem. The idea being that any smart contract that runs on layer 1 can run on a layer 2 zk-EVM compatible chain without changing a single line of code.
There are also other chains like Polygon that have EVM compatibility. So even though they run on a different chain, they are compatible with Ethereum. This EVM compatibility is definitely a selling point especially for other chains trying to lure projects to their chain. It also makes it easier to start thinking about interoperability between chains, or between different layers of chains. Something to keep in mind. All depends on what the vision is. All EVM compatibility is saying is that the smart contract can run on the Ethereum Virtual Machine meaning it can be ported to Ethereum.
Proof of Stake is not proven at the level Ethereum is operating at. Which is the primary blockchain of the world. If the cost of attacking the network is billions of dollars, what happens when trillions move on chain? This is a problem every single blockchain faces in terms of what happens when the pinata becomes valuable enough for the giants to start taking a whack at it. Like what happened with Luna, where billions of dollars were lost in a day.** **
The difference is Luna had a very well known security flaw that the core team/founder did not take seriously as a risk, given that attacking it would cost billions of dollars. That is until someone launched a billion dollar attack.
Ethereum is theoretically safe but what happens if the price of Eth crashes however? At the same time as a large entity launches a very expensive attack? This is unlikely as the mere act of buying the Eth would send the price high enough to make an attack unrealistic again. Theoretically Ethereum is as safe as a blockchain can be right now, but time will tell whether this plays out in reality the same way. For the record I don’t think this is a concern but it’s not impossible.
Flow is interesting now just for its consensus mechanism but for how it handles scaling. When you join the network, you can choose one of 4 types of nodes and stake an amount that you will lose if you misbehave Proof of Stake). The reward given to each node is constantly adjusted to incentivize a target ratio of : Collection (16.8%), Consensus (51.8%), Execution (7.8%), Verification (23.6%). So you can let different nodes specialize for execution or collection for example by building giant servers, and not hurt decentralization and security. Separate that into consensus nodes that can run on a laptop whose only job is to determine the order of the blocks. The others can optimize for their task. The way it works is:
Collection nodes hold the data needed for Execution and Verification for as long as needed. They work in random clusters that all are assigned the same transactions randomly. These nodes also run the consensus algorithm (Hotstuff BFT) to agree on the order of the transactions they hold in their collection.
Consensus nodes coordinate everything and keep track of the stake of every node in the network. They also do the slashing if anyone misbehaves.
Execution nodes execute the code given to them. This is the brilliant insight the Flow team had. To separate Consensus from Execution in this way. They were I think the first to see this. That execution is deterministic, in that it doesn’t need to happen at the same time as consensus. If the order of the blocks and transactions is confirmed, the actual transactions can be done afterwards since the math doesn’t change. 2+2 will always equal 4.
Verification nodes verify the execution nodes did their job properly. If not, they can submit a challenge to the consensus nodes who will then coordinate to see if the challenge was successful or not, and slash the stake of the party that did their job incorrectly. Including the Collection nodes if they don’t supply the data needed to check the challenge.
In my opinion this is one of the most brilliantly designed chains that exist. Even more importantly, the team that built it was trying to solve a problem they felt on Ethereum. Their CryptoKitties at the height of popularity throttled the entire Ethereum network as it couldn’t handle the amount of people transacting.
They built a chain to solve a problem they personally felt in the real world. This is very different to most chains that were built on a theoretical/ideological basis. As always with new ventures, it’s always better to build based on real world data than theory. This is something ingrained in Flow from genesis and is probably the 3rd most interesting chain for me personally after Ethereum and Bitcoin. Especially with how elegantly they’ve solved the scaling problem blockchains suffer from.
Flow uses Hotstuff BFT as the consensus algorithm. This was developed by VMware and was originally used by FaceBook’s discontinued project Libra. A blockchain FaceBook was developing internally before they shut the project down.
The algorithm works in rounds. A random leader is chosen each round until consensus is reached or timeout. The leader moves the consensus forward in 3 phase commit protocol: prepare, pre-commit, and commit. Consensus at each round starts with a block proposal by the leader and ends when a consensus is reached (or timeout). The minimum effective vote of ⅔ is needed to progress the leader’s proposal.
Flow also has a Distributed Random Beacon (DRB) as the source of randomness in the system. This is done by using a collection of threshold signatures and an empty block called a protoblock whose sole purpose is to help with random number generation. Once the number of signatures crosses the threshold. The DRB set up is done. This DRB can be used by the nodes at various points to secure the system. For example, this is how the leader of the next round of consensus is chosen. You cannot guess who the next leader is. Unless you had all the keys used to generate the DRB, theoretically you could find out and the result wouldn’t be random. However you’d have to have ALL the private keys so this is not a realistic scenario.
The problem is all of this is being done by Flow. Meaning it’s not distributed/decentralized enough. Ethereum for example has IPFS. An independent project. Or the various Layer 2s and side chains. It is truly decentralized. While Flow is technically excellent, it does not feel as decentralized. This isn’t necessarily a deal breaker as the team is continuing to develop and build out a network of independent builders. So in the future it could very well be as decentralized as Ethereum. Especially as the technology and the philosophy of the team is at its core pro-decentralization. Whether this is a critical flaw or a simple growing pain that will disappear over time remains to be seen.
Polygon used to be called Matic and was one of the original Plasma chains for Ethereum. The speed of Plasma chains is achieved by having one operator to manage ordering and executing of transactions, while periodically publishing the final state to Ethereum. With a master contract on Ethereum to handle moving funds to and off plasma chains.
Plasma chains try to move data and computation off chain (where rollups try to move just computation off chain.) The difference between a plasma chain and a shard chain is that shard chains submit more detailed information when they commit to the Ethereum mainnet, allowing the network to verify and enforce the validity of transactions on data shards. Plasma chains submit only minimal information about their state, so the transactions on the plasma chain cannot be verified by the mainnet, only the final state. So the security of the individual transactions is left up to the Plasma chain. (Given how closely Polygon works with Eth, it goes without saying that Polygon is EVM compatible as it also uses Solidity.)
The problem with Polygon, like any plasma chains, is that they don’t have the security of Ethereum. This is why rollups are preferred in that they don’t sacrifice Ethereum’s security to scale up. With Plasma you would submit only the final state, optimistic rollups for example would allow you to submit both the final state AND the transactions that got you to that final state. Allowing the Ethereum network to verify the validity of those transactions. Where’s with Plasma, you would only submit and verify the final state of those transactions.
Proof of History is a way to prove a passage of time has occurred during two events. Proof of replication is something else. I honestly can not bother to learn more about this chain. Let’s just go straight to the problem with Solana.
The problem is that Solana has multiple times now been put on pause. Meaning it can directly be controlled by a central party. What is the point of calling it a blockchain? The whole point of blockchain’s is that no central party has control of the network. No one can stop it. This is without even mentioning that the network goes “down” constantly like its some backend server. No wonder it’s blazing fast. It’s not a blockchain. At that point I don’t understand why you wouldn’t just use Amazon Web Services. It’s much faster and cheaper than this fake blockchain.
Apparently a really good Proof of Stake implementation.
Just going to jump ahead here. I know there are a lot of passionate Cardano enthusiasts. I just don’t know why I wouldn’t focus on Ethereum and layer 2s. One day I’ll bother to learn more and update this section but for now, it’s a placeholder.
Something about wanting to be a blockchain of blockchains.
I just don’t know why I wouldn’t focus on Ethereum and layer 2s. One day I’ll bother to learn more and update this section but for now, it’s a placeholder.
Something about wanting to be a blockchain of blockchains.
I just don’t know why I wouldn’t focus on Ethereum and layer 2s. One day I’ll bother to learn more and update this section but for now, it’s a placeholder.
There are two types of rollups. Fraud proof and Zero-Knowledge (ZK) rollups. The difference is that with Fraud proofs, you have to wait a challenge period of ~1 week for someone to challenge the transactions as fraudulent. Only after this waiting period would the transactions be finalized and you’d be free to move your funds. With ZK rollups, you would submit the validity proofs for the transactions with the rollups, so your funds would be available relatively instantly (~30 min.) Since the verification is submitted with the transactions, there is no waiting period.
The reason optimistic rollups were preferred is because zk rollups relied on SNaRKS which were a lot less efficient before. Especially with one party “relayer/prover” having to do the expensive computation of constructing blocks with zk proofs. This relayer is cryptographically secured from submitting fraudulent transactions or “running away” with the funds. With SNaRKS becoming more efficient, the upsides of zk-Rollups are becoming much larger than the downsides. Moving forward it is likely zk-Rollups will be the de-facto scaling solution for Ethereum and when combined with data sharding, it is expected most of Ethereum’s scaling problems will be solved.
Optimism is a layer two rollup using optimistic rollups. These work like Plasma chains in that the work is done on a sidechain and periodically rolled up to the layer 1 chain. The difference being that optimistic rollups submit the final state AND the transactions that got us to the final state from the initial state so that BOTH can be verified.
Arbitrum is another optimistic rollup based layer 2 solution. The difference between Arbitrum is that it uses multi round fraud proof instead of one round. Supposedly it’s better but I don’t care enough to find out to be honest with you. ZK-Rollup seems to be the winning solution so I don’t feel like bothering too much with optimistic rollups. The 1 week withdrawal period is too long when an alternative lets me withdraw in 30 min. I’m sure optimistic rollups are working on solutions using bridges that allow for instant withdrawals but ZK-Rollups just seem more technologically secure.
Starknet is a ZK-Rollup based on SNaRKs (Succinct Non-Arguments of Knowledge.) Zero Knowledge proofs are proofs where I can prove I know something without telling you what that thing is. SNaRKS is the name of a ZK proof.
Validium is like a hybrid of Plasma and ZK. Where the data is stored somewhere else, but uses zk proofs as a rollup solution. It’s the cheapest solution but doesn’t have the data guarantees of something like Starknet or ZK. The data needs to be held off-chain. This lets Validium achieve throughputs that zk Rollups can only dream of. The price is of course that whoever controls where the data is stored can freeze funds. This can be mitigated but is an inherent tradeoff.
So it’s situationally useful when the given tradeoffs are acceptable. Like in gaming where a gaming company would run the Validium data provider. Gaming requires a lot of throughput and so you could trust the gaming company would keep the node running otherwise lose all its users. The important items could still be held on chain, but the day to day gaming could run on layer 2 validium solution. So you have the scale needed to operate the game and the valuable stuff would still be secured using layer 1 Ethereum.
ZkSync is another layer 2 project built on zk-SNaRKS.
Syedshah.eth🏴☠️🌊
Syedshah.eth🏴☠️🌊
No comments yet