[02]
Quickstart (SDK)
The SDK is one file with no install step. It needs Node.js 20 or later and a wallet with a little ETH for gas and some USDG for storage. A memory costs 0.05 USDG per MB per month, with a minimum of 0.001 USDG per memory, so a few cents of USDG cover thousands of notes.
1. Get the file
curl -O https://www.mempoollabs.tech/sdk/mempool.mjs
2. Remember, recall, forget
import { mempool } from "./mempool.mjs";
const mem = await mempool({ privateKey: process.env.MEMPOOL_KEY });
const saved = await mem.remember("user.preferences", "short answers, UTC, pnpm");
// { id: "1", costUsdg: 0.001, bytes: 164, nodes: [4, 1, 2], stored: [4, 1, 2], tx: "0x..." }
const note = await mem.recall("user.preferences");
// { key: "user.preferences", value: "short answers, UTC, pnpm", servedBy: 4, nodes: [4, 1, 2], ... }
await mem.forget("user.preferences"); // copies dropped, unused USDG back to the wallet
const all = await mem.list(); // every live memory, decryptedSaving again under the same key replaces the older memory and refunds what was left of it. remember takes an optional { hours } (default 720, thirty days).
3. Or from the shell
export MEMPOOL_KEY=0x... node mempool.mjs remember project.notes "staging needs a migration before Friday" node mempool.mjs recall project.notes node mempool.mjs list node mempool.mjs status
What happens on remember
- The SDK signs a fixed message with your key and derives an AES-256-GCM key and an HMAC key from the signature. Nothing leaves your machine in clear.
- The value is encrypted, cut into 256-byte segments, and the Merkle root of the ciphertext is computed.
store(tag, root, size, hours)is sent to the contract with the USDG payment. The contract picks three active nodes.- The ciphertext is uploaded to each of the three nodes, which accept it only if it matches the root onchain.