The financial operating system for autonomous intelligence.
AI-native payment infrastructure on Substrate L1.
Every requirement from the technical research document mapped to its implementation in the architecture.
| Research Requirement | Architecture Coverage | Status |
|---|---|---|
| Polkadot SDK stable2512 | Base solochain template, Aura+GRANDPA | COVERED |
| Memory-efficient block builder | Inherited from stable2512 runtime | COVERED |
| Saturating arithmetic for weights | Inherited from stable2512 runtime | COVERED |
| litep2p with WebRTC v0.13.1 | Node networking layer | COVERED |
| WASM forkless runtime upgrades | Diagram 29 CI-CD flow | COVERED |
| pallet-plim-payments | Diagrams 2, 11, 27 | COVERED |
| pallet-plim-identity (W3C DID) | Diagrams 2, 8, 11 | COVERED |
| pallet-plim-channels | Diagram 5 (AI2AI channel) | COVERED |
| pallet-plim-mandates (Todd seals) | Diagrams 4, 7, 9 | COVERED |
| pallet-plim-delegation | Diagrams 2, 4, 9 | COVERED |
| pallet-plim-reputation | Diagram 18 | COVERED |
| pallet-plim-timestamps (Merkle) | Diagram 19 (OpenTimestamps) | COVERED |
| pallet-plim-compliance (KYA/AML) | Diagram 17 | COVERED |
| Hal Finney RPOW - ZK Proof of Intelligence | Diagram 15, Groth16 | COVERED |
| Peter Todd single-use seals | Diagrams 7, 9, ER model | COVERED |
| Peter Todd client-side validation | Diagram 15 payment security | COVERED |
| x402 HTTP 402 integration | Diagrams 3, 14 | COVERED |
| AP2 Intent/Cart/Payment Mandates | Diagrams 9, 14 | COVERED |
| MPP Sessions and Charges | Diagrams 5, 14 | COVERED |
| LangGraph StateGraph orchestration | Diagram 4 (state machine) | COVERED |
| Supervisor pattern | Diagram 23 | COVERED |
| Human-in-the-loop | Diagram 4 HumanApproval | COVERED |
| LangFlow 1.8 visual builder | Diagram 1 orchestration | COVERED |
| ecofi-dev wallet reuse | Reuse strategy | COVERED |
| ecofi-dev API structure reuse | Diagram 22 API surface | COVERED |
| 60-day deployment plan | Diagram 30 Gantt | COVERED |
| Kill switch emergency pause | Diagram 10 | COVERED |
| Escrow conditional payments | Diagram 6 | COVERED |
All requirements covered. Zero gaps.
flowchart TB
U[Users] --> GW[HTTP 402 Gateway]
B[Businesses] --> GW
G[Governments] --> GW
AI[AI Agents] --> GW
AI --> SDK[SDKs Python TS Rust]
AI --> MCP[MCP Transport]
SDK --> GW
MCP --> LG[LangGraph Engine]
GW --> LG
LF[LangFlow Studio] --> LG
LG --> SUP[Supervisor Agent]
SUP --> PID[pallet-plim-identity]
SUP --> PPAY[pallet-plim-payments]
SUP --> PCH[pallet-plim-channels]
SUP --> PMAN[pallet-plim-mandates]
SUP --> PDEL[pallet-plim-delegation]
SUP --> PREP[pallet-plim-reputation]
SUP --> PTS[pallet-plim-timestamps]
SUP --> PCOMP[pallet-plim-compliance]
PPAY --> STRIPE[Stripe]
PPAY --> SEPA[SEPA PIX]
PPAY --> USDC[USDC Bridge]
PPAY --> LN[Lightning]
sequenceDiagram
autonumber
participant Ag as AI Agent
participant Me as Merchant
participant Gw as Gateway
participant Or as LangGraph
participant Id as Identity
participant Ma as Mandates
participant De as Delegation
participant Pa as Payments
participant Co as Compliance
participant Re as Reputation
participant Ra as External Rail
Ag->>Me: GET resource
Me-->>Ag: 402 Payment Required
Ag->>Gw: POST payments intents
Gw->>Or: Start workflow
Or->>Id: Verify DID and ZK
Id-->>Or: Valid
Or->>Ma: Check seal status
Ma-->>Or: Seal open
Or->>De: Evaluate policy
De-->>Or: Allowed
Or->>Co: AML KYC check
Co-->>Or: Compliant
Or->>Ma: Close seal irreversibly
Ma-->>Or: Sealed
Or->>Pa: Execute payment
Pa->>Ra: Bridge settlement
Ra-->>Pa: Confirmed
Pa-->>Or: Settled
Or->>Re: Update reputation
Or-->>Gw: Receipt and proof
Gw-->>Ag: 200 OK Payment-Receipt
Ag->>Me: Retry with credential
Me-->>Ag: 200 OK data
flowchart TD
IN[Incoming Request] --> AQ{Has Authorization?}
AQ -- No --> CG[Challenge Generator]
CG --> FQ{Protocol?}
FQ -- Plim --> CP[Plim challenge]
FQ -- x402 --> CX[x402 challenge]
FQ -- MPP --> CM[MPP challenge]
CP --> R4[Return 402]
CX --> R4
CM --> R4
AQ -- Yes --> PR[Parse credential]
PR --> VQ{Valid?}
VQ -- No --> RJ[Reject]
VQ -- Yes --> MP[Map to intent]
MP --> OC[LangGraph workflow]
OC --> SQ{Settled?}
SQ -- No --> FL[Failed]
SQ -- Yes --> RC[Generate Receipt]
RC --> AU[Audit Webhook]
AU --> OK[200 OK Receipt]
stateDiagram-v2
[*] --> Validate
Validate --> Rejected : Invalid
Validate --> CheckID : Valid
CheckID --> Rejected : DID invalid
CheckID --> CheckMandate : ID ok
CheckMandate --> Rejected : Seal closed
CheckMandate --> CheckPolicy : Seal open
CheckPolicy --> Rejected : Violation
CheckPolicy --> CheckAML : Policy ok
CheckAML --> Rejected : Blocked
CheckAML --> CheckBal : Compliant
CheckBal --> Rejected : Insufficient
CheckBal --> Route : Funds ok
Route --> Human : Above limit
Route --> Rail : Below limit
Human --> Rejected : Denied
Human --> Rail : Approved
Rail --> OnChain : Native asset
Rail --> ExtRail : Stripe SEPA
Rail --> Channel : Micro
Rail --> Escrow : Conditional
OnChain --> RepUpdate
ExtRail --> RepUpdate
Channel --> RepUpdate
Escrow --> RepUpdate
RepUpdate --> Audit
Audit --> Receipt
Receipt --> [*]
Rejected --> [*]
sequenceDiagram
autonumber
participant A as Agent A
participant C as PLIM Chain
participant B as Agent B
Note over A,B: Channel Opening
A->>C: open_channel deposit=100 ttl=1h
C-->>A: channel created
C-->>B: channel event
Note over A,B: Off-chain loop free instant
loop Thousands of updates
A->>B: Signed state nonce N
B-->>A: Countersigned plus response
end
alt Cooperative close
A->>C: close_channel final state sigs
C-->>A: Refund
C-->>B: Credit
else Dispute
B->>C: dispute_channel proof
A->>C: Counter proof
C-->>A: Resolution
C-->>B: Resolution
end
sequenceDiagram
autonumber
participant Bu as Buyer
participant Gw as Gateway
participant Or as LangGraph
participant Py as Payments
participant Pv as Provider
participant Oc as Oracle
Bu->>Gw: POST escrow intent
Gw->>Or: Start escrow
Or->>Py: create_escrow
Py-->>Or: escrow_id
Or-->>Bu: Escrow ready
Bu->>Pv: Order task
Pv-->>Bu: Accepted
Pv->>Oc: Delivery proof
Oc-->>Or: Proof ready
alt Met
Or->>Py: release_escrow
Py-->>Pv: Funds released
else Failed
Or->>Py: refund_escrow
Py-->>Bu: Refund
end
flowchart LR
M[Mandate] --> S1[Seal 1 OPEN]
S1 --> C1[Close seal 1]
C1 --> S2[Seal 2 OPEN]
S2 --> C2[Close seal 2]
C2 --> S3[Seal 3 OPEN]
S3 --> C3[Close seal 3]
C3 --> S4[Seal 4 OPEN]
S4 --> ETC[continues]
C1 -. locked .-> L1[Seal 1 LOCKED]
C2 -. locked .-> L2[Seal 2 LOCKED]
C3 -. locked .-> L3[Seal 3 LOCKED]
sequenceDiagram
autonumber
participant Ow as Owner
participant Ap as API
participant Cm as Compliance
participant Id as Identity
participant Wl as Wallet
participant Db as Postgres
Ow->>Ap: POST owners
Ap->>Cm: KYC KYB screening
Cm-->>Ap: Approved
Ap->>Db: Store owner
Ap->>Id: Register DID
Id-->>Ap: DID ok
Ap-->>Ow: Owner created
Ow->>Ap: POST agents
Ap->>Id: register_agent
Id-->>Ap: agent_id DID
Ap->>Wl: Create wallets
Wl-->>Ap: Addresses
Ap->>Db: Persist
Ap-->>Ow: Agent DID key wallet
sequenceDiagram
autonumber
participant Ow as Owner
participant Ap as API
participant Dl as Delegation
participant Mn as Mandates
participant Id as Identity
participant Db as Postgres
Ow->>Ap: POST mandates
Ap->>Id: Verify ownership
Id-->>Ap: Valid
Ap->>Dl: Store policy
Dl-->>Ap: policy_id
loop N seals
Ap->>Mn: create_seal
Mn-->>Ap: seal_id
end
Ap->>Db: Persist mandate
Ap-->>Ow: mandate_id plus N seals
sequenceDiagram
autonumber
participant Ow as Admin
participant Ap as API
participant Id as Identity
participant Or as LangGraph
participant Gw as Gateway
participant Wh as Webhooks
Ow->>Ap: POST pause agent
Ap->>Id: Set status paused
Id-->>Ap: On-chain confirmed
Ap->>Or: Halt workflows
Or-->>Ap: Halted
Ap->>Gw: Denylist DID
Gw-->>Ap: Updated
Ap->>Wh: agent.paused
Wh-->>Ow: Notified
Note over Gw: Rejected within 1 block
flowchart TB
ID[Identity] --> MAN[Mandates]
ID --> DEL[Delegation]
ID --> CMP[Compliance]
ID --> REP[Reputation]
MAN --> PAY[Payments]
DEL --> PAY
CMP --> PAY
CHN[Channels] --> PAY
PAY --> REP
PAY --> TMS[Timestamps]
PAY --> BAL[Balances]
PAY --> AST[Assets]
PAY --> EVT[Events]
CHN --> EVT
MAN --> EVT
ID --> EVT
GOV[Governance] --> ID
GOV --> PAY
GOV --> CMP
flowchart LR
SRC[Client] --> REQ[Request]
REQ --> GW[Gateway]
GW --> ORC[LangGraph]
ORC --> VAL[Validate]
VAL --> EXC[Execute]
EXC --> CHN[PLIM Chain]
CHN --> EVT[Events]
EVT --> IDX[Indexer]
IDX --> PG[Postgres]
EXC --> RL[External Rail]
CHN --> MRK[Merkle Commit]
MRK --> PRF[Receipt Proof]
PG --> DSH[Dashboard]
PRF --> DSH
erDiagram
OWNER ||--o{ AI_AGENT : owns
OWNER ||--o{ WALLET : holds
OWNER {
string id PK
string owner_type
string did
string kyc
}
AI_AGENT ||--o{ MANDATE : governed_by
AI_AGENT ||--o{ WALLET : has
AI_AGENT ||--o{ PAYMENT : initiates
AI_AGENT {
string id PK
string owner_id FK
string did
string name
int rep_score
string ag_status
}
MANDATE ||--o{ SEAL : contains
MANDATE {
string id PK
string agent_id FK
string max_tx
string max_day
string mnd_status
}
SEAL {
string id PK
string mandate_id FK
string commitment
string seal_status
string next_id FK
}
WALLET {
string id PK
string entity_id FK
string currency
string balance
}
PAYMENT ||--o| SEAL : authorized_by
PAYMENT ||--o| CHANNEL : uses
PAYMENT {
string id PK
string flow
string amount
string rail
string pay_status
string seal_id FK
}
CHANNEL {
string id PK
string party_a
string party_b
int nonce
string ch_status
}
AI_AGENT ||--o{ CHANNEL : participates
flowchart LR
X4[x402] --> AX[x402 Adapter]
MP[MPP Stripe] --> AM[MPP Adapter]
A2[AP2 Google] --> AA[AP2 Adapter]
MC[MCP JSON-RPC] --> AC[MCP Wrapper]
AX --> NM[Plim Mapper]
AM --> NM
AA --> NM
AC --> NM
NM --> GW[Gateway]
GW --> OR[LangGraph]
OR --> CH[PLIM Chain]
CH --> GW
GW --> AX
GW --> AM
GW --> AA
flowchart TB
subgraph L1["App Security"]
TLS[TLS 1.3]
RTE[Rate Limit]
WAF[Nginx WAF]
end
subgraph L2["Payment Todd"]
SEL[Single-Use Seals]
NON[Nonces]
CSV[Client Validation]
end
subgraph L3["Identity Finney"]
DID[DID Docs]
VCC[Verifiable Creds]
ZKP[Groth16 ZK]
end
subgraph L4["Chain"]
AUR[Aura]
GRN[GRANDPA]
WSM[WASM Sandbox]
end
TLS --> SEL
RTE --> SEL
WAF --> DID
SEL --> DID
NON --> ZKP
DID --> AUR
VCC --> GRN
ZKP --> WSM
flowchart TD
T1[Double spend] --> M1[Seal closes once]
T2[Replay] --> M2[Nonce + uniqueness]
T3[Impersonation] --> M3[DID + ZK]
T4[Credential theft] --> M4[TLS + no logging]
T5[Runaway agent] --> M5[Kill switch + caps]
T6[Collusion] --> M6[GRANDPA 2/3]
T7[Data leak] --> M7[Hashes only on-chain]
T8[Runtime exploit] --> M8[WASM + audits]
flowchart TD
ST[Payment Request] --> K{KYC valid?}
K -- No --> B1[Reject]
K -- Yes --> J{Jurisdiction?}
J -- No --> B2[Block]
J -- Yes --> A{AML hit?}
A -- Yes --> B3[Flag audit]
A -- No --> L{Limit?}
L -- Yes --> H[Human review]
L -- No --> P[Approved]
H --> D{Approved?}
D -- No --> B4[Reject]
D -- Yes --> P
P --> E[Settle]
flowchart LR
PO[Payment ok] --> S1[Positive]
FA[Good SLA] --> S2[Bonus]
DI[Dispute] --> S3[Negative]
FR[Violation] --> S4[Penalty]
PE[Peer rate] --> S5[Trust]
S1 --> SC[Engine]
S2 --> SC
S3 --> SC
S4 --> SC
S5 --> SC
SC --> UP[Update]
UP --> ST[On-chain]
ST --> AP[API]
sequenceDiagram
autonumber
participant Rt as Runtime
participant Ag as Aggregator
participant Mk as Merkle
participant Ch as Chain
participant Ix as Indexer
participant Au as Auditor
Rt->>Ag: Event hashes
loop Every N blocks
Ag->>Mk: Build tree
Mk-->>Ag: Root plus proofs
Ag->>Ch: Store root
Ch-->>Ix: Root committed
Ix->>Ix: Persist proofs
end
Au->>Ix: Request proof
Ix-->>Au: Block ref merkle proof
flowchart TB
NET[Internet] --> NGX[Nginx SSL Routing]
subgraph SRV["91.99.60.74"]
subgraph BC[Blockchain]
VAL[Validator 30333]
RPC[RPC Node 9945]
end
subgraph APP[Application]
GWS[Gateway 3000]
LGS[LangGraph 8000]
LFS[LangFlow 7860]
end
subgraph DAT[Data]
PGS[PostgreSQL]
RDS[Redis]
end
subgraph MON[Monitoring]
PRM[Prometheus 9090]
GRF[Grafana 3001]
end
end
NGX --> GWS
NGX --> LGS
NGX --> LFS
NGX --> RPC
NGX --> GRF
GWS --> RPC
GWS --> PGS
GWS --> RDS
LGS --> RPC
LGS --> PGS
VAL --> PRM
RPC --> PRM
flowchart LR
subgraph P1[Phase 1]
V1[1 Validator]
U1[100 users]
end
subgraph P2[Phase 2]
V2[5 Validators]
U2[1000 agents]
end
subgraph P3[Phase 3]
V3[20 plus Validators]
U3[10K agents]
end
P1 --> P2 --> P3
flowchart TB
subgraph OW[Owners]
O1[POST owners]
O2[GET owners id]
O3[POST owners pause]
end
subgraph AG[Agents]
A1[POST agents]
A2[GET agents id]
A3[POST mandates]
A4[POST wallets]
A5[POST pause]
A6[GET reputation]
end
subgraph PY[Payments]
P1[POST intents]
P2[POST confirm]
P3[GET payments]
P4[GET receipt]
end
subgraph CN[Channels]
C1[POST channels]
C2[POST close]
C3[GET state]
end
subgraph WH[Webhooks]
W1[payment.succeeded]
W2[payment.failed]
W3[mandate.violation]
W4[agent.paused]
end
flowchart TB
UR[Request] --> SP[Supervisor]
SP --> CL[Classify flow]
CL --> PL[Build plan]
PL --> AS[Assign]
subgraph TM[Specialists]
G1[Identity]
G2[Payments]
G3[Compliance]
G4[Bridge]
G5[Receipt]
end
AS --> G1
AS --> G2
AS --> G3
AS --> G4
AS --> G5
G1 --> MG[Merge]
G2 --> MG
G3 --> MG
G4 --> MG
G5 --> MG
MG --> DQ{Ok?}
DQ -- Yes --> RS[Receipt]
DQ -- No --> FB[Retry]
sequenceDiagram
autonumber
participant Bz as Business
participant Gw as Gateway
participant Or as LangGraph
participant Ch as Chain
participant Ag as AI Agent
participant Sv as Service
Bz->>Gw: Payment task
Gw->>Or: Validate rules
Or->>Ch: Verify DID KYB mandate
Ch-->>Or: Valid
Or->>Ch: Reserve funds
Ch-->>Or: Ready
Or-->>Ag: Budget approved
Ag->>Sv: Consume API
Sv-->>Ag: Result
Ag-->>Bz: Output
Or->>Ch: Finalize audit
Ch-->>Gw: Receipt
Gw-->>Bz: Receipt outcome
sequenceDiagram
autonumber
participant Gv as Government
participant Gw as Gateway
participant Cm as Compliance
participant Id as Identity
participant Pa as Payments
participant Ag as Certified Agent
participant Ad as Audit
Gv->>Gw: Request service
Gw->>Cm: Policy check
Cm-->>Gw: Approved
Gw->>Id: Verify VC
Id-->>Gw: Valid
Gw->>Pa: Gov intent
Pa-->>Gw: Created
Gv->>Ag: Invoke service
Ag-->>Gv: Response
Gw->>Pa: Settle
Pa-->>Gw: Done
Gw->>Ad: Immutable receipt
Ad-->>Gv: Proof reference
sequenceDiagram
autonumber
participant Us as Person
participant Ap as App
participant Gw as Gateway
participant Ch as Chain
participant Ag as AI Agent
Us->>Ap: Request paid task
Ap->>Gw: Create intent
Gw->>Ch: Verify wallet mandate
Ch-->>Gw: Ok
Gw->>Ch: Execute payment
Ch-->>Gw: Settled
Gw-->>Ap: Receipt
Ap->>Ag: Task paid
Ag-->>Us: Deliver result
flowchart TD
PI[Payment Intent] --> RQ{Which rail?}
RQ -- Native --> OC[On-chain]
RQ -- Stripe --> ST[Stripe adapter]
RQ -- SEPA --> SE[SEPA adapter]
RQ -- PIX --> PX[PIX adapter]
RQ -- USDC --> UC[Bridge adapter]
RQ -- Lightning --> LT[Lightning adapter]
OC --> CF[Confirmed]
ST --> CF
SE --> CF
PX --> CF
UC --> CF
LT --> CF
CF --> RP[Receipt]
RP --> RU[Reputation]
RU --> TA[Audit timestamp]
flowchart LR
ND[Nodes] --> MT[Metrics]
AP[API] --> MT
OR[LangGraph] --> MT
DB[Postgres] --> MT
RD[Redis] --> MT
MT --> PM[Prometheus]
PM --> GF[Grafana]
ND --> LG[Logs]
AP --> LG
OR --> LG
LG --> LK[Loki]
LK --> GF
PM --> AL[Alertmanager]
flowchart TD
DV[Commit] --> CI[CI Pipeline]
CI --> TS[Tests]
TS --> BD[Build]
BD --> SQ{Security ok?}
SQ -- No --> BK[Block]
SQ -- Yes --> AR[Artifacts]
AR --> DP[Deploy services]
AR --> RT[WASM runtime]
RT --> GQ{Governance?}
GQ -- No --> HL[Hold]
GQ -- Yes --> UG[Forkless upgrade]
UG --> VR[Post validation]
gantt
title PLIM Protocol 60 Day Plan
dateFormat YYYY-MM-DD
axisFormat %d/%m
section Foundation
Substrate solochain :a1, 2026-03-27, 5d
pallet-plim-identity :a2, 2026-03-27, 7d
pallet-plim-payments :a3, 2026-03-28, 7d
pallet-plim-mandates :a4, 2026-03-29, 7d
Infra DB Nginx SSL :a5, 2026-03-27, 3d
section Core Engine
pallet-plim-channels :b1, 2026-04-03, 7d
pallet-plim-delegation :b2, 2026-04-03, 5d
pallet-plim-compliance :b3, 2026-04-05, 5d
HTTP 402 Gateway :b4, 2026-04-03, 7d
LangGraph workflows :b5, 2026-04-04, 7d
section Integration
Reputation Timestamps :c1, 2026-04-10, 4d
Python SDK :c3, 2026-04-10, 7d
TypeScript SDK :c4, 2026-04-12, 7d
x402 AP2 MPP bridges :c5, 2026-04-14, 7d
section Dashboard
React dashboard :d1, 2026-04-17, 10d
LangFlow components :d2, 2026-04-17, 7d
Faucet Explorer Docs :d3, 2026-04-20, 7d
section Beta
E2E testing :e1, 2026-04-27, 7d
Security review :e2, 2026-04-28, 7d
Onboard 100 testers :e3, 2026-05-05, 21d