Smart Wallet
Overview
StRails uses Smart Wallets (also known as Smart Contract Wallets) to provide secure, programmable token custody for fintechs and their users. Unlike traditional Externally Owned Accounts (EOAs) controlled directly by private keys, Smart Wallets are smart contracts that can execute arbitrary transactions on behalf of their owners.Smart Wallet vs Account Abstraction (ERC-4337)
These terms are often confused but refer to different things:What StRails Uses
StRails implements a minimal smart contract wallet — not a full ERC-4337 Account Abstraction wallet. Our approach:- Simple & Gas-Efficient: Uses EIP-1167 minimal proxy pattern for cheap deployments
- Owner-Controlled: Your EOA directly calls
execute()on the wallet - No External Dependencies: No bundlers, paymasters, or EntryPoint contracts required
What We Don’t Have (ERC-4337 Features)
Why this design? Simplicity and lower gas costs. Your EOA signs transactions directly to the wallet contract, avoiding the overhead of the ERC-4337 infrastructure.
Smart Wallet Architecture
WalletFactory Contract
TheWalletFactory deploys new wallet instances using the Clones library (EIP-1167 minimal proxy pattern). This approach:
- Deploys wallets at deterministic addresses based on a salt
- Reduces deployment gas costs by ~90% compared to full contract deployment
- All wallets share the same implementation logic
Wallet Contract
Each deployed wallet is a minimal proxy that delegates to the implementation contract:
Key Security Features:
- Only the owner can call
execute()andchangeOwner() - Each wallet can only be initialized once
- Nonce increments on every execution for replay protection
Withdrawing Tokens from Your Smart Wallet
Since your EOA owns the Smart Wallet, you callexecute() on the wallet contract to make it transfer tokens. The wallet then calls the token’s transfer() function internally.
Method 1: Via Block Explorer (No Code Required)
- Navigate to your wallet contract on Basescan or Etherscan
- Go to Contract → Write Contract
- Connect your MetaMask wallet (must be the owner EOA)
- Find the
executefunction and fill in:
Building the data Parameter
The data parameter is the ABI-encoded function call for the token’s transfer function:
Method 2: Using ethers.js Script
Method 3: Using viem (TypeScript)
Important Notes
Related Documentation
- Wallet Management - API endpoints for wallet operations
- Transactions Management - Transaction history and status