>AgentChain

EVM Compatibility

AgentChain runs the Berlin version of the Ethereum Virtual Machine. This means all EVM features and opcodes up to and including the Berlin hard fork are available. Features introduced in London, Shanghai, Cancun, and later upgrades are not supported.

Berlin Fork Features

The Berlin hard fork (activated at block 0 on AgentChain) introduced two important EIPs:

EIP-2929: Gas Cost Increases for State Access Opcodes

EIP-2929 introduces the concept of "cold" and "warm" storage access. The first time a contract accesses an address or storage slot in a transaction, it is "cold" and costs more gas. Subsequent accesses to the same address or slot are "warm" and cost less.

| Operation | Cold Cost | Warm Cost | |-----------|-----------|-----------| | SLOAD | 2,100 gas | 100 gas | | CALL (to cold address) | 2,600 gas | 100 gas | | BALANCE | 2,600 gas | 100 gas | | EXTCODESIZE | 2,600 gas | 100 gas | | EXTCODECOPY | 2,600 gas | 100 gas | | EXTCODEHASH | 2,600 gas | 100 gas |

EIP-2930: Optional Access Lists

EIP-2930 introduces a new transaction type (type 0x01) that includes an access list — a set of addresses and storage keys that the transaction plans to access. Pre-declaring these accesses allows the cold-to-warm transition to happen before execution begins, providing a small gas discount.

{
  "type": "0x01",
  "chainId": "0x1ca3",
  "accessList": [
    {
      "address": "0xContractAddress...",
      "storageKeys": [
        "0x0000000000000000000000000000000000000000000000000000000000000001"
      ]
    }
  ]
}

Supported Opcodes

All opcodes available in the Berlin EVM are supported on AgentChain. This includes the complete set from earlier forks:

Arithmetic and Comparison

ADD, MUL, SUB, DIV, SDIV, MOD, SMOD, ADDMOD, MULMOD, EXP, SIGNEXTEND, LT, GT, SLT, SGT, EQ, ISZERO

Bitwise and Shift Operations

AND, OR, XOR, NOT, BYTE, SHL, SHR, SAR

Cryptographic

SHA3 (Keccak-256)

Environmental Information

ADDRESS, BALANCE, ORIGIN, CALLER, CALLVALUE, CALLDATALOAD, CALLDATASIZE, CALLDATACOPY, CODESIZE, CODECOPY, GASPRICE, EXTCODESIZE, EXTCODECOPY, RETURNDATASIZE, RETURNDATACOPY, EXTCODEHASH, CHAINID, SELFBALANCE

Block Information

BLOCKHASH, COINBASE, TIMESTAMP, NUMBER, DIFFICULTY, GASLIMIT

Stack, Memory, and Storage

POP, MLOAD, MSTORE, MSTORE8, SLOAD, SSTORE, JUMP, JUMPI, PC, MSIZE, GAS, JUMPDEST, PUSH1-PUSH32, DUP1-DUP16, SWAP1-SWAP16

Logging

LOG0, LOG1, LOG2, LOG3, LOG4

System Operations

CREATE, CALL, CALLCODE, RETURN, DELEGATECALL, CREATE2, STATICCALL, REVERT, INVALID, SELFDESTRUCT

Unsupported Opcodes

The following opcodes are not available on AgentChain because they were introduced after the Berlin fork:

| Opcode | EIP | Fork | Description | |--------|-----|------|-------------| | BASEFEE | EIP-3198 | London | Returns the current block's base fee. Not applicable — AgentChain has no EIP-1559 base fee. | | PUSH0 | EIP-3855 | Shanghai | Pushes the value 0 onto the stack. Use PUSH1 0x00 as a workaround. | | TSTORE | EIP-1153 | Cancun | Transient storage write. Not available. | | TLOAD | EIP-1153 | Cancun | Transient storage read. Not available. | | MCOPY | EIP-5656 | Cancun | Memory copy. Not available. | | BLOBHASH | EIP-4844 | Cancun | Blob versioned hash. Not applicable. | | BLOBBASEFEE | EIP-7516 | Cancun | Blob base fee. Not applicable. |

Impact on Solidity Code

