1

How does smart contract processing work exactly in ETH? Specifically I'm wondering about what happens after a node has processed a set of smart contracts.

  1. A node grabs a bunch of contracts & transactions, processes contracts and validates transactions, solve s PoW.

  2. Here's the question: what gets packed into the block for the smart contracts? For example, if I had a smart contract that basically had a counter inside, and a call to the function just increments the counter by 1. When the node processes this call, what is it packing into the block? Is it packing the call? The bytecode of the execution process (state transition)? Is it packing in the actual result (the resultant persistent storage of the contract) - i.e., counter = 2?

  3. If the result is packed into the block, do other nodes actually care about the actual result that someone else has packed into a block? Or do they just say "since I trust no one I'm just gonna process it anyway, who cares what result you got, since I don't trust you"? This is why people say eventually every full node processes every smart contract call?

Hopefully my question is clear, thank you!

1

It's a little bit of both.

One might say the primary concern is disambiguating the transactions that are part of a given block and the order in which those transactions are to be processed.

The blocks include transaction inputs which leads to an implicit state. The local storage of the state is client-side concern outside the protocol itself. Have a look at Malone's answer here, Ethereum Merkle Tree Explanation .

Notice the "State Root" in the block itself. This supports a computationally efficient process nodes can use to confirm agreement about the entire state nodes they computed independently at any given block time. In other words, a node can confirm its agreement with every detail of the state at any point in time.

Hope it helps.

  • Hmm I'm still unclear what the "state root" actually is, but it seems clear that no actual results are passed around, only the calls (transitions). Thanks man! – reedvoid Mar 30 '18 at 2:11
  • It's the hash of two hashes, which themselves are the hash of hashes, all the way to the bottom where the "state" lives in the leaves. If this is actually stored or not is a client-side concern. – Rob Hitchens - B9lab Mar 30 '18 at 2:15

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.