Compound Setup Guide
Time: 15 minutes | Difficulty: Advanced | Market: DeFi Lending Mode: Full automation | API: Smart contract interaction | Docs: docs.compound.finance
This guide wires a Compound DeFi lending bot to the Compound V3 (Comet) smart contracts using the botwir3 runtime. Configure a wallet, connect to lending markets, and run automated yield strategies locally.
Before you start
Verify that automated operation is permitted under Compound's current terms of service before deploying. Compound is a permissionless protocol — interaction is through smart contracts on Ethereum and supported chains. botwir3 provides tools for building structured automation. The user is responsible for compliance with all applicable regulations.
Compound Terms | Last verified: May 2026
What you need
- An Ethereum wallet with ETH for gas and tokens to supply
- A private key or keystore file for the wallet (stored locally — never shared)
- The botwir3 runtime downloaded and unzipped
- A strategy config file from the builder
- An RPC endpoint (Infura, Alchemy, or a self-hosted node)
Step 1: Configure wallet credentials
Compound is a permissionless protocol. There are no API keys — the bot interacts with smart contracts using a wallet private key.
🔒 Security. The wallet private key controls all funds in the wallet. Use a dedicated wallet for bot operations with only the funds allocated to the strategy. The private key is stored in a local config file and is not transmitted to botwir3 or any third party.
Step 2: Configure the adapter
Create adapter.json in the bot directory:
{
"adapter": "compound",
"credentials": {
"private_key": "paste-wallet-private-key-here",
"rpc_url": "https://mainnet.infura.io/v3/paste-project-id-here"
},
"market": "USDC",
"chain": "ethereum",
"environment": "live",
"rate_limit_ms": 15000
}
market: Compound V3 uses isolated markets. Each market has a single borrowable asset (e.g., USDC, WETH). Supply collateral to borrow, or supply the base asset to earn yield.
chain: Compound V3 is deployed on Ethereum, Polygon, Arbitrum, Base, and Optimism.
API keys (RPC endpoint credentials) are stored in a local config file on the machine running the bot. They are not transmitted to botwir3 or any third party. botwir3 never sees, stores, or has access to wallet credentials.
Step 3: Test the connection
botwir3 test --adapter compound
Expected output:
[botwir3] Adapter: compound
[botwir3] Connection: OK (Ethereum mainnet via Infura)
[botwir3] Wallet: 0x1234...abcd
[botwir3] Market: USDC (Comet)
[botwir3] Rate limit: gas-limited (block time ~12s)
Step 4: Start the bot
botwir3 start --config my-strategy.json
The runtime loads the strategy, computes the spec hash, connects to the Compound smart contracts via the configured RPC endpoint, and begins evaluating signals. The gate function compares proposed actions against the configured spec. The user is responsible for monitoring the bot and verifying execution outcomes.
Rate limits and considerations
| Component | Limit | Notes |
|---|---|---|
| RPC endpoint | Provider-dependent | Infura free tier: 100,000 requests/day. |
| Transaction throughput | ~12 seconds/block (Ethereum) | Faster on L2 deployments. |
| Gas costs | Variable | Each supply/withdraw/borrow/repay costs gas. |
Common Compound bot configurations include yield farming (supplying assets to earn base APY + COMP rewards), automated collateral management, and rate arbitrage between Compound and Aave. Compound V3's isolated market design simplifies risk management — each market is independent. All actions and decisions are recorded in the local ledger.
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
CONNECTION_REFUSED | RPC endpoint unreachable or invalid project ID | Verify rpc_url in adapter config |
INSUFFICIENT_FUNDS | Wallet balance too low for transaction + gas | Fund the wallet with additional ETH and tokens |
TRANSACTION_REVERTED | Insufficient collateral, token approval missing, or market paused | Approve the token for the Compound Comet contract. Check collateral ratios. |
MANDATE_INTEGRITY_VIOLATION | Config file modified while bot is running | Stop the bot, verify config, restart |
Related guides
- Aave Setup Guide — DeFi lending, multi-chain
- Morpho Setup Guide — DeFi lending optimizer
- Uniswap Setup Guide — DeFi swaps on Ethereum
One bot. $129. No subscription. No $749/mo platform. → Build for Compound