Contracts that use block.basefee will fail to compile for Berlin. Contracts using transient storage (Solidity's upcoming transient keyword) will not work. The PUSH0 opcode is a compiler optimization — using an older Solidity version or setting evmVersion: "berlin" avoids it automatically.

No EIP-1559

AgentChain does not implement EIP-1559. This means:

  • No base fee. There is no dynamically adjusted minimum gas price.
  • No fee burning. All gas fees go to the miner.
  • No priority fee (tip). The gas price is the total price — there is no separation between base fee and tip.
  • No type-2 transactions. EIP-1559 transaction format (maxFeePerGas, maxPriorityFeePerGas) is not supported.
  • The BASEFEE opcode is unavailable. Contracts or libraries that read block.basefee will revert.

Transaction types supported:

  • Type 0 (Legacy): Standard {to, value, gasPrice, gasLimit, data, nonce} transactions.
  • Type 1 (EIP-2930): Legacy transactions with an appended access list.

Precompiled Contracts

AgentChain includes all precompiled contracts available in the Berlin EVM:

| Address | Name | Description | Gas Cost | |---------|------|-------------|----------| | 0x01 | ecRecover | ECDSA public key recovery from signature | 3,000 | | 0x02 | SHA-256 | SHA-256 hash function | 60 + 12 per word | | 0x03 | RIPEMD-160 | RIPEMD-160 hash function | 600 + 120 per word | | 0x04 | Identity | Returns input data unchanged (memory copy) | 15 + 3 per word | | 0x05 | ModExp | Modular exponentiation (big integer) | Variable (EIP-2565) | | 0x06 | ecAdd | BN256 elliptic curve point addition | 150 | | 0x07 | ecMul | BN256 elliptic curve scalar multiplication | 6,000 | | 0x08 | ecPairing | BN256 elliptic curve pairing check | 45,000 + 34,000 per pair | | 0x09 | Blake2f | BLAKE2b compression function (EIP-152) | Variable (rounds-based) |

These precompiles are essential for cryptographic operations in smart contracts, including signature verification, zero-knowledge proofs, and hash-based commitments.

Solidity Compiler Configuration

To compile contracts for AgentChain, use Solidity version 0.8.19 or earlier with the evmVersion set to "berlin".

Why 0.8.19

Solidity 0.8.20 and later default to the Shanghai EVM, which emits PUSH0 instructions. While you can override the EVM version, using 0.8.19 ensures no accidental use of unsupported features.

Compiler Settings

{
  "language": "Solidity",
  "settings": {
    "evmVersion": "berlin",
    "optimizer": {
      "enabled": true,
      "runs": 200
    }
  }
}

Developer Tooling Configuration

Hardhat

module.exports = {
  solidity: {
    version: "0.8.19",
    settings: {
      evmVersion: "berlin",
      optimizer: { enabled: true, runs: 200 }
    }
  },
  networks: {
    agentchain: {
      url: "http://localhost:8545",
      chainId: 7331,
      gasPrice: 1000000000 // 1 gwei, adjust as needed
    }
  }
};

Foundry (foundry.toml)

[profile.default]
solc_version = "0.8.19"
evm_version = "berlin"
optimizer = true
optimizer_runs = 200
 
[rpc_endpoints]
agentchain = "http://localhost:8545"

Remix IDE

When using Remix to deploy to AgentChain:

  1. Set the compiler version to 0.8.19.
  2. Under Advanced Configurations, set the EVM Version to berlin.
  3. Connect to AgentChain using Injected Provider (MetaMask) or External HTTP Provider with your node's RPC URL.

Truffle

module.exports = {
  compilers: {
    solc: {
      version: "0.8.19",
      settings: {
        evmVersion: "berlin",
        optimizer: { enabled: true, runs: 200 }
      }
    }
  },
  networks: {
    agentchain: {
      host: "localhost",
      port: 8545,
      network_id: 7331
    }
  }
};

Contract Size Limit

The maximum contract bytecode size is 24,576 bytes (24 KB), as specified in EIP-170. This limit applies to the deployed bytecode, not the creation bytecode.

If your contract approaches this limit, consider:

  • Splitting into multiple contracts with clearly defined interfaces.
  • Using libraries (library keyword) to extract reusable logic.
  • Proxy patterns (EIP-1967) for upgradeable contracts with separated logic.
  • Enabling the optimizer with a higher runs value to reduce bytecode size at the cost of slightly higher deployment gas.

Compatibility Checklist

Before deploying a contract to AgentChain, verify:

  • [ ] Solidity version is 0.8.19 or earlier.
  • [ ] evmVersion is set to "berlin" in compiler settings.
  • [ ] No use of block.basefee in contract code.
  • [ ] No reliance on PUSH0 (automatic if using correct compiler settings).
  • [ ] No use of transient storage (TSTORE/TLOAD).
  • [ ] No EIP-1559 transaction types in deployment scripts.
  • [ ] Contract size is under 24,576 bytes.
  • [ ] Chain ID 7331 is configured in deployment tooling.
  • [ ] All imported libraries and dependencies are also Berlin-compatible.