EIPs Explained

EIP-1679 · Final · Meta · 2019-01-04

EIP-1679: Hardfork Meta: Istanbul

The meta-EIP listing the six changes in the Istanbul hard fork (December 2019), which repriced gas for several operations and added the CHAINID opcode and a BLAKE2 precompile.

What problem does it solve?

A network upgrade is a bundle of independent EIPs that must activate together at a specific block. A hard-fork meta-EIP is the single reference that says which proposals are in the bundle and when it switches on, so client teams, node operators and tooling all agree.

EIP-1679 is that document for Istanbul, the upgrade after Constantinople/Petersburg.

How it works

Istanbul activated at block 9,069,000 on Ethereum mainnet. It included:

EIP Change
EIP-152 Precompile for the BLAKE2b compression function F, enabling interoperability with chains such as Zcash
EIP-1108 Cheaper alt_bn128 (BN254) precompiles, lowering zk-SNARK verification costs
EIP-1344 CHAINID opcode, letting contracts read the chain id (useful for replay-safe signatures)
EIP-1884 Repricing of trie-size-dependent opcodes (SLOAD, BALANCE, EXTCODEHASH) and new SELFBALANCE opcode
EIP-2028 Non-zero calldata byte cost cut from 68 to 16 gas
EIP-2200 Net gas metering for SSTORE, accounting for the new SLOAD cost

The spec also lists activation blocks for the testnets of the time (Ropsten, Kovan, Rinkeby, Görli), all of which are now deprecated.

Sample code

Two Istanbul features from Solidity: block.chainid (compiles to CHAINID) and address(this).balance (compiles to SELFBALANCE):

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract IstanbulFeatures {
    function chainId() external view returns (uint256) {
        return block.chainid;          // EIP-1344
    }

    function myBalance() external view returns (uint256) {
        return address(this).balance;  // EIP-1884 SELFBALANCE
    }
}

A client fork config entry, illustrative:

{ "istanbulBlock": 9069000 }

Things to know

  • Status: Final.
  • EIP-1884 raised SLOAD to 800 gas, which broke some contracts that forwarded only the 2300-gas stipend to fallbacks reading storage. This is one reason transfer/send with fixed gas is discouraged.
  • EIP-2028's cheaper calldata was important for rollups, which post their data as calldata.
  • The next upgrade, Muir Glacier, only delayed the difficulty bomb.

#hardfork #istanbul #meta #gas

Details

Authors
Alex Beregszaszi (@axic), Afri Schoedon (@5chdn)
Status
Final
Type
Meta
Created
2019-01-04
Requires
Required by

Machine-readable: Markdown · JSON