What is transactional consensus



In this blog post, we explain how transactions find their way into the bitcoin blockchain and show how the network is able to reach consensus on the current state of the ledger. We study the data structure of blocks, discuss how these blocks are linked together, and analyze the basics of bitcoin mining, the underlying game theory, and the proof of work consensus mechanism.

Blocks and the Blockchain

Each full node maintains its own set of verified transactions (the so called mempools) that have not yet been confirmed, waiting for inclusion into the bitcoin blockchain. These mempools are likely to differ. The bitcoin system must therefore provide a procedure that allows the network to agree on which transactions should be included in the bitcoin blockchain.

The bitcoin blockchain

The bitcoin blockchain is the public ledger of the bitcoin system that contains all the transactions that have been processed since the genesis block. It is a continuously expanding database, which allows users to query the allocation of bitcoin units for any point in time.

Components of a block

The bitcoin blockchain is composed of so-called blocks. Each block contains at least one transaction. Every block must include these contents and be formatted in the correct way. In addition to the transaction data, a block must include a so-called block header, which consists of 640 bits (80 bytes) of descriptive data that allow the block to be identified and located within the blockchain.

Structure and components of a block

Version: the version field identifies the version of the protocol that was used to generate the block. It is a 32-bit number that provides information about the underlying set of rules operating when the block was generated and thuis references the rules that must be applied to validate the respective block. The version input is essential for the modifiability of the rules. If all the blocks in the blockchain had to be validated using the same rules, it would not be necessary to do so.

Reference: the reference field links the block to a previous block to a previous block, usually referred to as parent block.

Timestamp: the timestamp field contains information relating to the time at which the block was generated. The timestamp field contains information relating to the time at which the block was generated. The timestamp must lie within a time interval. The lower bound is the median value of the timestamps of the previous eleven blocks, and the upper bound is two hours after hours after the time at which the block was accepted into the blockchain.

Threshold value: the threshold value field contains the maximum value that a block’s hash value can have for it to be considered valid by the network. The threshold value plays an important role in the consensus protocol.

Nonce: the nonce field allows for the inclusion of arbitrary data. Modifying the nonce field ensures that blocks with otherwise equivalent contents may nevertheless have different hash values. This entry plays a crucial role for the consensus protocol.

Merkle Root: the merkle root field contains the root of the merkle tree that is constructed from all transactions included in the block. The transactions themselves are not incorporated in the block. The transactions themselves are not incorporated in the block header. The Merkle roots purpose is to guarantee the integrity of the transactions included in the block.

Example of a blockchain

Chain structure

A block references precisely one parent block. These references generate a sequence of blocks that is analogous to a chain, from which it derives its name, blockchain. Every valid block has a specific position within this chain, which is defined by two terms: blockheight and block depth. The term block height identifies the position of a given block within the chain, where the first block (the so called genesis block) is assigned the number zero. For this reason, a blocks block depth increases with each block that is added to the bitcoin blockchain. The block depth is important for security analyses. Moreover , it also offers spv nodes a heuristic for evaluating the validity of transactions.

Consensus protocol

In the bitcoin network anyone can adjust his personal copy of the bitcoin blockchain. There is no centralized party that determines which blockchain version corresponds to the true state. Accordingly, there may be situations where the network participants do not agree on the true state of the blockchain. To counteract this problem, the bitcoin system is based on predefined set of consensus rules that enables one version of the bitcoin ledger to be identified as the true version.

Only legitimate transactions

The most basic consensus rule is that the bitcoin blockchain may contain only legitimate transactions. The legitimacy of transactions can be validated independently by every full node. In addition, there is a whole series of other tests, all of which determine the validity of a transaction and the blocks who include them. Many of these tests only serve as protection against a forced overload of the network (DOS attacks)

Proof of work

The computing power needed to generate a candidate block is so small that the process can be accomplished in a fraction of a second, even with a mobile device. This has the consequence that new candidate blocks can be produced much faster than the time it takes to exchange them over the network. We therefore need an artificial restriction that makes it harder to create a valid candidate block and therefore gives the network the time it needs to exchange data and reach consensus. This is achieved through the so- called proof of work consensus mechanism.

Mining reward and bitcoin creation

Proof of work imposes costs on the nodes when generating blocks. This is a deliberate design decision that is absolutely indispensable for the system to function. In particular, the mining process secures the bitcoin network. By securing the bitcoin network, the miners provide a public good because the benefits are nonexcludable and nonrivalrous.

Transaction fees

Miners can also earn income from transaction fees associated with the block. These fees consist of the sum of all transaction inputs minus the sum of all transaction outputs. They are thus a kind of residual amount that has not been used and can be claimed by the respective miner.

The consensus version

One important rule to ensure consensus still remains to be discussed. If two or more versions of the blockchain are in circulation, there must be a mechanism in place that allows the nodes to decide which of these versions corresponds to the true state of the bitcoin blockchain. For consensus to be achieved, all nodes or at least the majority of nodes must agree on the same outcome.

Connecting the dots

The combination of these consensus rules will lead to a dominant version of the bitcoin blockchain.

Legitimacy: legitimacy prevents inconsistent and invalid transactions from entering into the consensus version of the blockchain.

Linking: linking connects the blocks and ensures that blocks have to be recomputed after a modification of the chain. This applies to modified and all subsequent blocks.

Proof of work: proof of work makes it difficult to create valid blocks. If a chain is modified, it can be rebuilt only by employing substantial resources. This makes modifications resource intensive.

Threshold value: the variable-threshold value ensures that the rate of block generation remains constant at a ten-minute average, irrespective of the amount of hashing power employed.

Rewards: reward incentive nodes to make hashing power available and to utilize it to maintain the consensus version of the blockchain.

Aggregated difficulty: this criterion serves to ensure that when there are conflicting versions of the blockchain, the version that has received the most work will be considered the consensus version.

Hope you had a fantastic reading