3 ms·
Indeed, this is exactly how Ethereum nodes validate new blocks: each block contains a transcript of the functions that were applied to an existing merkle tree,
by derefr 9y ago
Indeed, this is exactly how Ethereum nodes validate new blocks: each block contains a transcript of the functions that were applied to an existing merkle tree, and the root hash of the new merkle tree that was derived.
To accepting a newly-announced block as valid, a node just runs the code in the transcript against their existing merkle tree, which generates a new merkle tree (i.e. a new root hash.) Compare to the root hash in the new block. If it matches: computationally-valid block.
(Because this is happening in a blockchain, you still need to do things with hashes and nonces to determine if it's a PoW-valid block; and do things with block-sizes and heights and uncles to determine if it's the consensus-best-tip block. But in this case, the point of both of those is just to determine who has the authority to attempt to announce computationally-valid blocks, so you can kind of think of all the PoW/consensus stuff as an opaque abstraction, like a lower OSI networking layer.)
Now, with blockchains generally, you'd usually verify every block "from the beginning" as you download them, so although it's true that you can avoid downloading any merkle-tree branches whose content isn't referenced in the current function call, you'll usually end up building a complete merkle-tree locally anyway, since you're replaying every function call from the beginning (i.e. from an empty merkle-tree state.)
Ethereum clients have "fast" or "warp" synchronization modes, though—where the client downloads trusted snapshots of large segments of the blockchain, without computational-validity-verifying those parts. You end up, after "catching up", downloading your first "regular" block and trying to determine its validity... and then realizing you need to recursively request the complete merkle tree from your peers in order to check that block. Ethereum clients could really take advantage of the property from the article to download fewer merkle-tree nodes here! (They don't, though.)