Skip to main content

Overview

MetaVault AI requires configuration across three packages. Each package has its own .env file with specific settings.

Contracts Configuration

The contracts package requires minimal configuration for deployment.
1

Create Environment File

2

Configure Variables

Edit packages/contracts/.env:
The private key shown above is the first Hardhat test account. Never use it on mainnet or with real funds.

Configuration Reference

string
required
Private key of the wallet that will deploy contracts.For local development, use one of Hardhat’s test account private keys.
string
Your Infura API key for connecting to Ethereum networks.Only required for testnet or mainnet deployments. Get one at infura.io.

AI Agents Configuration

The agents package requires the most configuration, including API keys and contract addresses.
1

Create Environment File

2

Configure Core Settings

Edit packages/agents/defi-portfolio/.env:
Get your OpenRouter API key at openrouter.ai
3

Configure Blockchain Connection

Add blockchain settings:
4

Configure Contract Addresses

Add the contract addresses from your deployment:
Replace these example addresses with the actual addresses from your deployment output.
5

Configure Telegram (Optional)

For Telegram notifications:
Create a Telegram bot via @BotFather to get your bot token.

Configuration Reference

string
default:"false"
Enable debug logging for the ADK framework.Set to "true" to see detailed framework logs.
string
required
Your OpenRouter API key for AI model access.The agents use OpenRouter to access LLM models like Claude.
string
default:"anthropic/claude-3.5-sonnet"
The LLM model to use for AI agents.See OpenRouter models for available options.
number
default:"3001"
Port for the main agent server.
number
default:"3002"
Port for the chat agent server.
string
required
Ethereum RPC endpoint URL.Use http://127.0.0.1:8545 for local Hardhat node.
string
required
Private key for the agent’s wallet to sign transactions.
string
required
Address of the deployed MetaVault contract.
string
required
Address of the deployed Router contract.
string
required
Address of the Aave Leverage Strategy contract.
string
required
Address of the Aave V3 Strategy contract.
Address of the LINK token (or mock LINK for testing).
string
required
Address of the mock Aave pool contract.
string
Token for your Telegram bot.Optional. Used for sending strategy alerts and notifications.
string
Telegram channel or chat ID for notifications.Optional. Where the bot will send messages.

Frontend Configuration

The frontend requires contract addresses to interact with the blockchain.
1

Create Environment File

2

Configure Contract Addresses

Edit packages/frontend/.env.local:
All variables prefixed with NEXT_PUBLIC_ are exposed to the browser. Never put sensitive keys in these variables.

Configuration Reference

string
Ethereum RPC endpoint (not exposed to browser).
string
Private key for server-side operations (not exposed to browser).
string
URL of the AI agent server API.Should match the PORT configured in the agents package.
string
required
Address of the MetaVault contract (exposed to browser).
string
required
Address of the Router contract (exposed to browser).
string
required
Address of the Aave Leverage Strategy contract (exposed to browser).
string
required
Address of the Aave V3 Strategy contract (exposed to browser).
Address of the LINK token contract (exposed to browser).

Environment-Specific Configuration

Use Hardhat’s local network:
Use Hardhat’s first test account:

Validation

After configuration, verify your setup:
If all builds succeed, your configuration is correct.

Troubleshooting

Ensure your Hardhat node is running:
Make sure you’ve deployed the contracts:
Copy the addresses from the deployment output to your .env files.
Verify your OpenRouter API key is correct and has credits.Check your account at openrouter.ai.
Change the PORT variables in your configuration:

Next Steps

Architecture

Understand how MetaVault AI components work together

AI Agents

Learn about the AI agents managing your vault