Getting Started
Welcome to NEXUS Protocol. This guide will help you build, deploy, and operate autonomous AI agents onchain.
What You'll Need
- →Node.js 18+ or Python 3.10+
- →A web3 wallet (MetaMask, WalletConnect, etc.)
- →NEXUS tokens for agent deployment and operation
- →Basic understanding of blockchain and AI concepts
NEXUS Protocol provides a complete SDK for building autonomous agents that can trade, deploy contracts, participate in governance, and coordinate complex onchain workflows. All agent actions are fully auditable and secured by blockchain consensus.
Agent SDK
The NEXUS Agent SDK provides everything you need to create intelligent, autonomous agents.
Installation
npm install @nexus/sdkQuick Start
Create your first autonomous trading agent in under 50 lines:
import { NexusAgent, TradingStrategy } from '@nexus/sdk';
// Initialize agent
const agent = new NexusAgent({
privateKey: process.env.AGENT_PRIVATE_KEY,
rpcUrl: 'https://mainnet.nexus.network',
apiKey: process.env.NEXUS_API_KEY,
});
// Define trading strategy
const strategy = new TradingStrategy({
type: 'momentum',
pairs: ['ETH/USDC', 'BTC/USDC'],
timeframe: '15m',
riskLimit: 0.02, // Max 2% of portfolio per trade
stopLoss: 0.05, // 5% stop loss
});
// Configure agent behavior
agent.configure({
maxConcurrentTrades: 3,
autoCompound: true,
notifyOnTrade: true,
});
// Start agent
await agent.start(strategy);
console.log('Agent deployed and running...');
console.log(`Wallet: ${agent.address}`);
console.log(`Strategy: ${strategy.type}`);Configuration Options
| Option | Type | Description |
|---|---|---|
| privateKey | string | Agent wallet private key (keep secure!) |
| rpcUrl | string | Blockchain RPC endpoint |
| apiKey | string | NEXUS API authentication key |
| network | string | Network ID (mainnet, testnet, etc.) |
| maxGasPrice | number | Maximum gas price in gwei |
API Reference
The NEXUS REST API provides programmatic access to agent management, transaction history, governance, and analytics.
Base URL
https://api.nexus.network/v1Authentication
All API requests require an API key passed in the X-API-Key header:
curl -H "X-API-Key: your_api_key_here" \
https://api.nexus.network/v1/agentsEndpoints
List all agents associated with your API key.
{
"agents": [
{
"id": "agt_7x2k9p3m",
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"type": "trading",
"status": "active",
"created_at": "2026-03-01T10:30:00Z"
}
]
}Get transaction history for an agent.
{
"transactions": [
{
"hash": "0x8f3c2...",
"type": "swap",
"from_token": "ETH",
"to_token": "USDC",
"amount": "1.5",
"status": "confirmed",
"timestamp": "2026-03-04T02:15:00Z"
}
]
}Cast a vote on a governance proposal.
// Request
{
"proposal_id": "prop_42",
"vote": "for",
"agent_id": "agt_7x2k9p3m"
}
// Response
{
"success": true,
"tx_hash": "0x9c4f1..."
}Get performance analytics for your agents.
{
"agent_id": "agt_7x2k9p3m",
"period": "30d",
"pnl": "+12.4%",
"trades": 247,
"win_rate": 0.68,
"sharpe_ratio": 1.82
}Smart Contracts
NEXUS Protocol smart contracts are deployed across multiple chains. All contracts are verified and audited.
Contract Addresses
Integration Guide
Interact with NEXUS contracts using web3.js, ethers.js, or your preferred library:
import { ethers } from 'ethers';
const provider = new ethers.JsonRpcProvider(RPC_URL);
const contract = new ethers.Contract(
AGENT_REGISTRY_ADDRESS,
AGENT_REGISTRY_ABI,
provider
);
// Deploy a new agent
const tx = await contract.deployAgent(
agentConfig,
{ value: ethers.parseEther("0.1") }
);
await tx.wait();
console.log('Agent deployed!');Webhooks
Subscribe to real-time notifications when your agents execute actions.
Event Types
- agent.deployed - New agent created
- agent.trade_executed - Trade completed
- agent.error - Agent encountered an error
- agent.stopped - Agent stopped or paused
- governance.voted - Governance vote cast
Configure webhooks in your account dashboard. NEXUS will POST JSON payloads to your endpoint:
{
"event": "agent.trade_executed",
"agent_id": "agt_7x2k9p3m",
"data": {
"pair": "ETH/USDC",
"side": "buy",
"amount": "1.5",
"price": "2800.00",
"tx_hash": "0x8f3c2..."
},
"timestamp": "2026-03-04T02:15:00Z"
}Rate Limits
API rate limits are tier-based. Upgrade your plan for higher limits.
Rate Limit Headers: All API responses include X-RateLimit-Remaining and X-RateLimit-Reset headers.
SDKs & Libraries
Official SDKs and community libraries for popular languages and frameworks.
Changelog
- ●Agent SDK for JavaScript/TypeScript and Python
- ●RESTful API with authentication and rate limiting
- ●Smart contracts deployed to mainnet
- ●Trading, governance, and treasury management capabilities
- ●Webhook support for real-time notifications
- ●Comprehensive documentation and code examples