Storing transaction data on the blockchain. How?

Gepubliceerd op 27 augustus 2021 om 18:07

In this article, I will talk about the technique of storing a transaction/data on the blockchain. How does this technique work and how does a 'blockchain' ultimately materialise? I will also discuss how a new block is created when a new transaction takes place and what happens when a transaction is manipulated in the blockchain.


After a transaction is performed, data must be stored on the blockchain. If more transactions take place on the blockchain, a series of 'blocks' is created which are linked together by means of a chain. Each block refers to the previous block. The very first block (or transaction) in the blockchain is also called the 'genesis block'. If more and more transactions take place on the blockchain, more and more blocks will be created. The next block (B1) is connected to the genesis block and the second block (B2) is connected to B1 etc.

To explain this concept, the example of a book is used. A book stores information. This information is stored on a page. A book is also organised. The sentences and chapters are included in an organised way. Finally, the pages containing information are physically linked by means of a cover. The pages are also linked in a logical way.

Below you will find a simplified representation of two pages. One page contains page number 41 and the word ''Hoi''. The next page is page 42 with the word ''weekend''. If I am reading page 42, the previous page must have the number 41. If so, then I know that no one has tinkered with the book. If page 41 is not there, then alarm bells are ringing and I know that the book has been tampered with.

To make sure that you don't have to check every time that the previous page (or more pages back) is correct, you can explicitly specify that the previous page is 41. This way you don't have to check every time that the previous page was 41. By explicitly referring (and linking) to the previous page, you know that the previous page is 41.

Because it takes a lot of space and energy to fill pages, we replace the words Hi and weekend with a reference number where those words can be found. The pages no longer contain the information, but a reference number that refers to that information. A catalogue has been created.

We then change the page numbers into a series of letters and numbers (hash value). Below you can see that the next page (or block) refers to the previous block. Can you create the third block? Then this is not so difficult from a conceptual point of view. The third block has a page reference (page), this block refers to the previous block (previous page) with number 8118E736 and a reference number for the information verified on that third block.

If the previous concept is applied to the blockchain, it will look like this:

If we only have block header 1 and we want to add another transaction on the blockchain, how does that work in the blockchain? First, we see the first transaction (Block header 1). This contains two transactions (transaction 1 and 2). Transaction 1 and 2 are converted into a hash value (R1 and R2). R1 and R2 are then converted together into a hash value (R12). Hash value R12 is also called the 'Merkle root' which ultimately refers to transactions 1 and 2. Hash value R12 is then stored in a block header. The block header also contains other crucial information, but I won't go into that in detail.

Suppose that transaction 3 and 4 take place and have to be included on the blockchain. The steps are the same as transactions 1 and 2 (block header 1). Transactions 3 and 4 are converted into a hash value (R3 and R4). Next, R3 and R4 are converted together into a hash value (R34), also called the Merkle root. R34 is then stored in the block header. Because the next block (page in a book) must refer to the previous block (previous page in a book), block header 2 refers to block 1 with a certain hash value (B1). Block 1 is converted into a hash value B1 which then ends up in the block header 2. This explicitly refers to block 1.

If new transactions subsequently occur, the third block header (third page) will refer to block header 2 (B2 in the block header 3). In the third block (block header 3) there is also another Merkle root (R56) which ultimately refers to transactions 5 and 6. This creates a 'blockchain'. A chain of 'blocks' in which information is stored and always refers to the previous block.

For example, if you try to manipulate transaction 2, the hash values are no longer correct (R2, R12, B1, block header 2 etc.). This eventually works throughout the entire blockchain. And because it can be seen that the hash values are not correct, it can be concluded that someone has tried to manipulate the blockchain. The consequence is that the entire data structure is invalid because everything is linked to each other. If a piece of data changes, then the whole data structure also changes.

The concept of 'blockchain' has arisen because with every transaction a new block is linked to the previous block. The block contains the transactions that belong to that one block and refers to the previous block. In this way, information/data is stored efficiently and securely. In combination with the 'digital signature' and the 'hashing technique', the blockchain is a secure technology for storing and sending data/transactions.

I published this article previously on my LinkedIn page. This article was written on July 26 2020.

BTC address: bc1q3nnm8m2vrsv8med8a38dl37g8l3mm4wa7ph7wj 

ETH address: 0x38b84E2D3B50F83A067A7488C1733180651f418A

Reactie plaatsen

Reacties

Er zijn geen reacties geplaatst.