Tutorial

Get started with Peek-a-boo

Private payments on any EVM chain in under 5 minutes. Follow along step-by-step — from install to your first shielded transaction.

1 Install Peek-a-boo

One command installs the entire protocol — SDK, chain adapters, x402 payments, MCP agent tools, and ZK cryptography. Everything you need.

Terminal npm install peekaboopay
What's included

SDK & Core, Bittensor adapter (chain 964), Railgun adapter (Ethereum, BSC, Polygon, Arbitrum), x402 shielded payments, MCP agent tools, Poseidon hashing & Groth16 proofs.

2 Connect to a chain

Create a privacy backend and initialize the SDK client. The adapter handles RPC connection, contract discovery, and Merkle tree synchronization.

TypeScript import { PASClient } from "peekaboopay"; import { BittensorAdapter } from "peekaboopay"; // Create the privacy backend const adapter = new BittensorAdapter(); await adapter.initialize({ chainId: 964, rpcUrl: "https://lite.chain.opentensor.ai", privateKey: "0x...", // your wallet private key artifactsPath: "./circuits/build", }); // Create the SDK client const client = new PASClient(adapter); await client.connect({ agentId: "my-agent", privacyLevel: "FULL", });
3 Shield your tokens

Deposit tokens into the shielded pool. A Poseidon commitment is inserted into the on-chain Merkle tree. Your identity stays off-chain — only you hold the nullifier and secret needed to withdraw.

TypeScript const result = await client.pay({ token: { address: "0x0000000000000000000000000000000000000000", symbol: "TAO", decimals: 18, chainId: 964, }, amount: 1000000000000000000n, // 1 TAO recipient: "0x...", }); if (result.success) { console.log("Shielded:", result.data.txHash); console.log("UTXO index:", result.data.utxo.index); }
What happens on-chain

Your TAO enters the ShieldedPool contract. A commitment = Poseidon(nullifier, secret) is inserted into the Merkle tree. The deposit event is emitted, but nothing links it to your future withdrawal.

4 Send a private payment

Transfer tokens to a recipient using a stealth address. The recipient gets a one-time ERC-5564 address — no public linkability between sender and receiver.

TypeScript const transfer = await adapter.transfer({ token: { address: "0x0...", symbol: "TAO", decimals: 18, chainId: 964 }, amount: 500000000000000000n, // 0.5 TAO recipientPublicKey: "0x04...", // recipient's secp256k1 public key memo: "payment for inference", }); if (transfer.success) { console.log("Nullifier:", transfer.data.nullifier); console.log("Stealth address used — unlinkable on-chain"); }
5 Query shielded balance

Check your balance inside the shielded pool. This is computed locally from your UTXO notes — never exposed on-chain.

TypeScript const balance = await adapter.getShieldedBalance( { address: "0x0...", symbol: "TAO", decimals: 18, chainId: 964 }, "0x..." // your viewing key ); console.log("Shielded balance:", balance, "wei");
6 Withdraw to a public address

When you're ready to exit the shielded pool, generate a Groth16 ZK proof and withdraw. The proof demonstrates you own funds in the pool without revealing which deposit was yours.

TypeScript const withdrawal = await adapter.unshield({ token: { address: "0x0...", symbol: "TAO", decimals: 18, chainId: 964 }, amount: 500000000000000000n, recipient: "0xYourPublicAddress", proof: { protocol: "groth16", proof: "0x...", publicInputs: [] }, }); if (withdrawal.success) { console.log("Withdrawn:", withdrawal.data.txHash); }

For AI Agents

Peek-a-boo exposes all privacy operations as MCP tools. Any MCP-compatible agent can call shield, transfer, and prove as native tool calls.

MCP Tool Call { "tool": "pas_pay", "arguments": { "recipient": "0x...", "amount": "1000000000000000000", "token": "TAO", "memo": "inference payment" } }
Tool Description
pas_pay Send a shielded payment
pas_receive Generate a stealth receive address
pas_get_balance Query shielded balance
pas_shield_funds Deposit into shielded pool
pas_unshield_funds Withdraw from shielded pool
pas_prove Generate a ZK proof

HTTP-Native Payments with x402

Peek-a-boo supports the x402 payment protocol — private payments triggered by HTTP 402 responses. Your agent automatically handles payment negotiation.

TypeScript import { createShieldedFetch } from "peekaboopay"; const shieldedFetch = createShieldedFetch({ pay: async (params) => { // Route payment through the shielded pool return adapter.transfer(params); } }); // Use like normal fetch — payments happen automatically const response = await shieldedFetch("https://api.example.com/data"); // Agent gets 402 → shielded payment → 200 OK

API Keys for Agents

Your agents need an API key to interact with Peek-a-boo programmatically. API keys are tied to your wallet address and use Bearer authentication.

1 Connect your wallet

Go to app.peekaboo.finance and connect with MetaMask, Rabby, or any EVM wallet. Sign the SIWE message to authenticate.

2 Generate an API key

Navigate to API Keys in the sidebar. Click Generate. Your key starts with pab_ — save it immediately, it won't be shown again.

3 Use the key in your agent
TypeScript // Include your API key in the Authorization header const response = await fetch("https://app.peekaboo.finance/api/balance", { headers: { "Authorization": "Bearer pab_your_api_key_here", }, }); const { balance } = await response.json(); console.log("Shielded balance:", balance);
Available API Endpoints

GET /api/balance — Shielded balance
GET /api/transactions — Transaction history
POST /api/shield — Build shield transaction
POST /api/unshield — Build unshield transaction
POST /api/transfer — Build private transfer
All endpoints require Authorization: Bearer pab_...

4 Manage your keys

You can generate multiple API keys (one per agent or environment). Revoke compromised keys instantly from the dashboard. Revoked keys stop working immediately.