Blockchain 101 - Why double producing is bad

Background

A blockchain is a type of distributed database, where all of the nodes in the network use a set of rules to agree on what data should be in the database. These rules are called "consensus rules". These rules are important, because they prevent the nodes in the blockchain from having inconsistent sets of data.

A common example of why inconsistent data would be bad is called "double spending". If user A sent 1 token to user B, and then user A tried to send the same token to user C - it would be really bad if the nodes did not all agree on who had the token. Both user B and C could be tricked into thinking they had the token.

Blockchains are state-based databases. A "block" is a set of transactions that update the state of the database. The data in the database only changes when a new block is produced. During the time between blocks, the data in the database is static (it doesn't change). Whenever a new block is produced, it gets distributed to all the nodes in the network - which then validate whether or not the block is 'valid'. If the nodes consider the block valid, then they update their state.

Every new block that is produced is connected to all the previous blocks. This is why blockchains are called blockchains (chain of blocks). Whenever the nodes in the network validate a new block, they also validate that the previous blocks in the chain are valid too.

Forks

When two (or more) nodes in a blockchain do not agree on which data is correct, this is called a fork. In order to preserve the integrity of the network's data, the nodes must reach an agreement on which set of data is correct.

Typically the way this is handled is by a method called "longest chain". Each version of the inconsistent data will have a set of one or more blocks that makes it different than the other version(s). The next time a new block gets produced, the block producer will have to choose which of the chains to append the next block to. Eventually one chain will become longer than the rest. The longest chain becomes the 'valid' chain, and the rest are considered invalid.

Miners vs. Witnesses

Different blockchains have different protocols to determine who produces the next block.

In Proof of Work (PoW) blockchains (such as Bitcoin and Ethereum), the block producers are called "miners". Miners compete to solve complicated math problems that can only be solved with heavy computing power. Whoever solves the math problem first, gets to produce the next block.

Steem uses a protocol called Delegated Proof of Stake (DPoS), which is much more efficient than PoW. In DPoS, the token-holders (users who hold Steem Power) get to elect the block producers. They do this by voting. The block producers are called witnesses.

Steem Block Production Assignments

The Steem blockchain automatically assigns blocks to the witnesses. Whichever witness is assigned the block is responsible for producing it within the given time window. Blocks are spaced 3 seconds apart. Every 63 seconds, the Steem blockchain will produce a "round" of 21 blocks.

20 of the 21 blocks are produced by the 20 witnesses who have the most votes (measured in Steem Power). These witnesses are called the "top 20 witnesses".

The remaining block is randomly assigned to one of the remaining witnesses (called "backup witnesses"), with a probability equal to their percentage of votes (again measured in Steem Power) relative to the other backup witnesses.

Double Producing

The term "double producing" refers to a block producer creating two different blocks, and then distributing them both to the nodes in the network.

Double producing is really bad, because it creates a fork. Until all of the nodes in the network can agree on which of the two blocks is to become the 'longest chain', there will be two different versions of data floating around.

Double producing may also cause other witnesses to miss blocks, if the block they produce ends up on what becomes the shorter chain.

If an application or end-user makes a decision based on data that ends up being in the shorter chain, that data may become invalid after the longest chain is formed. This can be really bad if important decisions get made based on this invalid data.

Malicious users could potentially exploit this by attempting to double spend.

Punishment for Double Producing

In the 'early days' of Steem, the consequences for doing this were extremely severe. Anyone who caught another witness double producing could literally take all of the Steem Power from the double-producer's account.

The method that allowed this ended up getting turned off because it turned out that there was a potential exploit, but the fact that it was there should indicate how serious this is.

H2
H3
H4
3 columns
2 columns
1 column
52 Comments