RathRath Finance
Advanced Features

EIP-7702 Authorization

Enable account abstraction and smart account capabilities using EIP-7702 authorization lists with Tachyon's transaction relay.

EIP-7702 Authorization

Leverage EIP-7702 to temporarily delegate your EOA (Externally Owned Account) to a smart contract, enabling advanced features like batched operations, gas sponsorship, and custom validation logic—all without deploying a separate smart contract wallet.

Overview

EIP-7702 introduces a new transaction type that allows EOAs to temporarily adopt smart contract code for a single transaction. This enables:

  • Smart Account Features: Access batching, session keys, and spending limits without migrating to a new wallet
  • Gas Sponsorship: Allow third parties to pay for transaction gas
  • Atomic Operations: Execute multiple operations in a single transaction
  • Custom Validation: Implement custom signature schemes or multi-sig logic

How It Works

Authorization Flow

  1. Sign Authorization: The EOA owner signs an authorization tuple specifying the contract code to delegate to
  2. Submit Transaction: The authorization is included in the transaction's authorizationList
  3. Temporary Delegation: For the duration of the transaction, the EOA behaves like a smart contract
  4. Code Execution: The delegated code executes with the EOA as the context
  5. State Reset: After the transaction, the EOA returns to its normal state (unless the code modifies storage)

Authorization Tuple Structure

Each authorization in the authorizationList contains:

FieldTypeDescription
chainIdnumberThe chain ID where the authorization is valid
addressstringThe contract address to delegate to
noncenumberThe EOA's current nonce (prevents replay attacks)
rstringECDSA signature r component
sstringECDSA signature s component
yParitynumberSignature recovery parameter (0 or 1)

Usage with Tachyon

API Request

curl -X POST "https://tachyon.rath.fi/api/submit-tx" \
  -H "Content-Type: application/json" \
  -H "api-key: YOUR_API_KEY" \
  -d '{
    "chainId": 8453,
    "to": "0xYourEOAAddress",
    "callData": "0xEncodedBatchCallData",
    "value": "0",
    "authorizationList": [
      {
        "chainId": 8453,
        "address": "0xDelegateContractAddress",
        "nonce": 0,
        "r": "0x...",
        "s": "0x...",
        "yParity": 0
      }
    ],
    "label": "EIP-7702 Batch Transaction"
  }'

Example with Viem

Here's a complete example using viem to create and sign an EIP-7702 authorization, then submit it through Tachyon:

import { createWalletClient, http, zeroAddress } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { base } from 'viem/chains';
import { Tachyon } from '@rathfi/tachyon';

// Create wallet client with your EOA
const walletClient = createWalletClient({
  account: privateKeyToAccount('0xYOUR_PRIVATE_KEY'),
  transport: http(),
  chain: base,
});

// The contract address to delegate to (e.g., a batch executor contract)
const delegateContractAddress = '0xDelegateContractAddress';

async function createEIP7702Transaction() {
  // Sign the authorization - viem handles nonce automatically
  const authorization = await walletClient.signAuthorization({
    contractAddress: delegateContractAddress,
  });

  // Format authorization for Tachyon
  const auth = {
    chainId: authorization.chainId,
    address: authorization.address,
    nonce: Number(authorization.nonce),
    r: authorization.r,
    s: authorization.s,
    v: Number(authorization.v),
    yParity: Number(authorization.yParity) as 0 | 1,
  };

  // Initialize Tachyon SDK
  const tachyon = new Tachyon({
    apiKey: process.env.TACHYON_API_KEY!,
  });

  // Submit transaction with authorization
  const taskId = await tachyon.relay({
    chainId: base.id,
    to: zeroAddress, // Or your target contract
    callData: '0x', // Encoded function call
    value: '0',
    gasLimit: '1000000',
    authorizationList: [auth],
  });

  console.log('Task ID:', taskId);

  // Wait for the transaction to be executed
  const tx = await tachyon.waitForExecutionHash(taskId, 30_000);
  console.log('Transaction executed:', tx);

  return tx;
}

