Figure 1. Data structure diagram of blockchain
As can be seen from Figure 1, each block is divided into a block header
and a block data section. The block data section is primarily used to
store data information, such as transaction records in Bitcoin
system[6], smart contracts in Ethereum system[7], etc. The block
header records summary information of current block, including the
Merkle tree root hash value of block data, and stores the block header
hash value of previous block. Due to the one-way irreversibility of hash
function, any tampering on block data requires simultaneous forgery of
data’s Merkle tree root hash value and of the block header hash value of
previous block, which increases data tampering difficulty. Blockchain
applies a consensus algorithm mechanism, which would be briefly
explained in this section, making tampering with block data almost
impossible.
2.1. Brief Description of the Proof of Work Principle
In blockchain system, to maintain data consistency across all network
nodes, it is necessary to synchronize storage data of all nodes
according to certain rules after a new block is generated. This rule is
known as consensus mechanism. Various implementation schemes for
consensus mechanisms based on different principles have been
proposed[8], and Proof of Work (PoW) is one of the most
representative, having been applied to Bitcoin system and undergone
extensive practical testing[9]. The research approach of this paper
is also based on PoW algorithm, and its principle is briefly introduced
below.
Figure 2 shows a simplified flowchart of PoW algorithm. From the
flowchart, it can be seen that PoW algorithm is mainly divided into
three steps:
(1) Generate Merkle root hash value;
(2) Assemble block header;
(3) Iteratively calculate current block header hash value.