Skip to main content

Overview

This guide will help you run the complete MetaVault AI stack locally, including:
  1. Local blockchain with deployed smart contracts
  2. AI agent server for vault management
  3. Next.js frontend for user interaction

Running the Full Stack

1

Start Smart Contracts

Navigate to the contracts directory and start a local Hardhat node:
First, compile the smart contracts:
Then start the local blockchain:
Keep this terminal window open. The local blockchain will run on http://127.0.0.1:8545
2

Deploy Contracts

In a new terminal, deploy the mock contracts to your local blockchain:
Save the deployed contract addresses from the output. You’ll need them for configuration.
3

Configure AI Agents

Set up the environment for the AI agents:
Edit the .env file and add your configuration. See the Configuration guide for details.
At minimum, you need to configure:
  • OPEN_ROUTER_KEY - Your OpenRouter API key
  • VAULT_ADDRESS - From the deployment output
  • RPC_URL - Set to http://127.0.0.1:8545
4

Start AI Agent Server

Run the agent server:
The agent server will start and be available for the frontend to communicate with.
To run the automation cron job (for strategy monitoring), use:
5

Configure Frontend

Set up the environment for the frontend:
Update the .env.local file with the contract addresses from Step 2:
6

Start Frontend

Launch the Next.js development server:
Open http://localhost:3000 in your browser to access MetaVault AI.

Quick Start with All Services

Alternatively, you can start all services at once from the root directory:
This will concurrently run:
  • Local Hardhat node (contracts)
  • AI agent server
  • Next.js frontend
You still need to manually deploy contracts and configure environment variables before using this command.

Verify Everything is Running

Confirm that all services are operational:
Your Hardhat node terminal should show:
The agent server should be listening on the configured port (default: 3001):
The Next.js server should display:

Connect Your Wallet

To interact with MetaVault AI:
  1. Open MetaMask and add the local Hardhat network:
    • Network Name: Hardhat Local
    • RPC URL: http://127.0.0.1:8545
    • Chain ID: 31337
    • Currency Symbol: ETH
  2. Import one of the test accounts from the Hardhat node output (it provides 20 pre-funded accounts)
  3. Connect your wallet on the MetaVault AI frontend

Next Steps

Configuration Guide

Detailed configuration options for all packages

Architecture

Learn about MetaVault AI’s system architecture

AI Agents

Explore the AI agents that manage your vault

Smart Contracts

Understand the vault’s smart contract system