Skip to content
pinecode

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

bash
-accent">pnpm add @pinecode/sdk
# or: -accent">npm install @pinecode/sdk
# or: -accent">yarn add @pinecode/sdk

The SDK has zero peer dependencies. It bundles its own ethers v6 build for signing.

2. Initialize a client

seed.ts
typescript
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
typescript
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 IPFS
  • cid — content hash for independent verification
  • contributor — address (and ENS, if any) of the seed author
  • signature — 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
typescript
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