Developer docs

Build with Membrane.

Target surface: an SDK in TypeScript and Python, a local verifier, an MCP server, and receipt-format adapters for every major rail. Wrap a tool call, get a verifiable proof out. No service dependency, no lock-in — by design.

Apache-2.0 intendednpm + pip plannedMCP-native (planned)Design published
Planned v1 — not published yet. npm @kwi/membrane, pip kwi-membrane, and kwi-verify are not public. Source will live at github.com/kwizeranafinance-kind/KWI_MEMBRANE when published. What follows is the target API and design language.
01 — Quickstart (planned)

Target install — not published yet

Membrane will ship as a library plus a CLI. You will install the SDK in TypeScript or Python; the kwi-verify CLI comes with it. Verification is designed to run offline against public chain state — there is no Membrane service to sign up for.

install — planned / not published
# Target API — packages not on npm / PyPI yet
# TypeScript / Node
$ npm install @kwi/membrane

# Python
$ pip install kwi-membrane

# planned offline verifier — no trust in Membrane
$ kwi-verify bundle.json
# (illustrative — not a live run)
Package names shown here are the planned v1 surface. We will not claim install until a stranger can run it. Prefer the architecture or request a pilot.
02 — The SDK

Wrap a tool call, emit an attestation

The SDK's job (planned) is to sit in the path of an action your agent already takes, capture the pieces, and emit a Membrane attestation. One import, sane defaults. Sample below is the target surface.

typescript — target API
import { Membrane } from "@kwi/membrane";

const m = new Membrane({
  chain: "avalanche-fuji",        // anchor target
  issuer: "erc-8004:eip155:1:0x…/4217",  // agent identity
  policy: "./spending_policy.yaml",
});

// wrap the action — intent in, attestation out
const att = await m.attest({
  intent:   intentMandate,        // AP2 or Membrane-native
  call:     mcpToolCall,          // the tool-call envelope
  receipt:  x402Receipt,          // optional payment receipt
  response: result,               // hashed, not stored
  memory:   memoryEntry,          // commitment + provenance
});

await m.anchor(att);   // batched → Merkle root → on-chain

The Python SDK is planned to mirror this surface exactly. Both will expose the same attestation shape, the same verification routine, and the same chain config — so a bundle produced by one verifies with the other.

03 — Verifier CLI

kwi-verify — offline, independent (planned)

The verifier is designed to be chain-config-driven. It will read the bundle's CAIP-2 chain id, resolve the right RPC and anchor contract, confirm the root is on-chain and past finality, check the Merkle inclusion proof, and verify issuer signatures. Nothing in the path trusts Membrane.

kwi-verify — target output (illustrative)
$ kwi-verify bundle.json
# target checks — not a live Fuji run
intent mandate signature
spending policy — not violated
payment receipt — matches policy
response hash — matches output
memory entry — commitment matches
anchor — home chain · past finality
# bundle verified when packages and sample anchors ship

Chains will be declared in membrane-chains.yaml, shipped with the SDK and overridable. Each entry carries the CAIP-2 id, the anchor address, RPC endpoints (with mandatory fallbacks), and a per-chain finality_blocks value — so a root is never trusted before its chain has finalised it.

04 — MCP server

Attestation as a one-server add

The Membrane MCP server is planned to expose attestation as MCP tools. Any MCP-aware agent — a coding agent, a desktop assistant, an autonomous worker — gets Membrane attestation by adding one server to its config. This is a major distribution lever in the roadmap, because MCP is the de-facto tool-call plumbing.

attest_calltool
Wrap a tool call: takes the intent, call envelope, optional receipt, response, and memory entry; returns a signed attestation.
verify_bundletool
Run the full verification routine on a bundle and return a structured pass / fail with per-check detail.
query_memory_prooftool
Fetch the proof for a given memory entry — its provenance, the action that wrote it, and its anchor.
05 — Receipt adapters

Receipt-format pluralist

Membrane does not pick a winner in the payments-rail war. Every rail's receipt is an equivalent input into the same attestation. Whoever wins, Membrane is still useful.

x402

