Turn your provenance graph into a payment distribution engine. Contributors are paid proportionally to their recorded contributions — no spreadsheets, no manual splits.
Overview
@provenancekit/payments provides three adapters:
| Adapter | Model | Gas | Best for |
|---|---|---|---|
DirectTransferAdapter | One-time ETH/ERC-20 | Per-transfer | Milestone payments, lump sums |
SplitsAdapter | 0xSplits automatic split | Contract deploy + update | Revenue sharing for published works |
SuperfluidAdapter | Real-time token streaming | Flow create/update | Subscription revenue, royalties |
Installation
Step 1: Calculate Distribution
The distribution calculator reads the provenance graph and computes fair splits using the Largest Remainder Method (Hamilton’s method) — the same algorithm used to apportion parliamentary seats.From a provenance bundle
Step 2: Resolve Entity Wallet Addresses
Payment adapters need wallet addresses, not entity IDs. Resolve them from your database:Option A: 0xSplits (Automatic Revenue Sharing)
0xSplits is a smart contract that automatically routes any ETH/ERC-20 sent to it according to configured splits. Update splits when the provenance graph changes.Supported chains
Base, Ethereum, Polygon, Arbitrum, Optimism, GnosisOption B: Superfluid (Real-Time Streaming)
Stream tokens to contributors in real-time — payments accumulate every second proportional to contribution.Supported chains
Ethereum, Polygon, Arbitrum, Optimism, Base, Avalanche, BSC, GnosisOption C: Direct Transfer
One-time ETH or ERC-20 transfers — simplest option for milestone payments.Recording Payments in Provenance
Record that a payment was made as part of the provenance graph:Complete Example: Canvas-Style Revenue Sharing
Gotchas
- Wallet registration: Entities must have a
walletaddress in the database for payment routing to work. Set it when callingPOST /entitywith thewalletfield. - Dust amounts: The distribution calculator ensures shares sum exactly to the total (Largest Remainder Method). Adapters should check for zero-amount recipients and skip them.
- Chain mismatch: Ensure
SplitsAdapter.chainIdmatches yourwalletClient.chain.id. Wrong chain causes silent transaction failures. - Superfluid token approval: The Superfluid adapter requires the sender to have approved the
hostcontract for token transfers. Approve the SuperToken before callingdistributeFlow. - 0xSplits immutability: Once deployed, a 0xSplits contract’s recipients can be updated by calling
updateSplit. The split address stays the same — no need to redeploy. - Gas estimation: On Base, gas costs are very low (~$0.01 per transaction). Mainnet Ethereum is significantly more expensive — use L2s or 0xSplits (single deployment + cheap updates) for cost efficiency.