Linea

Linea is an Ethereum Layer 2 zkEVM developed by Consensys, the team behind MetaMask and Infura. It executes standard EVM bytecode natively, uses ETH for gas, and settles security to Ethereum Layer 1 through zero-knowledge validity proofs. As a Type 2, EVM-equivalent zkEVM, Linea runs existing Ethereum contracts and tooling — Hardhat, Foundry, ethers.js, viem, and web3.py — without modification.

Because Linea settles proofs to Ethereum, it inherits Ethereum's security while offering lower fees and faster soft finality than Layer 1. This documentation targets Linea Mainnet (Chain ID 59144) and covers the standard Ethereum JSON-RPC method set plus Linea-specific extensions such as linea_estimateGas and linea_getProof.

Key Features

  • Full EVM Equivalence (Type 2 zkEVM): Runs standard EVM bytecode; deploy Solidity contracts and use Hardhat, Foundry, ethers.js, viem, and web3.py without modification
  • Zero-Knowledge Validity Proofs: State is proven to Ethereum L1 with zk proofs rather than fraud proofs, avoiding optimistic challenge windows
  • Ethereum Security: Settles to Ethereum L1 and inherits its security guarantees
  • ETH for Gas: Transaction fees are paid in ETH, the same asset as Ethereum mainnet
  • Consensys Ecosystem: First-class integration with MetaMask and Infura tooling
  • Linea Gas Extensions: linea_estimateGas returns an L1-cost-aware gas price for accurate fee estimation
  • State Proof Extension: linea_getProof returns Sparse Merkle Trie proofs for verifying Linea state on L1
  • Ethereum Upgrade Parity: Tracks Ethereum network upgrades to keep EVM behavior current

TECHNICAL DISCLAIMER: AUTHORITATIVE JSON-RPC SPECIFICATION

GetBlock's Linea API reference documentation is provided exclusively for informational purposes and to optimize the developer experience. The canonical and normative specification for the Ethereum JSON-RPC API is maintained by the Ethereum community and published at ethereum.org/en/developers/docs/apis/json-rpc/. For Linea-specific methods and protocol details, consult the official documentation at docs.linea.build.

Network Information

PropertyValue
Network NameLinea Mainnet
StageMainnet (live)
Chain ID59144 (0xe708)
Native CurrencyETH
Decimals18
LayerLayer 2 (zkEVM rollup on Ethereum)
ConsensusZero-knowledge validity proofs settled to Ethereum
Smart Contract VMEVM (Type 2, EVM-equivalent)
Address FormatEthereum-style (0x…, 20 bytes)
Block Explorerlineascan.build
TestnetLinea Sepolia (Chain ID 59141)

Base URL

bashhttps://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/

All Linea JSON-RPC methods are called by sending a POST request to the base URL with a standard JSON-RPC 2.0 body. For a WebSocket connection, use the WebSocket scheme: wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/.

Supported Networks

NetworkJSON-RPCWSSGraph QLFrankfurt, Germany
Mainnet✅✅✅✅
Sepolia✅✅✅✅

Linea Sepolia (Chain ID 59141) is the test environment for staging contracts before mainnet. Confirm testnet endpoint availability from the GetBlock dashboard.

Quickstart

In this section, you will learn how to make your first call with either:

  • Axios (JavaScript / Node.js)
  • Python (Requests library)