createEIP7702Transaction();
import { createWalletClient, http, zeroAddress } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { base } from 'viem/chains';

// Create wallet client with your EOA
const walletClient = createWalletClient({
  account: privateKeyToAccount('0xYOUR_PRIVATE_KEY'),
  transport: http(),
  chain: base,
});

const delegateContractAddress = '0xDelegateContractAddress';

async function createEIP7702Transaction() {
  // Sign the authorization
  const authorization = await walletClient.signAuthorization({
    contractAddress: delegateContractAddress,
  });

  // Format authorization for the API
  const auth = {
    chainId: authorization.chainId,
    address: authorization.address,
    nonce: Number(authorization.nonce),
    r: authorization.r,
    s: authorization.s,
    v: Number(authorization.v),
    yParity: Number(authorization.yParity) as 0 | 1,
  };

  // Submit to Tachyon API
  const response = await fetch('https://tachyon.rath.fi/api/submit-tx', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'api-key': process.env.TACHYON_API_KEY!,
    },
    body: JSON.stringify({
      chainId: base.id,
      to: zeroAddress,
      callData: '0x',
      value: '0',
      gasLimit: '1000000',
      authorizationList: [auth],
      label: 'EIP-7702 Authorization',
    }),
  });

  const result = await response.json();
  console.log('Transaction submitted:', result.data.txId);
  return result;
}

createEIP7702Transaction();

Use Cases

1. Batched Token Operations

Execute multiple token transfers or approvals in a single transaction, saving gas and ensuring atomicity.

2. Gas Sponsorship

Allow a relayer (like Tachyon) to pay for transaction gas while your EOA executes the operation.

3. Session Keys

Temporarily delegate specific permissions to a session key for gaming or dApp interactions.

4. Account Recovery

Implement social recovery mechanisms without pre-deploying a smart contract wallet.

5. Conditional Execution

Add custom validation logic that must pass before the transaction executes.

Benefits

FeatureTraditional EOAEIP-7702 EOA
Batched transactions
Custom validation
Gas sponsorshipLimited✅ Full support
Session keys
Atomic operations
No migration needed

Important Considerations

Security Notes:

  • Only delegate to audited, trusted contracts
  • The authorization is valid for the specific chain ID and nonce
  • After the transaction, verify the EOA state is as expected
  • Be cautious with contracts that modify EOA storage permanently

Supported Networks

EIP-7702 is supported on networks that have implemented the Pectra upgrade:

  • Ethereum Mainnet
  • Base
  • Optimism
  • Arbitrum
  • And other EVM chains with Pectra support

Limitations

  • Not compatible with flash-blocks: The authorizationList parameter cannot be used with transactionType: "flash-blocks"
  • Nonce sensitivity: The authorization nonce must match the EOA's current nonce exactly
  • Chain-specific: Each authorization is only valid for the specified chain ID

SDK Support

import { Tachyon } from '@rathfi/tachyon';

const tachyon = new Tachyon({
  apiKey: process.env.TACHYON_API_KEY!,
});

// Authorization object from viem's signAuthorization
const auth = {
  chainId: 8453, // Base
  address: '0xDelegateContractAddress',
  nonce: 0,
  r: '0x...',
  s: '0x...',
  v: 27,
  yParity: 0 as 0 | 1,
};

// Submit transaction with EIP-7702 authorization
const taskId = await tachyon.relay({
  chainId: 8453,
  to: '0xTargetAddress',
  callData: '0xEncodedCallData',
  value: '0',
  gasLimit: '1000000',
  authorizationList: [auth],
});

console.log('Task ID:', taskId);

// Wait for execution
const tx = await tachyon.waitForExecutionHash(taskId, 30_000);
console.log('Execution hash:', tx);

Further Reading

On this page