What is Barge?
Barge is a Docker Compose setup that runs all Ocean Protocol components locally:- Ganache - Local Ethereum network
- Aquarius - Metadata cache and search
- Provider - Data service provider
- The Graph - Indexing and querying
- Subgraph - Ocean Protocol subgraph
Prerequisites
Before setting up Barge, ensure you have:- Docker and Docker Compose installed
- Git for cloning repositories
- Node.js 20 (as specified in
.nvmrc) - The AgrospAI portal repository cloned and dependencies installed
Barge requires significant system resources. Ensure you have at least 8GB RAM available for Docker.
Setup Instructions
Start Ocean Components
Start Barge with local Ganache and The Graph nodes:Wait for the process to complete. You’ll see output indicating all services are running.
This will take several minutes as it:
- Pulls Docker images
- Starts all services
- Deploys contracts to Ganache
- Indexes the subgraph
Import Contract Artifacts
After Barge completes deployment, import the contract addresses to your portal:This script:
- Reads deployed contract addresses from Barge
- Sets environment variables in your
.envfile - Configures endpoints for local services
Update Chain Configuration
Add Ganache’s chain ID to the supported chains list in
app.config.js:app.config.js
macOS-Specific Configuration
On macOS, additional network configuration is required due to Docker networking constraints.Provider URL Configuration
Update Provider URL for macOS
Update Provider URL for macOS
On macOS, replace Barge’s internal IP with Option 2: Code ModificationIn Also update:
127.0.0.1 for provider access:Option 1: Environment Variable (Recommended).env
src/@utils/provider.ts, update all methods that call ProviderInstance:src/@utils/provider.ts
src/@utils/nft.tsinsetNFTMetadataAndTokenURIandsetNftMetadatasrc/components/Publish/index.tsxin theencryptmethod
Service Endpoint Configuration
Update Subgraph and Metadata Cache URLs for macOS
Update Subgraph and Metadata Cache URLs for macOS
Replace internal Docker IPs with localhost:
.env
Environment Variables
After runningnpm run set-barge-env, your .env file will include:
.env
On macOS, replace the internal Docker IPs (172.15.0.x) with 127.0.0.1 as described above.
MetaMask Integration
To interact with the local Ganache network through the portal:Import Test Account
When Ganache starts, it prints private keys for test accounts. Each account has 100 test ETH.Example private key:Import this into MetaMask:
- Open MetaMask
- Click account icon → Import Account
- Paste private key
- Click Import
Add Ganache Network
Add the local Ganache network to MetaMask:
| Field | Value |
|---|---|
| Network Name | Ganache Local |
| RPC URL | http://127.0.0.1:8545 |
| Chain ID | 8996 |
| Currency Symbol | ETH |
Common Barge Commands
Switching Back to Remote Networks
When you want to connect to remote networks again:Comment Out Barge Variables
Edit your
.env file and comment out or remove the Barge-specific variables:.env
Troubleshooting
Docker containers won't start
Docker containers won't start
Clean Docker system and retry:
Contract deployment fails
Contract deployment fails
Ensure Docker has enough resources:
- Open Docker Desktop
- Go to Settings → Resources
- Allocate at least 8GB RAM
- Restart Docker
- Retry Barge startup
Subgraph not syncing
Subgraph not syncing
Check The Graph node logs:If stuck, restart the graph node:
MetaMask transaction errors
MetaMask transaction errors
Common issues:Wrong network: Ensure MetaMask is on Ganache (Chain ID 8996)Nonce issues: Reset MetaMask account:
- Settings → Advanced → Reset Account
Portal can't connect to Barge services
Portal can't connect to Barge services
Verify services are running:All services should show “Up”. Check specific service:
set-barge-env script fails
set-barge-env script fails
Ensure Barge is fully deployed before running:
Service Endpoints Reference
When Barge is running, these services are available:| Service | Default URL | macOS URL | Purpose |
|---|---|---|---|
| Ganache | http://127.0.0.1:8545 | (same) | Local blockchain |
| Aquarius | http://172.15.0.5:5000 | http://127.0.0.1:5000 | Metadata cache |
| Provider | http://172.15.0.4:8030 | http://127.0.0.1:8030 | Data service |
| Subgraph | http://172.15.0.15:8000 | http://127.0.0.1:9000 | GraphQL API |
| Graph Node | http://127.0.0.1:8020 | (same) | Indexing service |
| IPFS | http://127.0.0.1:5001 | (same) | File storage |
Advanced Configuration
Custom Barge Configuration
You can customize Barge behavior by editingdocker-compose.yml in the Barge directory:
docker-compose.yml
Testing Smart Contracts
With Barge running, you can deploy and test custom smart contracts:Best Practices
Resource Management
- Stop Barge when not needed to free resources
- Use
docker-compose down -vfor clean restarts - Monitor Docker Desktop for resource usage
Development Workflow
- Use Barge for feature development and testing
- Test with remote networks before production
- Keep Barge updated with latest images
Data Persistence
- Barge data is ephemeral by default
- Use volumes for persistent data if needed
- Back up test data before cleaning Docker
Network Isolation
- Keep Barge accounts separate from real accounts
- Never use Ganache keys on mainnet
- Test thoroughly before deploying to production
Next Steps
Testing Guide
Learn how to write and run tests with your local setup
Architecture
Understand the system architecture
Data Sources
Learn about Aquarius, Subgraph, and Provider
Local Development
Return to local development guide