HTTP-native payment receipts — the Coinbase / Linux Foundation standard. The default rail for the target wedge demo.

AP2 mandates

Google's Intent / Cart / Payment Mandate triple maps directly onto Membrane attestation types — and Membrane adds the memory binding AP2 leaves open.

ACP shared payment tokens

OpenAI + Stripe's scoped, one-shot payment authorisations — ingested as a payment-receipt equivalent.

Stripe & Circle webhooks

Card-rail and USDC-native webhook receipts — for agents that pay through traditional or stablecoin processors.

06 — The contracts

On-chain anchoring

Two contracts, ~250 lines of Solidity, zero external dependencies — by design. Built toward Foundry. Full design rationale is in the architecture page.

contracts/ — target toolchain (unpublished)
# Target: Foundry suite (unpublished until repo is public)
$ forge install foundry-rs/forge-std
$ forge build
# solc 0.8.24 / paris target
$ forge test
# MembraneAnchorTest + MembraneRootRegistryTest (unit + fuzz)
# Pass counts published with the public repo and CI
MembraneAnchorevery EVM chain
Immutable, permissionless. Deployed via CREATE2 to the same address on every chain. anchorRoot(), isAnchored(), verifyAnchoredLeaf().
MembraneRootRegistryavalanche only
The canonical cross-chain index. Owner + registrar model — anti-griefing, not a trust gate.
toolchainreproducible
solc 0.8.24, paris EVM target, metadata hash stripped — so the CREATE2 address is identical across chains.
07 — Sample bundle

What a proof bundle looks like

A bundle is a flat, content-addressed object. Sample bundles will ship in the public repo under samples/ so anyone can verify offline with kwi-verify — the samples will be the documentation.

bundle.json
{
  "intent_anchor":  "0x9f3c…a17",   // ap2:intent-mandate
  "policy_id":      "0x71b2…0e4",
  "issuer":         "eip155:1:0x…/4217",  // erc-8004
  "parent_call":    "mcp:call:7a1f…",
  "payment_receipt":"x402:0x4e1d…b02",
  "response_hash":  "0xc7a9…3f1",
  "memory_entry":   "0xe520…9ac",
  "anchor": {
    "caip2":  "eip155:43113",         // avalanche-fuji
    "root":   "0x8d44…c10",
    "block":  41208917
  },
  "commitment":     "0x2fae…b88"    // the bundle's own hash
}
08 — Reference design / target demo

Verifiable USDC spend, end to end

The reference design for the wedge: an agent on Avalanche Fuji buys an API key with USDC through an x402 endpoint, and Membrane emits one composite proof. Not a public runnable artifact yet — strangers cannot verify a sample bundle today.

  • Intent. "Buy a 30-day API key from Provider X if it's under $20" — signed as an intent mandate.
  • Call & pay. The agent hits the x402 endpoint, gets a payment-required challenge, signs and broadcasts a USDC payment within the active policy.
  • Receipt & response. An x402 receipt and the API key come back; the response is content-hashed.
  • Memory. "Purchased API key for Provider X, expires <date>" is written with full provenance.
  • Bundle & anchor. Intent, policy, receipt, response hash, memory entry — bound into one attestation and anchored to Fuji.
  • Verify (target). kwi-verify bundle.json → six checks, offline.
When the demo ships, it will produce a single bundle.json — the thing you can hand to a teammate, an investor, or a working group and have them verify themselves.
09 — Contributing

Built to be public

Membrane is developed by Kwizerana Finance toward an Apache-2.0 public release. The contracts, the SDK, the verifier, and these docs will live in one repository when published.

  • Repository (when published). github.com/kwizeranafinance-kind/KWI_MEMBRANE — contracts, docs, and site.
  • Near-term workstreams. The wedge-demo proof bundle, the MCP server scaffold, and the AP2-mandate adapter.
  • Standards. Membrane aims to contribute openly to the x402, AP2, A2A, ERC-8004, and MCP communities rather than compete with them.

Build toward the first verifiable agent action.

Read the architecture, request a pilot, or follow along until packages and a public repo ship.