Linea RPC Guide: How to Connect and Build on Linea (2026)
Linea is ConsenSys’s ZK rollup on Ethereum. It uses zero-knowledge proofs to verify transaction batches on-chain, inheriting Ethereum’s security while processing transactions at lower cost and higher throughput. For developers, Linea is notable for two things: full EVM equivalence and native MetaMask integration out of the box.
To interact with Linea programmatically, reading contract state, submitting transactions, subscribing to events, your application connects through a JSON-RPC endpoint. This guide covers how Linea RPC works, which methods matter, how to connect with ethers.js or Web3.py, what to watch for in production, plus how to pick a provider.
What is a Linea RPC Endpoint
A Linea RPC endpoint is an HTTP or WebSocket URL that exposes the Linea JSON-RPC API. Your application sends method calls to this URL and receives on-chain data in return.
HTTP endpoints handle request-response interactions: reading balances, calling contracts, sending transactions, querying logs. Each call is independent.
WebSocket endpoints maintain a persistent connection and support event subscriptions. Use WSS when your application needs real-time updates without polling, for example watching for new blocks or contract events in a wallet dashboard or DeFi frontend.
Linea Mainnet uses chain ID 59144. Linea Sepolia (testnet) uses chain ID 59141.
Linea Architecture
Linea is a type 2 ZK-EVM: it achieves full EVM equivalence at the bytecode level. This means Solidity contracts compile to the same bytecode as on Ethereum mainnet. No source code modifications, no compiler flags, no compatibility shims. Any contract that runs on Ethereum runs on Linea unchanged.
Architecturally, Linea works as follows:
- Users submit transactions to the Linea sequencer via an RPC endpoint.
- The sequencer orders transactions, executes them, then produces a state diff.
- A ZK prover generates a validity proof covering the batch.
- The proof is submitted to Ethereum L1 for verification.
- Once verified on L1, the batch reaches cryptographic finality.
The sequencer provides near-instant soft confirmation (under 2 seconds). ZK proof finality on Ethereum takes roughly 1 to 2 hours. For most application interactions, sequencer confirmation is sufficient. For cross-chain bridges or high-value operations, wait for L1 proof verification.
ConsenSys built Linea as a direct extension of its developer ecosystem: MetaMask, Infura, Truffle. Linea is available in the MetaMask network selector by default, giving it immediate wallet coverage across the MetaMask user base.
Example Linea RPC Methods
Because Linea is a type 2 ZK-EVM with full EVM equivalence, every standard Ethereum JSON-RPC method works identically on Linea. There is no method translation layer and no compatibility list to consult.
Standard Ethereum Methods
These work on Linea without modification:
| Method | Use Case |
|---|---|
eth_call | Read contract state (price feeds, balances, positions) |
eth_blockNumber | Track current Linea block height |
eth_getLogs | Query events from contracts |
eth_getTransactionReceipt | Confirm transaction execution |
eth_getBalance | Query ETH balances |
eth_estimateGas | Estimate gas for a transaction |
eth_sendRawTransaction | Submit signed transactions |
eth_subscribe | Real-time event subscriptions (WSS only) |
eth_getLogs on Linea
Linea produces a new block approximately every 2 seconds. Over 24 hours that is around 43,200 blocks. Log queries with wide block ranges generate large response payloads and can time out or hit provider limits.
Use chunked queries for wide time windows:
async function getLineaLogsInChunks(provider, filter, chunkSize = 2000) {
const logs = [];
let fromBlock = filter.fromBlock;
const toBlock = filter.toBlock === 'latest'
? await provider.getBlockNumber()
: filter.toBlock;
while (fromBlock <= toBlock) {
const chunkEnd = Math.min(fromBlock + chunkSize - 1, toBlock);
const chunk = await provider.getLogs({
...filter,
fromBlock,
toBlock: chunkEnd
});
logs.push(...chunk);
fromBlock = chunkEnd + 1;
}
return logs;
}
eth_subscribe (WebSocket)
For real-time applications, WebSocket subscriptions are more efficient than polling on a 2-second block chain. A polling loop checking every block generates 43,200 calls per day from eth_blockNumber alone.
import { ethers } from 'ethers';
const wsProvider = new ethers.WebSocketProvider(
'wss://eu.endpoints.matrixed.link/ws/linea?auth=YOUR_KEY'
);
wsProvider.on('block', (blockNumber) => {
console.log('New Linea block:', blockNumber);
});
const contract = new ethers.Contract(contractAddress, abi, wsProvider);
contract.on('Transfer', (from, to, amount) => {
console.log('Transfer:', from, to, ethers.formatEther(amount));
});
Public Linea RPC Endpoints
These free endpoints are suitable for testing and development. For production workloads they are rate-limited.
| Provider | HTTP Endpoint | Chain ID |
|---|---|---|
| Linea (official) | https://rpc.linea.build | 59144 |
| Infura | https://linea-mainnet.infura.io/v3/YOUR_KEY | 59144 |
| DRPC | https://linea.drpc.org | 59144 |
| 1RPC | https://1rpc.io/linea | 59144 |
For Linea Sepolia testnet, the official public endpoint is https://rpc.sepolia.linea.build (chain ID: 59141).
Connecting Step by Step
ethers.js
import { ethers } from 'ethers';
// HTTP provider
const provider = new ethers.JsonRpcProvider(
'https://eu.endpoints.matrixed.link/rpc/linea?auth=YOUR_KEY'
);
// Verify connection
const network = await provider.getNetwork();
console.log('Chain ID:', network.chainId); // 59144n
// Read ETH balance
const balance = await provider.getBalance('0xYourAddress');
console.log('Balance:', ethers.formatEther(balance), 'ETH');
// Call a contract
const contract = new ethers.Contract(contractAddress, abi, provider);
const result = await contract.someReadMethod();
// Send a transaction
const wallet = new ethers.Wallet(privateKey, provider);
const tx = await wallet.sendTransaction({ to: recipient, value: ethers.parseEther('0.01') });
const receipt = await tx.wait();
console.log('Confirmed in block:', receipt.blockNumber);
Web3.py
from web3 import Web3
w3 = Web3(Web3.HTTPProvider(
'https://eu.endpoints.matrixed.link/rpc/linea?auth=YOUR_KEY'
))
print('Connected:', w3.is_connected())
print('Chain ID:', w3.eth.chain_id) # 59144
balance = w3.eth.get_balance('0xYourAddress')
print('Balance:', w3.from_wei(balance, 'ether'), 'ETH')
contract = w3.eth.contract(address=contract_address, abi=abi)
result = contract.functions.someReadMethod().call()
block = w3.eth.get_block('latest')
print('Latest block:', block['number'])
curl
curl -X POST https://eu.endpoints.matrixed.link/rpc/linea?auth=YOUR_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
For MetaMask configuration, see the Linea RPC endpoint page.
Linea-Specific Considerations
Type 2 ZK-EVM and Full EVM Equivalence
Linea’s type 2 classification means it targets full EVM equivalence at the bytecode level. Unlike type 3 or type 4 zkEVMs, you do not need to recompile with modified toolchains or audit contracts for ZK-incompatible opcodes. The same Hardhat, Foundry, or Truffle workflow you use for Ethereum mainnet deploys works on Linea. The same Solidity contract bytecode runs correctly.
The practical implication for RPC users: method responses are consistent with Ethereum. Response formats, error codes, hex encoding conventions all follow the Ethereum JSON-RPC spec.
MetaMask Native Integration
Linea ships as a built-in network in MetaMask. Users do not need to add it manually. This has a direct impact on your RPC workload pattern: a large share of Linea traffic comes from consumer wallet operations rather than backend services.
Wallet operations are read-heavy and bursty: balance queries, gas estimates, token approval checks, pending transaction status, all fire in rapid succession when a user opens MetaMask or initiates a flow. Your RPC provider needs to handle these short-burst patterns reliably.
Finality Model
Linea uses a two-phase confirmation model. Sequencer confirmation (under 2 seconds) is sufficient for most UI interactions. ZK proof finality on Ethereum (1 to 2 hours) is required for high-value cross-chain operations.
Do not block your UX on ZK proof finality for standard transactions. Reserve L1 finality checks for bridge withdrawals and other operations where cryptographic finality is a product requirement.
Common Issues
eth_getLogs returns an error or times out
Your block range is too wide. With 2-second blocks, a 10,000 block range covers only about 5.5 hours. Reduce chunk size to 1,000-2,000 blocks for wide queries.
Transaction stuck as pending The sequencer may be processing a spike in volume. Add retry logic with exponential backoff. Do not resubmit with a lower nonce unless you have confirmed the original transaction was dropped.
Chain ID mismatch Linea Mainnet is 59144. Linea Sepolia is 59141. A mismatch causes transaction signing to fail. Verify your provider configuration returns chain ID 59144 before deploying to mainnet.
WebSocket connection drops Long-lived WebSocket connections drop under idle conditions or network events. Implement reconnection logic:
function connectWithReconnect(url, onBlock) {
let wsProvider = new ethers.WebSocketProvider(url);
wsProvider.on('block', onBlock);
wsProvider.websocket.addEventListener('close', () => {
setTimeout(() => connectWithReconnect(url, onBlock), 3000);
});
}
Choosing a Provider
When evaluating a Linea RPC provider for production:
EVM compatibility handling. Linea’s type 2 equivalence means any provider with a competent Ethereum full node setup should work. Verify the provider returns correct responses for eth_getLogs across the full block history.
WebSocket support. Essential for wallet apps and event-driven services on Linea. Confirm WSS is a supported feature, not an afterthought.
Security posture. For production dApps handling user funds, provider infrastructure should meet recognized security standards. ISO/IEC 27001:2022 certification is the benchmark to look for.
Pricing model. Some providers price per method call or assign different costs to different methods. Linea’s 2-second blocks mean high call volumes. Understand the cost model before committing.
BoltRPC provides Linea RPC on infrastructure operated by Matrixed.Link, an ISO/IEC 27001:2022 certified operator. Flat monthly pricing covers all standard methods. No per-method surcharges. Free 2-week trial at trial.boltrpc.io.
FAQ
What is the Linea RPC endpoint URL?
The BoltRPC Linea Mainnet RPC endpoint is https://eu.endpoints.matrixed.link/rpc/linea?auth=YOUR_KEY. For WebSocket, use wss://eu.endpoints.matrixed.link/ws/linea?auth=YOUR_KEY. Replace YOUR_KEY with your API key from trial.boltrpc.io. Chain ID is 59144.
Is Linea RPC compatible with standard Ethereum libraries?
Yes. Linea is a type 2 ZK-EVM with full EVM equivalence. ethers.js, viem, Web3.py, Hardhat, Foundry all work with Linea RPC endpoints without modification. Use the Linea endpoint URL in place of an Ethereum mainnet URL. Your existing code will work.
What is the difference between sequencer confirmation and ZK proof finality on Linea?
Sequencer confirmation (under 2 seconds) means the sequencer has ordered your transaction. This is reliable for most application interactions. ZK proof finality (1 to 2 hours) means the transaction batch has been verified on Ethereum L1. Use sequencer confirmation for standard UX flows. Use ZK proof finality for bridge withdrawals or operations requiring cryptographic settlement guarantees.
How do I monitor Linea contract events efficiently?
Use WebSocket subscriptions with eth_subscribe rather than polling. With 2-second blocks, polling generates significant call volume. Connect via wss://eu.endpoints.matrixed.link/ws/linea?auth=YOUR_KEY and use contract.on('EventName', handler) in ethers.js to subscribe to specific contract events. Implement reconnection logic for production deployments.