Documentation

Technical overview and quick start for the Data Provenance toolkit.

How It Works

Data Provenance stores cryptographic proofs of data existence and ownership on Swarm with optional on-chain anchoring on Base Sepolia (testnet).

The SDK, CLI and MCP server can also record lineage on-chain.

Gateway payments (x402) are on Base mainnet. This app uses the gateway's free tier and never pays, so storing records here is free.

Core Concepts

Provenance Receipt — stored publicly on Swarm. It holds the file's SHA-256 hash, name, size and upload time. The file content itself never leaves the browser.

Gateway Notarization — The provenance gateway timestamps and cryptographically signs the receipt (EIP-191).

On-Chain Anchor — Hash registered on the DataProvenance smart contract (Base Sepolia). Permanent, blockchain-level immutability. Optionally links to the Swarm storage reference.

Architecture

The toolkit consists of multiple components working together:

Browser (dataprovenance.app)
  │ SHA-256 hash (client-side)
  ▼
SDK (@datafund/swarm-provenance)
  │
  ├──▶ Gateway (provenance-gateway.datafund.io)
  │      ├─ Store to Swarm (with notary signing)
  │      ├─ Stamp management
  │      └─ Payments: free tier (this app) or x402 (Base mainnet)
  │
  └──▶ Blockchain (Base Sepolia, testnet)
         └─ DataProvenance smart contract
            (hash anchoring + storageRef linking)

Full architecture and component documentation: github.com/datafund/provenance →

Gateway REST API

Base URL: provenance-gateway.datafund.io/api/v1/

These are endpoints on the Provenance Gateway, not on this app. The app calls these via the SDK.

Uploads and stamp purchases need either the free tier (send the X-Payment-Mode: free header; 3 requests per minute) or an x402 payment. On this production gateway, x402 payments are real USDC on Base mainnet, and the gateway is alpha software. To test payments, use the staging gateway (provenance-gateway.dev.datafund.io), which takes Base Sepolia test USDC. Downloads are free. This app uses the free tier and never pays.

POST/api/v1/data/
Upload data to Swarm. Supports notary signing via ?sign=notary.
GET/api/v1/data/{reference}
Download data by Swarm reference.
POST/api/v1/stamps/
Purchase postage stamp for storage.
GET/api/v1/stamps/
List available stamps with TTL and utilization.
GET/api/v1/notary/info
Check notary signing availability.

Full API docs: Gateway OpenAPI →

MCP Server

Up to 20 tools for AI agents (Claude, Cursor, any MCP-compatible agent): 10 for storage, 5 read-only chain tools for verifying records and reading lineage, and 5 more for anchoring and recording lineage. On PyPI as swarm-provenance-mcp; run it with uv:

uvx swarm-provenance-mcp
// claude_desktop_config.json
{
  "mcpServers": {
    "data-provenance": {
      "command": "uvx",
      "args": ["swarm-provenance-mcp"]
    }
  }
}

With no settings (0.3.2 and later) it lists 15 tools: the storage tools and the read-only chain tools, which need no wallet. To anchor hashes and record lineage, set CHAIN_ENABLED=true and PROVENANCE_WALLET_KEY (a funded Base Sepolia wallet); it then lists 20. CHAIN_ENABLED=false turns the chain tools off. Docker works too: docker run -i --rm ghcr.io/datafund/swarm-provenance-mcp.

Full docs: github.com/datafund/swarm_provenance_MCP →

TypeScript SDK

Client library for browser and Node.js. Handles hashing, upload, download, chain anchoring.

npm install @datafund/swarm-provenance
import { ProvenanceClient, sha256Hex } from '@datafund/swarm-provenance';
import { ChainClient, fromEip1193Provider } from '@datafund/swarm-provenance/chain';

const client = new ProvenanceClient({ payment: 'free' });
const hash = sha256Hex(fileBytes);
const result = await client.upload(proof, { raw: true, sign: 'notary' });

Full docs: github.com/datafund/swarm_provenance_SDK →

Python CLI

Command-line tool for uploading, downloading, and managing provenance files.

pip install swarm-provenance-cli
# with x402 payments and blockchain anchoring:
pip install "swarm-provenance-cli[x402,blockchain]"

The command is swarm-prov-upload. Paid uploads on the default gateway spend real USDC on Base mainnet; use --free for the free tier.

Full docs: github.com/datafund/swarm_provenance_CLI →

Lineage

Lineage records how data was derived from other data. A transformation links one parent hash to a new hash. A merge links several parent hashes to one new hash. The DataProvenance contract stores these links on-chain (v2 to v4). You can trace the chain back to its sources and forward to derived data from a hash recorded on v2 to v4.

Lineage works in the TypeScript SDK, the Python CLI and the MCP server. All three use DataProvenance v4 by default. The CLI and MCP server cannot read records on v1 or v2, so use them with v3 or v4.

SDK: Blockchain anchoring (chain) →

CLI: Transformation lineage → and Merge transformation →

MCP server: record_transform, record_merge_transform and get_provenance_chain

Contract: github.com/datafund/ConsentsBasedDataProvenance →

Smart Contracts

All contracts are deployed on Base Sepolia (testnet). Source: github.com/datafund/ConsentsBasedDataProvenance →

Current (v4)

ContractNetworkAddressFeatures
DataProvenanceBase Sepolia0x3945aDfd5Df9ab2F5cB4Ca0eb3D4384CC3650322storageRef + setStorageRef

Previous versions

VersionContractNetworkAddressNotes
v3DataProvenanceBase Sepolia0xb309dDe00819668ac74075813108659d4332D2cCstorageRef without setStorageRef
v2DataProvenanceBase Sepolia0xD4a724CD7f5C4458cD2d884C2af6f011aC3Af80aPre-storageRef
v1DataProvenanceBase Sepolia0x9a3c6F47B69211F05891CCb7aD33596290b9fE64Standalone, pre-TransformationLink

SWIP Spec

The Swarm-Based Data Provenance Framework is specified as a SWIP (Swarm Improvement Proposal).

SWIP-37: Swarm-Based Data Provenance Framework →