Skip to content
Docs

Platforms

Node.js

Run wallets with the file-based keystore in scripts and servers, and call Gray3 Cloud with @gray3/cloud.

Requirements

Node.js 20 or later. Nothing else needs configuring: every chain family, including Kaspa signing and Monero wallets, works on Node.js. Kaspa and Monero libraries load on first use.

Wallets on Node.js

Use this for scripts, CLIs, desktop backends, and custodial services you operate yourself. sqlite: { path } needs the optional peer better-sqlite3.

Package manager
npm install @gray3/client @gray3/keystore better-sqlite3
ts
import { GrayKeystore } from "@gray3/keystore";
import { GrayClient } from "@gray3/client";

const storage = await GrayKeystore.create({
  sqlite: { path: "./gray-wallets.db" },
  password: process.env.WALLET_PASSWORD!,
});
const client = await GrayClient.create({ storage });
const wallet = await client.wallets.create({ label: "Treasury", password: process.env.WALLET_PASSWORD! });
console.log(wallet.account(0).address("ethereum"));

Restrict file permissions on the database path. Prefer password or encryptionKey from a secret manager. An auto-generated master key stored next to the secrets requires insecure: true and is for development only.

@gray3/cloud on your backend

bash
npm install @gray3/cloud
ts
import { Gray } from "@gray3/cloud";

const gray = new Gray({
  projectId: process.env.GRAY_PROJECT_ID!,
  secretKey: process.env.GRAY_SECRET_KEY!,
});

const portfolio = await gray.portfolio.get({ chainId: "ethereum", address });
const prepared = await gray.transactions.prepare({ kind: "transfer", chainId: "ethereum", from, to, value });
// …sign prepared on the device (or with @gray3/client on this server), then:
const result = await gray.transactions.broadcast({ chainId: "ethereum", signedPayload });

@gray3/cloud also runs on Deno, Bun, and edge runtimes such as Cloudflare Workers and Vercel Edge, because it uses only fetch. The full API is in the Cloud SDK section.