This example demonstrates how to upgrade an EOA (Externally Owned Account) to a Smart Account using EIP-7702 delegation, with Fireblocks managing the signing and Candide providing the Account Abstraction infrastructure.
- Creates a Fireblocks vault account and ETH wallet
- Upgrades the EOA to a Smart Account using EIP-7702 delegation
- Signs the EIP-7702 authorization with Fireblocks raw signing
- Creates a UserOperation to mint an NFT
- Uses a paymaster to sponsor gas fees (gasless transaction)
- Submits the UserOperation to the bundler for execution
EIP-7702 is a proposal that allows EOAs to temporarily delegate their code execution to a smart contract. This enables:
- Smart Account features for regular wallets (multisig, social recovery, spending limits, etc.)
- Gasless transactions via paymasters
- Batch transactions (multiple operations in one)
- Temporary delegation - the EOA can revert back anytime
Unlike smart contract wallets, EIP-7702 allows existing EOAs to gain smart account capabilities without migration.
- Node.js v18 or higher
- Fireblocks account with API access
- Candide account for bundler and paymaster access (Sign up here)
- Ethereum RPC endpoint (Infura, Alchemy, or any Sepolia node)
npm installCopy the .env.example file to .env and fill in your values:
cp .env.example .envThen edit .env with your Fireblocks API credentials, Ethereum RPC endpoint, and Candide configuration.
- Go to Candide Dashboard
- Create an account and project
- Get your Bundler URL from the project settings
- Get your Paymaster URL and create a Sponsorship Policy
- Add the policy ID to your
.envfile
Place your Fireblocks RSA private key file in this directory, or update FIREBLOCKS_SECRET_KEY_PATH to point to your key file.
npm startOr with ts-node:
ts-node index.tsThe example follows these steps:
Creates a new Fireblocks vault account and an ETH wallet (EOA) on Sepolia testnet.
Creates a Simple7702Account instance and prepares an NFT mint transaction.
Builds a UserOperation with the mint transaction and EIP-7702 authorization data.
Calculates the EIP-7702 delegation authorization hash and signs it with Fireblocks.
Sends the UserOperation to Candide's paymaster to get gas sponsorship.
Creates the UserOperation hash, signs it with Fireblocks, and attaches the signature.
Sends the complete UserOperation to the bundler and waits for confirmation.
const authHash = createEip7702DelegationAuthorizationHash(
chainId,
Simple7702Account.DEFAULT_DELEGATEE_ADDRESS,
BigInt(nonce)
);const authTx = await signHash(
fireblocks,
vault.id,
assetId,
authHash.replace(/^0x/, ''),
);userOperation.eip7702Auth = {
chainId: numberToHex(chainId),
address: Simple7702Account.DEFAULT_DELEGATEE_ADDRESS,
nonce: numberToHex(nonce),
yParity: numberToHex(signature.v % 2),
r: `0x${signature.r}`,
s: `0x${signature.s}`,
};This example runs on Sepolia testnet by default. To use other networks:
- Update
CHAIN_IDin.env - Update
NODE_URLto the appropriate RPC endpoint - Update
BUNDLER_URLandPAYMASTER_URLfor the target network - Change the
assetIdinindex.ts(e.g.,ETH_TEST6for Sepolia) - Change viem chain import from
sepoliato your target network - Change the NFT minting on sepolia to a different transaction
MIT