This project is actively developed and will continue to evolve with full Filecoin storage integration and additional settlement capabilities.
A multi-chain agent payment layer using Filecoin for verifiable audit trails.
This project demonstrates how Filecoin can serve as a persistent audit layer for multi-chain agent payment workflows. It provides a proof-of-concept implementation that captures payment intents, generates content-addressable identifiers (CIDs), and enables settlement verification across different blockchain networks.
- Intent Capture: FastAPI-based server for receiving and processing payment intents
- Content Addressing: Filecoin-style CID generation for immutable audit records
- Multi-Chain Settlement: Simulated settlement adapters for Base and Solana
- Audit Verification: Post-settlement verification against stored blueprints
┌─────────────┐
│ Agent │
│ Intent │
└──────┬──────┘
│
v
┌─────────────────┐
│ Intent Server │
│ (FastAPI) │
└──────┬──────────┘
│
v
┌─────────────────┐ ┌──────────────┐
│ Filecoin │────>│ Settlement │
│ Storage (CID) │ │ Adapters │
└─────────────────┘ └──────┬───────┘
│
v
┌──────────────┐
│ Audit │
│ Verifier │
└──────────────┘
filecoin-agent-layer/
├── agent_intent_server/ # Intent processing server
├── settlement_adapters/ # Chain-specific settlement logic
├── audit_verifier/ # Verification utilities
├── examples/ # Example intent files
├── tests/ # Unit tests
├── docs/ # Documentation
└── data/ # Runtime data storage
- Python 3.8+
- pip
# Clone the repository
git clone <repository-url>
cd filecoin-agent-layer
# Create virtual environment
python -m venv env
source env/bin/activate # On Windows: env\Scripts\activate
# Install dependencies
pip install -r requirements.txt# Start the intent server
uvicorn agent_intent_server.server:app --reload
# Server will be available at http://localhost:8000# Health check
curl http://localhost:8000/health
# Submit an intent
curl -X POST http://localhost:8000/intent \
-H "Content-Type: application/json" \
-d @examples/intent_example.jsonThe response will include a CID for the stored blueprint:
{
"cid": "bafk...",
"status": "stored",
"version": "0.1.0"
}curl -X POST http://localhost:8000/intent \
-H "Content-Type: application/json" \
-d @examples/intent_example.jsonUsing the returned CID from step 1:
# Base settlement
python settlement_adapters/base_adapter.py <CID>
# Solana settlement
python settlement_adapters/solana_adapter.py <CID># Verify Base settlement
python audit_verifier/verifier.py <CID> base
# Verify Solana settlement
python audit_verifier/verifier.py <CID> solanaExample verification output:
{
"cid": "bafk...",
"chain": "base",
"matches_cid": true,
"status_ok": true,
"blueprint_present": true,
"passed": true
}Run the test suite:
pytestRun with coverage:
pytest --cov=agent_intent_server --cov=settlement_adapters --cov=audit_verifierAccepts structured escrow intents and creates immutable blueprints stored with Filecoin-style CIDs.
Endpoints:
GET /health- Health checkPOST /intent- Submit payment intent
Simulate on-chain settlements while embedding Filecoin CIDs for auditability.
Supported Chains:
- Base
- Solana
Validates settlement events against stored blueprints to ensure integrity.
- Create a new adapter in
settlement_adapters/ - Implement the
execute_settlement(cid)function - Follow the existing pattern for event recording
When the server is running, visit:
- Interactive API docs: http://localhost:8000/docs
- Alternative docs: http://localhost:8000/redoc
Additional documentation is available in the docs/ directory:
- Integration with real Filecoin storage providers
- Actual on-chain transactions for Base and Solana
- Enhanced risk management and validation
- Support for additional blockchain networks
- Real-time settlement monitoring
- Advanced audit trail queries
MIT
Contributions are welcome! Please feel free to submit a Pull Request.