A smart contract is deployed on all Ethereum networks, at a pre-determined address, with the code that simply reads the slot in its storage specified by the only parameter. Later, this contract becomes "special" in that Ethereum start writing state counters (number of total transactions, number of accounts, etc.) into that contract.
This is part of the State Rent roadmap. This particular change introduces a place in the Ethereum state where various state counters can be stored. At this point, the most important counter is the total number of transactions happened, and this counter will be used to populate the nonces of newly created non-contract accounts. This way of populating nonce ensures replay protection for accounts that were evicted and then brought back by sending ether to them.
Ethereum currently does not have a special place in the state for tracking state counters such as number of transactions or number of accounts.
Prior to the block A, a contract is deployed with the following code:
0x60 0x20 0x60 0x00 0x80 0x80 0x35 0x54 0x90 0x52 0xF3, which corresponds to this assembly:
PUSH1 32 PUSH1 0 DUP1 DUP1 CALLDATALOAD SLOAD SWAP1 MSTORE RETURN
Call to this contract accepts one 32-byte argument, x, and returns the value of the storage item [x].
This contract is deployed using CREATE2 opcode in such a way that it has the same address on any network.
Two alternative solutions were considered so far:
This change is backwards compatible and does not require hard fork to be activated.
Tests cases will be created to ensure that the state counter contract returns its storage items correctly.
Implementation is envisaged as a transaction that can be posted from any Ethereum address and will cause the deployment of the state counter contract.
Copyright and related rights waived via CC0.