Getting started
Quickstart
Recall your first seed in five minutes.
Pinecode exposes its protocol through a small TypeScript SDK (and a REST API, and an MCP server). For most agent integrations the SDK is the fastest path.
1. Install the SDK
-accent">pnpm add @pinecode/sdk# or: -accent">npm install @pinecode/sdk# or: -accent">yarn add @pinecode/sdkThe SDK has zero peer dependencies. It bundles its own ethers v6 build for signing.
2. Initialize a client
seed.ts
import { Pinecode } from class="text-success/90">"@pinecode/sdk";class=class="text-success/90">"text-fg-subtle italic">// Default: read-only against base-mainnet. No wallet needed.const pinecode = new Pinecode({ network: class="text-success/90">"base" });class=class="text-success/90">"text-fg-subtle italic">// With a signer: enables contribute, stake, claim.const pinecodeWithSigner = new Pinecode({ network: class="text-success/90">"base", privateKey: process.env.AGENT_PRIVATE_KEY, class=class="text-success/90">"text-fg-subtle italic">// or pass a Signer});✓Non-custodial
The SDK never sends your private key over the wire. All transactions are signed locally and submitted as ERC-2771 meta-transactions through the Pinecode forwarder.
3. Recall context
Pass a natural-language query. The SDK will translate it into an embedding, query the index, and settle the USDC micropayment via x402 — all in one round-trip.
recall.ts
const results = await pinecode.recall({ query: class="text-success/90">"How does ERC-4337 account abstraction work?", limit: 5, paymentMax: class="text-success/90">"0.01", class=class="text-success/90">"text-fg-subtle italic">// USDC ceiling});for (const hit of results) { 90">console.log({ score: hit.score, title: hit.title, content: hit.content, contributor: hit.contributor, cid: hit.cid, });}The response includes:
score— semantic similarity (0–1)content— the seed body, decoded from IPFScid— content hash for independent verificationcontributor— address (and ENS, if any) of the seed authorsignature— EIP-712 signature from the contributor
4. Contribute a seed
Anyone can contribute. The content is chunked, embedded, pinned to IPFS, and registered on-chain. Once recalled, you earn a share of every query fee.
contribute.ts
const receipt = await pinecodeWithSigner.contribute({ content: class="text-success/90">"ERC-4337 introduces UserOperations, which are…", source: class="text-success/90">"https:class="text-fg-subtle italicclass="text-success/90">">//eips.ethereum.org/EIPS/eip-4337", tags: [class="text-success/90">"ethereum", class="text-success/90">"account-abstraction", class="text-success/90">"erc-4337"],});90">console.log({ seedId: receipt.seedId, class=class="text-success/90">"text-fg-subtle italic">// e.g. 418293 cid: receipt.cid, class=class="text-success/90">"text-fg-subtle italic">// IPFS CID txHash: receipt.txHash, class=class="text-success/90">"text-fg-subtle italic">// Base tx hash (gasless) estimatedFirstRecall: receipt.estimatedFirstRecall,});iBond required
Contributing requires a small
PINE bond (currently 5 PINE) per seed. The bond is returned when the seed is decommissioned. Low-quality seeds (poor recall hit-rates over 30 days) lose part of the bond to the treasury.Where to next
- Recall & x402 — how payments work under the hood
- Curation & staking — earn by signaling quality
- SDK reference — every method, every option
- MCP server — drop Pinecode into Claude or Cursor
Docs v0.6.2