Seen as datatype, is Blockchain a single linked list? As each block refers to the previous block using a hash.
Or is it some kind of tree?
Are Blockchains Related to Linked Lists? Blockchains can be represented as a singly linked list. While they have a close structure to that of a linked list, they are not a linked list. A linked list is a programming language data structure.
A linked list is a linear way of arranging and storing data. Blockchains, for example, have Merkle Trees to store transactions and all the data related to the transactions. Moreover, these Merkle trees (or blocks) have a link to their parent hash with the unique hash number.
The Bitcoin blockchain converges to a single-file chain because each block references exactly one predecessor, and thus there can only be one block at every height in the chain connecting the genesis block and the chain-tip. However, at times more than one block will be found at the same height.
The blockchain data structure is an ordered, back-linked list of blocks of transactions. The blockchain can be stored as a flat file, or in a simple database. The Bitcoin Core client stores the blockchain metadata using Google's LevelDB database.
The way a blockchain is represented as a singly linked list. Each block has a hash of the previous block which can be thought of as a pointer to previous block.
Some differences are that in a linked list, there are generally more operations for a linked list that are not available in a blockchain, most notably being able to remove a block and to add a block in the middle of the list/chain.
In the bitcoin blockchain, and probably others, each transaction in the block is stored in a Merkle Tree. The blockchain is not a tree.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With