Morpho Setup Guide
Time: 15 minutes | Difficulty: Advanced | Market: DeFi Lending Mode: Full automation | API: Smart contract interaction | Docs: docs.morpho.org
This guide wires a Morpho DeFi lending bot to the Morpho smart contracts using the botwir3 runtime. Configure a wallet, connect to optimized lending markets, and run automated yield strategies locally.
Before you start
Verify that automated operation is permitted under Morpho's current terms of service before deploying. Morpho 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.
Morpho 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
Morpho 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": "morpho",
"credentials": {
"private_key": "paste-wallet-private-key-here",
"rpc_url": "https://mainnet.infura.io/v3/paste-project-id-here"
},
"vault": "morpho-vault-address-here",
"chain": "ethereum",
"environment": "live",
"rate_limit_ms": 15000
}
vault: Morpho uses curated vaults managed by risk curators. Each vault has a unique contract address. Find vaults at app.morpho.org or via the Morpho API.
chain: Morpho is deployed on Ethereum and Base.
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 morpho
Expected output:
[botwir3] Adapter: morpho
[botwir3] Connection: OK (Ethereum mainnet via Infura)
[botwir3] Wallet: 0x1234...abcd
[botwir3] Vault: 0xabcd...1234
[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 Morpho 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 Base. |
| Gas costs | Variable | Each deposit/withdraw costs gas. |
ℹ Morpho architecture. Morpho optimizes lending by matching suppliers and borrowers peer-to-peer when possible, falling back to underlying pool rates (Aave, Compound) when not. This can produce higher supply APY and lower borrow APY than using Aave or Compound directly. Morpho Blue is the latest protocol version with permissionless market creation.
Common Morpho bot configurations include vault rotation (moving funds between vaults based on yield), automated deposit/withdrawal based on APY thresholds, and rate comparison strategies across Morpho, Aave, and Compound. 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 | Token approval missing or vault is paused | Approve the token for the Morpho vault contract |
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
- Compound Setup Guide — DeFi lending, isolated markets
- Uniswap Setup Guide — DeFi swaps on Ethereum
One bot. $129. No subscription. No $749/mo platform. → Build for Morpho