Where does Ethereum store the contract logic

VijayeeKulkaaVijayeeKulkaa Member Posts: 1
Where does Ethereum store the contract logic? Is it on its own blockchain? How large does this grow and what is the scalability of contract storage?


  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    The contract itself can have 2^256 key value pairs as part of its storage, which might as well mean 'unlimited'. All contract storage is stored on the blockchain.

    There is no (hard) limit on the Ethereum maximum block size in MB, so parallels with Bitcoin cannot be drawn. A limit is however found in the form of the max gas per 12s block, which for Frontier is currently set at 1M gas.

    Each contract call expends a variable amount of gas based on the function's complexity - some will expend 1,000 gas or less, and others will require considerably more. Once the block hits its gas limit, subsequent transactions and calls to contracts are deferred to the next block. Note that contracts ultimately are made of 'Opcodes' which have various gas fees based on how much impact they have on the network - you can find the full list here

    Over time, if the network experiences load, the gas limit will go up, at (currently) 1.2x of the exponential moving average from the last 30k blocks. There is likely a bottleneck by which 'full archive' nodes will become fewer due to excessive HDD or CPU stress (HDD likely IMHO), and where 'light' clients will become more numerous. Time will tell, and it's likely new scaling solutions will be out by then (hypercube or multichain).
Sign In or Register to comment.