Documentation

Technical Documentation

Detailed architecture, technical diagrams, and integration guides for Spirit Protocol.

Overview

System Architecture

Spirit Protocol operates as a revenue routing layer built on BASE (Coinbase L2). The architecture consists of three main components:

  • 01

    Revenue Router Contract

    Splits incoming payments into 4 equal parts

  • 02

    Spirit Registry

    Tracks registered agents and their stakeholders

  • 03

    Treasury Contract

    Manages the 25% ecosystem allocation

Stack

Network BASE (L2)
Language Solidity 0.8.x
Token Standard ERC-20
Governance Multisig → DAO

Technical Diagram

Revenue Flow Architecture

SPIRIT PROTOCOL REVENUE FLOW BASE L2 · SOLIDITY 0.8.x · ERC-20 REVENUE SOURCES NFT SALES Zora/OpenSea SUBSCRIPTIONS Stripe/Crypto API CALLS Pay-per-use SERVICES B2B Contracts SPIRIT ROUTER SpiritRouter.sol splitRevenue(agentId, amount) 0x1234...5678 emit RevenueSplit() SPIRIT REGISTRY SpiritRegistry.sol agents[], stakeholders[] lookup 25% AGENT WALLET agent.wallet Compute, Memory 25% TRAINER trainer.wallet Human Creator 25% PLATFORM platform.wallet Infrastructure 25% TREASURY SpiritTreasury Ecosystem Fund TREASURY CONTRACT SpiritTreasury.sol Governed by SPIRIT token holders LEGEND Active flow Lookup/Reference Core contract Built on BASE L2 · All transactions settled in < 2 seconds · Gas costs < $0.01

Interactive version available at BaseScan once contracts are deployed.

Contracts

Smart Contract Reference

SpiritRouter.sol

Core revenue splitting contract

Coming Jan 2026
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

Coming Jan 2026
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

Integration Guide

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.

API

Machine-Readable Data

Related Documentation