What are Smart Contract Wallets?
Smart Contract Wallets (SCWs) offer programmable account functionality beyond traditional Externally Owned Accounts (EOAs). Rain’s V2 collateral contracts support both EOAs and smart contract wallets as admin addresses through ERC-1271 signature verification. This means you can use multi-signature security, programmable authorization logic, and enhanced access control for your collateral management.Choosing a Wallet Type
You can use either traditional EOAs or smart contract wallets as admin addresses on your collateral contracts:- EOAs: Simple, direct control through private keys (MetaMask, Ledger, etc.)
- Smart Contract Wallets: Multi-signature support, programmable logic, and account abstraction features (Safe, Coinbase Smart Wallet, AA wallets)
How ERC-1271 works:ERC-1271 enables smart contract wallets to validate signatures by implementing an
isValidSignature function. Rain’s collateral contracts call this function to verify signatures, allowing smart wallets to apply custom authorization logic like multi-signature schemes or programmable rules.Supported Wallet Types
Our ERC-1271 implementation works with:- Safe (Gnosis Safe): Multi-signature wallets with customizable signing policies
- Account Abstraction Wallets (ERC-4337): Coinbase Smart Wallet, Crossmint, ZeroDev, Biconomy, Alchemy Account Kit
- Custom Smart Wallets: Any wallet implementing the ERC-1271 standard
- Traditional EOAs: MetaMask, Trust Wallet, Ledger, Trezor (still fully supported)
Deployment requirement:Smart contract wallets must be deployed on-chain before you can use them as admin addresses on Rain collateral contracts.
Key Differences: EOA vs Smart Contract Wallets
Externally Owned Accounts (EOAs)
- Control Mechanism: Ownership through a private key, usually a seed phrase, and can be software or hardware
- Functionality: Can send and receive transactions, manage ETH balances, and interact with smart contracts
- Deployment: Don’t need to be funded for on-chain deployment
- Examples: MetaMask, Trust Wallet, Ledger, Trezor
Smart Contract Wallets
- Control Mechanism: Governed by the code they deploy with on-chain
- Functionality: Offer versatile functions and integrations on the Ethereum network
- Deployment: Activate when the smart contract associated with the address deploys on-chain (fees required)
- Examples: Safe, Argent, Coinbase Smart Wallet
Smart Contract Wallet Features
Enhanced Security
- Multi-signature support: Require multiple approvals for transactions
- Social recovery: Allow trusted guardians to recover wallet access
- Transaction limits: Set daily/weekly spending caps
- Whitelisting: Restrict interactions to approved addresses
User Experience Improvements
- Gas abstraction: Third parties can pay transaction fees
- Batch transactions: Execute multiple operations in a single transaction
- Flexible authentication: Support for biometrics, 2FA, passkeys
- Pay gas in ERC-20 tokens: Pay transaction fees with stablecoins or other tokens
Programmable Logic
- Automated payments: Set up recurring transactions
- Conditional execution: Execute transactions based on specific conditions
- Custom validation: Implement unique signature schemes
ERC-4337 Account Abstraction
Account Abstraction as defined by ERC-4337, “allows users to use smart contract wallets containing arbitrary verification logic instead of EOAs as their primary account.”Key Components
- UserOperations: Signed messages that represent a user’s desired action on the blockchain, like sending tokens or interacting with a smart contract
- Bundlers: Special nodes on the network called “bundlers” collect multiple UserOperations from the mempool and combine them into a single and efficient transaction
- EntryPoint Contract: A singleton smart contract that receives transactions from Bundlers, then verifies and executes UserOperations
- Paymasters: Enable sponsored transactions and gas payment flexibility
Using Smart Contract Wallets with Rain
Setup Process
- Deploy Your Wallet: Ensure your smart contract wallet is deployed on the target EVM chain (Ethereum, Polygon, Base, Optimism, Avalanche, Arbitrum, ZKsync)
-
Create Consumer Application: Submit a consumer application for the user and set the
addressfield to the smart contract wallet address. Rain’s collateral contracts will recognize and support the smart wallet through ERC-1271 signature verification. - Authorize Withdrawals: Use your wallet’s SDK to sign EIP-712 structured data for withdrawal requests
- Execute Operations: The smart wallet signature is verified through ERC-1271 when executing collateral operations
How It Works
Rain’s contracts use OpenZeppelin’sSignatureChecker.isValidSignatureNow for unified signature verification:
- For EOAs: Verifies signatures using traditional ECDSA recovery
- For Smart Contract Wallets: Calls the wallet’s
isValidSignaturefunction to validate according to the wallet’s internal rules
Payments from Smart Contract Wallets
You can also make payments (collateral deposits) directly from your smart contract wallet. Rain fully supports payment transactions submitted through ERC-4337 Account Abstraction wallets. When you submit a payment through an AA wallet, a bundler submits the on-chain transaction rather than your wallet directly. Rain identifies your smart contract wallet address as the payment source—not the bundler’s address. This ensures:- Payments are attributed to the correct user account
- The
walletAddressfield in payment webhooks reflects your smart contract wallet - Payment matching works seamlessly whether you use an EOA or smart contract wallet
Technical Implementation
ERC-1271 Signature Verification
Rain’s V2 collateral contracts implement ERC-1271 support through OpenZeppelin’s SignatureChecker library:Withdrawal Flow
The withdrawal process works identically for both EOA and smart contract wallet admins:- Request Signature: Rain’s API generates an EIP-712 structured withdrawal request
- Sign Request: Admin signs using their wallet (EOA private key or smart wallet SDK)
- Execute Withdrawal: Submit the signed transaction to the Coordinator contract
- Verify Signature: Contract validates the signature matches the admin address
Multi-Chain Support
The signature verification system works consistently across all supported EVM chains:- Ethereum Mainnet
- Polygon
- Base
- Optimism
- Avalanche
- Arbitrum
- ZKsync
Implementation Resources
For detailed guidance on integrating smart contract wallets with Rain:- Managing Collateral Overview: General collateral management documentation
- Rain Support: Contact platform@rain.xyz for integration assistance
Summary
Rain’s collateral contracts support both traditional EOAs and modern smart contract wallets through ERC-1271 signature verification. This gives you flexibility to choose the security model that fits your needs:- Use EOAs for simple, single-owner control with direct private key signing
- Use Smart Contract Wallets for enhanced security with multi-signature support, programmable authorization, and account abstraction features