EVM
The Ethereum Virtual Machine (EVM) functions as a world computer that powers decentralized applications (dApps) running on the Ethereum blockchain.
Every smart contract execution triggers a change to the EVM's state, aka a state transition.
- Contract bytecode (compiled from the source code) is loaded from the EVM's storage and executed by peer-to-peer nodes on the EVM. Nodes use the same transaction inputs, which guarantees that each node arrives at the same result (or else they cannot reach consensus).
- EVM Opcodes (contained in the bytecode) interact with different parts of the EVM’s state (memory, storage, and stack). Opcodes perform read-write operations—reading (getting) values from state storage and writing (sending) new values to the EVM’s storage.
- EVM opcodes perform computation on the values obtained from state storage before returning the new values. This update results in the EVM transitioning to a new state (transactions are called “state transitions” for this reason). This new state is replicated by other nodes and remains until another transaction is executed.
Opcodes & Gas Costs
Chain ID
chainID chain identifier, was introduced in EIP-155 to prevent replay attacks.
Denominations
Always need to use whole numbers.
Denominations | Value |
---|---|
Wei | 1000000000000000000 |
Gwei | 1000000000 |
Ether | 1 |
Gas
The cost of running a smart contract.
Time x Computing.
tip
Need to engineer Smart Contracts for optimal efficiency to save gas.
Accounts
Get 10 by default with seed phrase.
tip
When you restore from a Seed Phase the account names are not persisted