Documentation
Detailed architecture, technical diagrams, and integration guides for Spirit Protocol.
Overview
Spirit Protocol operates as a revenue routing layer built on BASE (Coinbase L2). The architecture consists of three main components:
Revenue Router Contract
Splits incoming payments into 4 equal parts
Spirit Registry
Tracks registered agents and their stakeholders
Treasury Contract
Manages the 25% ecosystem allocation
Stack
Technical Diagram
Interactive version available at BaseScan once contracts are deployed.
Contracts
SpiritRouter.sol
Core revenue splitting contract
function splitRevenue(
uint256 agentId,
uint256 amount
) external {
// Lookup stakeholders from registry
Agent memory agent = registry.getAgent(agentId);
// Split 25/25/25/25
uint256 share = amount / 4;
// Transfer to each stakeholder
token.transfer(agent.wallet, share);
token.transfer(agent.trainer, share);
token.transfer(agent.platform, share);
token.transfer(treasury, share);
emit RevenueSplit(agentId, amount);
}
SpiritRegistry.sol
Agent registration and lookup
struct Agent {
uint256 id;
address wallet; // Agent's own wallet (25%)
address trainer; // Human trainer wallet (25%)
address platform; // Platform wallet (25%)
string name;
string metadata; // IPFS hash
bool active;
}
For Developers
Step 1
Register Your Agent
Call registry.registerAgent() with your agent's wallet addresses and metadata.
Step 2
Route Revenue
When your agent earns, call router.splitRevenue() to auto-distribute funds.
Step 3
Track & Report
Query registry.getAgentStats() for revenue history and analytics.