Bot Wallet Architecture
Your bot has two addresses:- Gas wallet (
bot.viem.account) - Signs and pays for transactions - App address (
bot.appAddress) - Treasury wallet (SimpleAccount)
Your gas wallet needs Base ETH for transaction fees. See Getting Started for details.
Configuration
Base RPC URL
For reliable blockchain interactions, configure a custom RPC endpoint. The default public RPC has strict rate limits..env:
Bot Contract Interactions
Reading from Contracts
Read contract state without gas costs:Writing to Contracts
Useexecute from ERC-7821 for any onchain interaction:
Batch Transactions
Execute multiple operations atomically:To request users to sign transactions or messages, see Interactions. This page focuses on bot-initiated blockchain operations.
Utility Functions
getSmartAccountFromUserId
Get a user’s smart account address:null if no smart account exists.
Use cases:
- Send tokens/NFTs to users
- Airdrop rewards
- Check balances
- Verify ownership
Method Selection Guide
| Task | Method | Learn More |
|---|---|---|
| Read contract state | readContract | - |
| Bot sends transaction | execute | - |
| Bot sends batch transactions | execute with multiple calls | - |
| User sends transaction | sendInteractionRequest (transaction) | Interactions |
| User signs message | sendInteractionRequest (signature) | Interactions |
| User clicks button/form | sendInteractionRequest (form) | Interactions |
| Bot’s SimpleAccount operations | writeContract | - |
Next Steps
- Create interactions with buttons and forms
- Integrate external services via webhooks
- Learn about slash commands
- Explore event handlers