BLOCKVIEW

Understanding The Blockchain Using Bitcoin And Ethereum

In the previous chapter, we mentioned that in order to change the ledger data on all copies of the ledger throughout the whole network, the network nodes(computers) need to reach a mutual agreement about such a change. This is called Consensus in the blockchain.

If We assume there are malicious nodes(computers) in the network. Therefore, the system must be able to withstand not only simple node failures(single computer failure) but also attacks to a certain extent.

There are various consensus mechanisms used in the blockchain used by different networks to reach agreement on what is true or false in the network. For example, Bitcoin uses the Nakamoto Consensus which employs the longest chain rule while the Ethereum network uses a Proof-of-Stake based consensus mechanism.

consensus on the bitcoin network

The Nakamoto consensus couples a Sybil protection mechanism of Proof-of-Work with the longest-chain rule, a novel consensus invented by Satoshi Nakamoto for Bitcoin in 2008. This means the node(computer) with the longest chain of blocks is the most correct and detailed node and thus network actors will choose it as the correct node(computer) in any dispute.

Thought Experiment

Let's assume there is a dispute on the Bitcoin network between two nodes(computers). The network will choose the node with the longest chain of blocks as the correct block. This is because that node has more amount of verified history of the Bitcoin network than the other and as such can be trusted to give the correct state of the blockchain.

nakamoto

Proof of Work Mechanism

Proof-of-work is a way for the Bitcoin network to decide which computer (node) figured out the puzzle first and added the latest batch of transactions (block) to the blockchain.

Mining is the process of solving a complex computer problem by brute-forcing(guessing) a number(nounce) that when used with the rest of the block details generates a valid hash for the block. The process of solving the problem involves high computation which is the work done by the miner and proof of that work is broadcasted to the network to show which node solved the problem first, thus the name Proof-of-work. After broadcasting it to the network, that block is added to the blockchain and the miner incentivized for securing the network.

A valid hash for a blockchain is a special code that meets specific rules. For example, it might need to start with three zeros. The more zeros needed, the harder the problem. A miner (computer) begins with a number called a nonce set to 0. The miner keeps changing the nonce by adding 1 each time and recalculating the hash. When the miner finds a nonce that makes the hash start with the required number of zeros, they have a valid hash.

Data Integrity On Blockchain Networks

how do we make sure the state of the data is never corrupted in any way (ie, data lost, data maliciously manipulated, etc)? The next parts of the section touch on how difficult it is to manipulate data in a block that already has many blocks mined on top of it. Since data is an input variable for the hash of each block, changing the data will change that block's hash. The new hash will not have three leading zeros, and therefore becomes invalid. Manipulating data in a block that has been nested deeply in the chain is a fool's errand.

Thought Experiment

To give an example: In Bitcoin's genesis block, Frank sent 10 BTC to Halley. Manipulating this value from 10 BTC to 20 BTC (Maybe Halley wants some more BTC!) would require IMMENSE computational power as halley will need to rehash other blocks, recall that more blocks are still being mined so halley will need to also hash the current blocks mined. This is not feasible as it requires so much computational power and resources.

nakamoto

consensus on the ethereum network

The Ethereum network makes use of a Proof-of-Stake based mechanism to reach consensus on the state of their blockchain network.

The Proof-of-Stake mechanism involves network actors staking a certain amount of network token choosen by the network. This ensures that network actors have a lot to loose if they choose to be malicious. These network actors are called Validators as all they do is to validate a block and broadcast to the network.

In Proof-of-Stake, there is no need for mining or computational work as the network chooses which network participant gets to validate a block based on the proof of staked network tokens.

On the Ethereum network, about 32ETH Tokens must be staked before becoming a validator on the network.

staked

Blockview © copyright 2024