Before you begin, you must have already installed npm or yarn on your local machine (for the Axios example) or Python and pip (for the Python example).

  1. Setup project

    Create and initialize a new project:

    bashmkdir linea-api-quickstart
    cd linea-api-quickstart
    npm init --yes
  2. Install Axios

    bashnpm install axios
  3. Create file

    Create a new file named index.js. This is where you will make your first call.

  4. Set ES module type

    Set the ES module "type": "module" in your package.json.

  5. Add code

    Add the following code to index.js:

    index.js

    javascriptimport axios from 'axios';
    
    const data = JSON.stringify({
        "jsonrpc": "2.0",
        "method": "eth_chainId",
        "params": [],
        "id": "getblock.io"
    });
    
    const config = {
        method: 'post',
        url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
        headers: {
            'Content-Type': 'application/json'
        },
        data: data
    };
    
    axios(config)
        .then(response => console.log(JSON.stringify(response.data, null, 2)))
        .catch(error => console.log(error));

    Replace <ACCESS-TOKEN> with your actual access token from GetBlock.

  6. Run the script

    bashnode index.js

    Expected output:

    json{
        "jsonrpc": "2.0",
        "id": "getblock.io",
        "result": "0xe708"
    }

    The result field is the Linea Mainnet chain ID (0xe708 = 59144 in decimal). This confirms you are connected to the correct network.

  1. Setup the project directory

    bashmkdir linea-api-quickstart
    cd linea-api-quickstart
  2. Create and activate a virtual environment

    bashpython -m venv venv
    source venv/bin/activate
    
    # On Windows, use venv\Scripts\activate
  3. Install requests

    bashpip install requests
  4. Create script

    Create a file called main.py with the following content:

    main.py

    pythonimport requests
    import json
    
    url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"
    
    payload = json.dumps({
        "jsonrpc": "2.0",
        "method": "eth_chainId",
        "params": [],
        "id": "getblock.io"
    })
    
    headers = {
        'Content-Type': 'application/json'
    }
    
    response = requests.post(url, headers=headers, data=payload)
    print(response.text)

    Replace <ACCESS-TOKEN> with your actual access token from GetBlock.

  5. Run the script

    bashpython main.py

Available API Methods

Linea exposes the standard Ethereum JSON-RPC method set plus Linea-specific extensions. All methods are POST-only and called against the base URL above.

Block & Chain Information

MethodDescription
eth_blockNumberReturns the current latest block number
eth_chainIdReturns the chain ID (0xe708 = 59144 for Linea Mainnet)
eth_getBlockByNumberReturns block information by block number
eth_getBlockByHashReturns block information by block hash
eth_getBlockTransactionCountByNumberReturns the number of transactions in a block by block number
eth_getBlockTransactionCountByHashReturns the number of transactions in a block by block hash
eth_getBlockReceiptsReturns all transaction receipts for a given block
eth_syncingReturns sync status or false if the node is fully synced

Account & State

MethodDescription
eth_getBalanceReturns the native ETH balance of an account (in wei)
eth_getCodeReturns the contract bytecode at a given address
eth_getStorageAtReturns the value at a specific storage slot
eth_getTransactionCountReturns the transaction count (nonce) for an account

Transactions

MethodDescription
eth_sendRawTransactionBroadcasts a signed transaction
eth_getTransactionByHashReturns a transaction by its hash
eth_getTransactionByBlockHashAndIndexReturns a transaction by block hash and index
eth_getTransactionByBlockNumberAndIndexReturns a transaction by block number and index
eth_getTransactionReceiptReturns the receipt for a transaction by hash
eth_callExecutes a read-only call against contract state
eth_estimateGasEstimates gas required for a transaction

Gas & Fee Market

MethodDescription
eth_gasPriceReturns the current gas price in wei
eth_maxPriorityFeePerGasReturns the suggested max priority fee per gas (EIP-1559)
eth_feeHistoryReturns historical base fees and priority fees
linea_estimateGasReturns an L1-cost-aware gas estimate (gasLimit, base, tip)

Logs

MethodDescription
eth_getLogsReturns logs matching a given filter

Debug & Trace

MethodDescription
debug_traceTransactionReplays a transaction and returns an execution trace
debug_traceBlockByNumberTraces every transaction in a block by block number
debug_traceBlockByHashTraces every transaction in a block by block hash

Network & Client Info

MethodDescription
net_versionReturns the network ID (59144 for Linea Mainnet)
web3_clientVersionReturns the client software version

Support

For technical support and questions:

See Also