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:- Initial Quote Attempt: Try to get quote without authorization
- 412 Response: If EOA not delegated, API returns 412 with needed authorizations
- Sign Authorizations: Sign the returned authorization data
- Retry Quote: Include signed authorizations in new quote request
- 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:
fundingTokensfield (not needed) - If not delegated: Must provide
authorizationsafter 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:signAuthorization:
Authorization Fields
Advanced Example: Multi-Step DeFi
Complete example with DeFi operations:Best Practices
Use 412 Fallback Pattern
Use 412 Fallback Pattern
Always use the 412 fallback pattern - don’t preemptively check delegation:
Understand Atomic Execution
Understand Atomic Execution
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
Comparison with Other Modes
Troubleshooting
412 error on first request
412 error on first request
This is expected behavior! The API returns 412 when the EOA needs delegation:
- Extract
authorizationsfrom the 412 response - Sign each authorization with
walletClient.signAuthorization() - Retry quote with signed authorizations
- Execute normally - delegation happens atomically
Already delegated but getting 412
Already delegated but getting 412
This may happen if:
- Delegation was revoked
- Different chain requires delegation
- Nonce has changed
How to revoke delegation
How to revoke delegation
To revoke delegation, set the delegation address to
0x0: