do smart contracts execute sequentially in each node or in parallel/simulteneously? across all nodes?
2nd question is - Does it execute on "ALL" nodes including Light nodes as well?
do smart contracts execute sequentially in each node or in parallel/simulteneously? across all nodes?
2nd question is - Does it execute on "ALL" nodes including Light nodes as well?
1) Sequentially.
According to the order defined by the miner. Miners prefer to process transactions with higher fees first.
Once the block is mined, this order says forever. This order is called transaction index , or Position if you check it at Etherescan. Just note that Etherscan erroneously shows transactions in inverted order, the real order is backwards.
2) It executes on ALL nodes, but Light nodes do not process transactions.
This how the flow of transaction would go
Coming back to your question, Each node will be trying to update its state to keep up with the growing chain as they need to be updated to earn the valid rewards through mining. So each node will be executing these transactions parallely but the order in which the state changes is determined by the transaction order which is executed sequentially inorder have same state information across all the nodes.
No all nodes don't execute the transactions only full nodes need to execute these transactions as light nodes only need block header.