Skip to main content

EIP-7702 Execution Mode

EIP-7702 enables Externally Owned Accounts (EOAs) to temporarily delegate their execution logic to a smart account implementation. This provides EOAs with advanced capabilities like batch transactions and sponsored operations while maintaining full control.

Key Benefits

Keep Your Address

No need to migrate to a new address - use your existing EOA

Atomic Delegation

Delegation and execution happen in a single supertransaction

Reversible

Delegation can be revoked at any time

Key Advantages Over Standard EOA

  • Smart Account Features: Batch transactions, custom validation, sponsorship
  • Gasless Operations: Enable sponsored transactions through delegation
  • No Address Migration: Keep using your existing EOA address
  • Full Control: Delegation is opt-in and revocable

How It Works

EIP-7702 mode uses a 412 fallback pattern for authorization:
  1. Initial Quote Attempt: Try to get quote without authorization
  2. 412 Response: If EOA not delegated, API returns 412 with needed authorizations
  3. Sign Authorizations: Sign the returned authorization data
  4. Retry Quote: Include signed authorizations in new quote request
  5. Atomic Execution: Delegation + operations happen in single supertransaction
Important: When authorization is provided, the supertransaction atomically performs both delegation and execution. There’s no need to wait for delegation to be mined separately.

Requirements

  • Must NOT provide: fundingTokens field (not needed)
  • If not delegated: Must provide authorizations after receiving 412 response
  • Signature type: API always returns simple
  • Prerequisites: EOA must have funds for operations or use Nexus balance

Complete Flow Example

Here’s the recommended flow using the 412 fallback pattern:

Authorization Structure

The 412 error response includes authorization data:
Sign each authorization using viem’s signAuthorization:

Authorization Fields

Chain ID Options:
  • Use 0 for multi-chain authorization (works across all chains)
  • Use specific chain ID for chain-specific delegation

Advanced Example: Multi-Step DeFi

Complete example with DeFi operations:

Best Practices

Always use the 412 fallback pattern - don’t preemptively check delegation:
Delegation and operations happen in a single supertransaction:
  • No separate delegation transaction needed
  • No waiting for delegation to be mined
  • Everything is atomic: either all succeeds or all fails
Once delegated, authorizations remain valid until revoked:
Use chainId: 0 for operations across multiple chains:
Always handle both 412 and other potential errors:

Comparison with Other Modes

Troubleshooting

This is expected behavior! The API returns 412 when the EOA needs delegation:
  1. Extract authorizations from the 412 response
  2. Sign each authorization with walletClient.signAuthorization()
  3. Retry quote with signed authorizations
  4. Execute normally - delegation happens atomically
Verify you’re signing with the correct account:
This may happen if:
  • Delegation was revoked
  • Different chain requires delegation
  • Nonce has changed
Simply follow the 412 fallback pattern again.
To revoke delegation, set the delegation address to 0x0:

Security Considerations

Authorization Safety:
  • Always verify the delegation address is an official smart account implementation
  • Check the chain ID matches your intended scope (0 for multi-chain, specific for single-chain)
  • Monitor nonce values to prevent replay attacks
  • Authorizations can be revoked by setting delegation address to 0x0
  • Only sign authorizations you trust

Workflow Diagram