Skip to main content

Overview

This guide covers EVM-specific implementation details for delegating wallets on Linea and Ethereum networks. Both networks follow the same ERC20 approval pattern with slight differences in gas costs and confirmation times.
Use the /v1/delegation/evm/post-approval endpoint for both Linea and Ethereum delegations.

Supported EVM Networks

Network Name: Linea Chain ID: 59144 (0xe708) RPC URL: https://rpc.linea.build Block Explorer: https://lineascan.build Currencies: USDC, USDTAdvantages:
  • Significantly lower gas fees than Ethereum mainnet
  • Faster block times (~2-3 seconds)
  • Primary network recommended for most integrations
  • US routing available with x-us-env: true header
Typical Gas Cost: 0.010.01 - 0.10 per transaction

ERC20 Approval Pattern

EVM delegation uses the standard ERC20 approve() function to grant spending authority.

The approve() Function

Parameters:
  • spender: Platform’s smart contract address that will spend tokens
  • amount: Maximum amount the spender can transfer (in token’s smallest unit)
Returns: true if approval succeeded

How It Works

1

User Calls approve()

User’s wallet calls the approve() function on the token contract (USDC or USDT)
2

Allowance Updated

Token contract updates the allowance mapping:
3

Platform Can Spend

Platform’s smart contract can now call transferFrom() to spend up to the approved amount
4

Allowance Decreases

Each time platform spends, the allowance decreases by the spent amount

Implementation

Contract Addresses

Obtain contract addresses dynamically by calling the chain configuration endpoint before starting the delegation flow:
Recommended: Always fetch addresses dynamically using GET /v1/delegation/chain/config. This ensures you have the latest contract addresses, especially after platform upgrades or network migrations.
Always verify contract addresses are correct before approving. Approving the wrong address could result in loss of funds.

Frontend Implementation

SIWE (Sign-In with Ethereum)

SIWE is the standard format for proving wallet ownership through message signing.

SIWE Message Format

Field Descriptions

The SIWE message format must be exact. Extra whitespace, missing fields, or incorrect formatting will cause signature verification to fail.

SIWE Implementation

Gas Optimization

Check Existing Allowance

Before requesting a new approval, check if sufficient allowance already exists:

Gas Price Strategies

Let wallet handle gas price estimation (recommended):

Submit to API

After collecting all data from the blockchain, submit to the EVM-specific endpoint:

API Request

API Reference: POST /v1/delegation/evm/post-approval

Validation Rules

The API performs strict EVM-specific validation:
  • Must start with 0x
  • Must be exactly 42 characters long
  • Must contain only hexadecimal characters (0-9, a-f)
  • Case-insensitive, but checksummed addresses are preferred
Valid: 0x3a11a86cf218c448be519728cd3ac5c741fb3424 Invalid: 3a11a86cf218c448be519728cd3ac5c741fb3424 (missing 0x)
  • Must start with 0x
  • Must be exactly 66 characters long
  • Must contain only hexadecimal characters
  • Must be a confirmed transaction on the specified network
Valid: 0xb92de09d893e8162b0861c0f7321f68df02212efbc58f208839ae3f176d89638
  • Must start with 0x
  • Must be exactly 132 characters long
  • Must contain only hexadecimal characters
  • Must be valid ECDSA signature that recovers to the provided address
Valid: 0x2039b9765a4df76e8bae80f3bbc640e8ae6acc81f7a5cc96fe91ccc1844b6f7d4c3e8f1a2b...
  • Must follow SIWE format exactly
  • Must contain the provided address
  • Must contain correct chain ID for network
  • Must not be expired (check expirationTime if present)

Error Handling

Common EVM Errors

API Error Responses

Testing

Test on Linea Testnet

Before going to production, test on Linea Goerli testnet:
Get testnet ETH from:

Next Steps

Solana Implementation

Learn how delegation works on Solana

Priority Management

Configure wallet charging priority

Redelegation

Update allowances and contracts

Implementation Guide

Complete 3-step delegation workflow