4

Here's my understanding of the execution flow of blockchain:

Consider two nodes, node1 and node2. Let's say there are 10 users on node1. They're making transactions, but none of these are actually carried out since no block is mined.

When a block IS finally mined, these unconfirmed transactions are put into the block and executed - and the block is added to node1's blockchain. Then, through the consensus protocol, node1's blockchain in "synced" with node2's blockchain so that they both carry the same copy.

My question is: how does this "syncing" take place? Do you just supply node2's blockchain with the blocks it doesn't currently have? Or do you pass node1's blockchain by reference like this: node_2_blockchain = node_1_blockchain?

1

Each node synchronize a copy of the chain data with it's peers using a peer-to-peer mechanism. The protocol is defined by the ÐΞVp2p Wire Protocol that indicates how data is shared between nodes. Blocks headers, block bodies, pending transactions are transferred separately (see for instance how sync is done in Geth, the Go ethereum client). Some are encoded in the RLP format.

In the end, the whole block data is transferred in a serialized form to the peer node. This is not a reference, otherwise we wouldn't have redundancy of the data in the network and if the original node fails, no one would have access to the data.

Each node have it's own local key/value database which type depend on the choices of each client software to store the whole data. Some of the non definitive or volatile data are only stored in memory databases or structures and written on disk only when fully settled.

1

Block synchronization is carried out by Ethereum Wrie Protocol:

https://github.com/ethereum/wiki/wiki/Ethereum-Wire-Protocol

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.