5

This question might be dumb, I'm sorry in advance. I only had that much time for gaining expertize.

Say there is a huge working blockchain full of smart contracts and transactions on those smart contracts.

As far as I understand, all the nodes must execute all those smart contracts and all the transactions that change state of those contracts.

Then there is a new node joining this old blockchain. In order to have a correct state of all the contracts it should download the entire blockchain and then execute all the transactions related to smart contracts?

Is this vision correct, where do I miss something? Thanks!

5
  • 2
    Yes. This is correct! Your subject is more accurate: all transactions (not just the smart contracts) need to be verified by executing them to get the blockchain to the correct state (i.e., a state for which there is consensus).
    – lungj
    Sep 12 '17 at 16:39
  • Thanks! So, just to confirm. Once a new node is started on the network, it first downloads the entire blockchain (30GB of data if this is a public Ethereum blockchain) and then executes each and every contract downloaded. Only after that you can focus on mining new transactions. Correct?
    – ITisha
    Sep 13 '17 at 10:21
  • That's right; or you can mine to a pool (who keeps a copy of the blockchain synced) and have reduced variance. The cost is about 3-10% inefficiency (depending on your latency and some other factors) + the pool fee (1-2%?), assuming the pool has 100% uptime and is properly managed.
    – lungj
    Sep 14 '17 at 1:57
  • Do you have a source for your claims?
    – Cristian
    Sep 16 '17 at 0:32
  • How long do these transactions take to execute. It seems like if you were to execute every transaction that exists on the blockchain on a fresh node, it would take a really long time to do so before the new node can start the process of adding new blocks to the blockchain.
    – grenmester
    Jun 24 at 14:19
2

As far as I understand, all the nodes must execute all those smart contracts and all the transactions that change state of those contracts.

Yup that's right.

There is a slight nuance - executions on a blockchain only occur once. A full node will perform a block verification that the state of the chain is correct based on those executions - its more of a replay/simulation than a rerun. It is that verification that partly keeps the blockchain secure as more nodes verify the state and only keep the blocks that conform to the protocol rules (longest chain wins).

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.