Blocks

Blocks are records of valid transactions, consisting of a hash of the previous block which links blocks together in the chain. Hashes are cryptographically generated from the block data. These hashes make Blockchains virtually immune to fraud. A single change in any block would invalidate all subsequent blocks, and all subsequent hashes could not change--as they would have to if any previous block were changed--without alerting everyone to the fact.

Why Blocks?

Transactions are batched into blocks to ensure that all participants on the XDC network maintain a synchronized state and agree on the history of every transaction. Blocks allow transactions to be committed, agreed-upon, and synchronized all at once.

By spacing out commits, all network participants get enough time to reach a consensus. Although many transaction requests occur per second, blocks on XDC are committed and listed approximately once every fifteen seconds.

How Do Blocks Work?

Blocks and transactions within the blocks are strictly ordered to preserve the transaction history. Every new block contains a reference to its parent block.

Once a validator validates a block on the network, it is propagated to the rest. All nodes in the network add this block at the end of their chain, and the process continues. The XDPoS (XDC Delegated Proof of Stake) protocol specifies the exact block-assembly (mining) and consensus processes.

How Does XDC DPoS work?

XDC Delegated Proof of Stake (XDPoS) is more efficient than the PoS consensus mechanism. XDPoS uses a reputation system to achieve consensus. The masternode of the network creates blocks in a round-robin manner. The elected block producers or the witnesses are rewarded for validation of the transactions for the next block.

i) Block producers are elected randomly, and only a few can sign and create blocks.

ii) Block validators are the full nodes that verify that the blocks the block producers created follow the consensus rule.

The main difference between XDPoS and PoS is in the consensus mechanism of XDPoS. The community members have more rights in the governance of the network.

What's in a Block?

  • Block number: The length of the blockchain.

  • Timestamp: The exact time or the instance when the block was mined.

  • mixHash: A unique identifier for the block.

  • A parent hash: The unique identifier for the parent block

  • Difficulty: The effort required to mine the block.

  • Nonce: The number of transactions created and sent from the account. It also ensures that transactions are processed only once.

  • Transactions list: Transactions that are included in the block.

  • State root: The entire state of the system, including account nonces, contract storage, account balances and contract code.

Block Size

Blocks themselves are limited in size. Each block has a gas limit set collectively by the network and the validators. The amount of gas that all transactions in the block consume must be less than the block gas limit. It is necessary because it ensures that blocks are not arbitrarily large. If blocks become arbitrarily large and less performant, full nodes would gradually stop keeping up with the network because of speed and space requirements.

Last updated