This guide will help you set up and test the server on your local device.
Before testing, ensure you have:
-
Node.js 18+ installed
node --version # Should be 18.x or higher -
PostgreSQL database running locally or accessible
- Install PostgreSQL: https://www.postgresql.org/download/
- Or use Docker:
docker run --name postgres -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres
-
npm or yarn package manager
npm installThis will also run postinstall which formats and generates Prisma client.
Create a .env.local file in the root directory with the following variables:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/multisig"
# Blockfrost API Keys (get from https://blockfrost.io/)
NEXT_PUBLIC_BLOCKFROST_API_KEY_MAINNET="your-mainnet-api-key"
NEXT_PUBLIC_BLOCKFROST_API_KEY_PREPROD="your-preprod-api-key"
# Vercel Blob Storage (get from https://vercel.com/dashboard)
BLOB_READ_WRITE_TOKEN="your-blob-token"
# GitHub Token (for API access if needed)
GITHUB_TOKEN="your-github-token"
# Optional: Skip environment validation during development
# SKIP_ENV_VALIDATION=true-
Blockfrost API Keys:
- Visit https://blockfrost.io/
- Sign up for a free account
- Create projects for both Mainnet and Preprod networks
- Copy the API keys
-
Vercel Blob Token:
- Visit https://vercel.com/dashboard
- Go to Storage → Blob
- Create a new blob store
- Copy the read/write token
-
GitHub Token (optional):
- Visit https://github.com/settings/tokens
- Generate a new token with appropriate permissions
# Push schema to database
npm run db:push
# Generate Prisma client
npm run db:generate# Run migrations
npm run db:migrate
# Generate Prisma client
npm run db:generateYou can use Prisma Studio to verify the database:
npm run db:studioThis will open a browser at http://localhost:5555 where you can view and edit your database.
npm run devThe server should start on http://localhost:3000
✓ Ready in Xms
○ Compiling / ...
✓ Compiled / in XXXms
Open your browser and navigate to:
- Main Application: http://localhost:3000
- API Documentation: http://localhost:3000/api-docs (if available)
- Open http://localhost:3000
- Click "Connect Wallet" button
- Select a Cardano wallet extension (Nami, Eternl, etc.)
- Verify the connection works
You can test API endpoints using curl or a tool like Postman:
# Test health endpoint (if available)
curl http://localhost:3000/api/health
# Test wallet list endpoint
curl http://localhost:3000/api/v1/walletIdsOpen browser DevTools (F12) and check:
- Console tab for JavaScript errors
- Network tab for failed API requests
- Application tab for localStorage/sessionStorage issues
To test the production build locally:
# Build the application
npm run build
# Start production server
npm run startThe production server will also run on http://localhost:3000
Error: Missing required environment variable: DATABASE_URL
Solution:
- Ensure
.env.localfile exists in the root directory - Check that all required variables are set
- Restart the development server after adding variables
Error: Can't reach database server
Solution:
- Verify PostgreSQL is running:
pg_isreadyor check Docker container - Check DATABASE_URL format:
postgresql://user:password@host:port/database - Ensure database exists:
createdb multisig(if using PostgreSQL CLI)
Error: @prisma/client did not initialize yet
Solution:
npm run db:generateError: Port 3000 is already in use
Solution:
- Find and kill the process:
lsof -ti:3000 | xargs kill - Or use a different port:
PORT=3001 npm run dev
Error: Wallet not detected or connection fails
Solution:
- Ensure you have a Cardano wallet extension installed (Nami, Eternl, etc.)
- Check browser console for errors
- Try refreshing the page
- Clear browser cache and localStorage
Error: 401 Unauthorized or API rate limit errors
Solution:
- Verify API keys are correct
- Check Blockfrost dashboard for rate limits
- Ensure you're using the correct network (mainnet vs preprod)
- Dependencies installed (
npm install) - Environment variables configured (
.env.local) - Database set up and connected
- Prisma client generated
- Development server starts without errors
- Application loads in browser
- Wallet connection works
- API endpoints respond correctly
- No console errors
- Database operations work (create wallet, transaction, etc.)
# Run linter
npm run lint
# Run tests (if available)
npm test
# Type check
npx tsc --noEmit
# Format code
npx prettier --write .This project includes a dev-only smoke test agent for the crowdfund contract. It creates a Mesh wallet, requests funds from a private faucet, and executes a smoke flow (setup → contribute → withdraw) while streaming events to the debug UI panel.
Add these to .env.local (values shown are examples):
# Enable the test agent panel in non-dev environments (optional)
NEXT_PUBLIC_ENABLE_TEST_AGENT=true
# Faucet wallet (used to fund the agent)
FAUCET_MAX_SEND_LOVELACE=200000000
FAUCET_MIN_BALANCE_LOVELACE=50000000
# Agent config
TEST_AGENT_POOL_ID="pool1..."
# Reference script address (required by crowdfund setup)
NEXT_PUBLIC_REF_ADDR="addr_test1..."- Run
npm run dev. - Open the app and connect a wallet (network is taken from the connected wallet).
- The first time you open the panel, the app will create
./.local/test-agent-mnemonics.jsonin the repo with auto-generated mnemonics for the faucet + agent wallets. - Use the floating Test Agent panel (bottom-right) to copy the faucet address and fund it once.
- Start a run and watch the event log and React Flow state graph update in real time.
GET /api/dev/agent/info?networkId=0
Returns:
{
"faucetAddress": "addr_test1...",
"agentAddress": "addr_test1...",
"networkId": 0
}Once the server is running locally:
- Create a test wallet to verify wallet creation flow
- Test transaction creation to verify transaction flow
- Test multi-signature signing to verify signing flow
- Check API documentation at
/api-docs(if available) - Test on different networks (Preprod vs Mainnet)
If you encounter issues:
- Check the browser console for errors
- Check the terminal output for server errors
- Verify all environment variables are set correctly
- Ensure database is running and accessible
- Check the README.md for additional setup instructions