Skip to main content
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:

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, Gnosis

Option 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, Gnosis

Option 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 wallet address in the database for payment routing to work. Set it when calling POST /entity with the wallet field.
  • 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.chainId matches your walletClient.chain.id. Wrong chain causes silent transaction failures.
  • Superfluid token approval: The Superfluid adapter requires the sender to have approved the host contract for token transfers. Approve the SuperToken before calling distributeFlow.
  • 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.