Can anybody explain this, please?
2 Answers
From the definition of Blockchain it is a distributed ledger. So smart contracts are also a part of the distributed ledger (in Ethereum context) and hence stored in every node of the network. Every time you change the state of the contract (if a state variable changed via a contract's function call), such instructions get executed in every node and new state stored in every node.
-
So every transaction runs in every node at same time Correct? Commented Dec 18, 2017 at 13:30
-
Not at the same time as nodes are distributed, but eventually all transactions get executed in every full node.– ChimCommented Dec 18, 2017 at 13:33
On Ethereum, whenever a smart contract is executed, the network comprising thousands of mining computers will process it.
Smart contracts written in a specific programming language, like Solidity, are compiled into 'bytecode' that will be executed by the 'Ethereum Virtual Machine' or EVM. This EVM can read and execute the smart contracts.
All nodes execute contracts using their own EVMs.
The EVM will execute a smart contract with whatever rules that you or the developers have programmed. The computation on the EVM is achieved through a stack-based 'bytecode' language.
-
Suppose I have an ethereum wallet, does it mean, I have an EVM integrated with the wallet? Commented Dec 18, 2017 at 13:32
-
If your running geth or Mist Wallet then from looking at the code on github , yes: github.com/ethereum/go-ethereum/blob/master/core/evm.go– LismoreCommented Dec 18, 2017 at 14:38
-
and up a folder ../vm you will find github.com/ethereum/go-ethereum/blob/master/core/vm/evm.go– LismoreCommented Dec 18, 2017 at 14:39