Please help me in understanding how transactions are getting verified and also how blocks are getting verified before appending it to the canonical chain.

  • How can we help you understand such a wide subject, when we have no idea which specific part in this subject you are having difficulties understanding??? Jan 27 '20 at 14:35

It is a very general question so I will give you a very general answer with a guess or two about some statements that will clear up points newcomers tend to struggle with. This is not to completely answer your question but to possibly put other material into perspective.

how transactions are getting verified

Ethereum is a protocol. The protocol includes a virtual machine specification, the Ethereum Virtual Machine (EVM). This machine, which is defined as protocol, processes instructions. Therefore, for every input there is a corresponding result and every correctly functioning node agrees on what must have happened.

Each node processes each transaction. Those transactions may be accepted and do something, or they may be rejected because they are invalid. Each node decides for itself about the correct thing to do. Since there is no subjectivity and the correct thing to do is always prescribed by a correct interpretation of the protocol, all correctly functioning nodes agree on the state (storage, account balances, contracts, etc.). At any block height, it is the only way it can be, given the inputs to that point.

It is of paramount importance that the nodes agree on the transaction order. Without agreement on the order of events, the nodes cannot be expected to reach identical states on their own.

how blocks are getting verified

Blocks of transactions are mainly concerned with disambiguating transaction order. Network latency ensures that nodes will hear about transactions in different orders. Temporal time is not a good way to determine the actual order because that would require reference to an external time source and/or node clocks which might be misrepresented in any case. Blocks of transactions in a chain establish a canonical order of events.

The miner that emits a block has considerable latitude about what to include and the order in which to include it. There are financial incentives to prioritize certain transactions but preferring the optimal financially-incentivized arrangement is not obligatory.

Miners have a particularly advantaged role, so the mining process works to minimize the importance of that advantage. It is limited to a time span of about 15 seconds (average) and it is made difficult and unpredictable to get that control by the proof-of-work system.

Every block, about every 15 seconds, a lucky miner solves a very work-heavy puzzle and "wins" the privilege of emitting a block. The block is verified by others similarly to an error-correction protocol - must include knowledge of the previous block, must include a solution to a very challenging puzzle, must be correctly formed, etc.

I am greatly simplifying the canonical chain process. Suffice it to say that there are systems to handle edge cases (and common cases) and a canonical chain emerges - all nodes will agree it is obviously the important version of history.

  • Each block is a well-ordered set of transactions.
  • The blockchain is a well-ordered set of blocks.
  • Ergo, the blockchain is a well-ordered set of transactions.
  • The EVM state, which is independently computed by all nodes, is the only way it can be given the inputs described in the chain and the operational specs of the EVM described in the protocol.

Hope it helps.

  • 1
    +200. This answer is state of the art. Should be placed on the excellence bulletin board here if there was any! Jan 27 '20 at 16:47
  • Thanks, man. :-) Jan 27 '20 at 16:52

For Ethereum 1.0 the consensus algorithm is Proof of Work, and you can imagine proof of work as: Someone (a node) gathers a certain amount of transactions that were broadcasted to be mined. This node performs a brute force (like a for loop) to find a number (nonce) that doing an operation with the rest of the transactions returns a certain value, e.g. hexadecimal that starts with 4 zeros (0x0000....).

The first node to find this nonce is able to mine the block.

My answer is just a brief and I would REALLY recommend you watch this video. I remember it helped me understand the answer to your question. If you want, go here and play with this Blockchain example, you will end up understanding why and how it works this way. I hope this helps.


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