Skip to content
Docs

Monero

Sync with the Wallet SDKs

Point the Monero wallet sync connection at the proxied daemon.

Overview

Do not hand-roll every daemon path in app code. The Wallet SDK Monero module expects a sync connection that already carries Gray3 project headers and the proxied base URL.

Typical flow

  1. Create or restore a Monero wallet with the Wallet SDK (seed stays on device / in your secure enclave).
  2. Build a connection from Cloud helpers (for example gray.monero.syncConnection() / daemonBaseUrl() when the SDK is available) so the client hits /v1/monero/daemon/….
  3. Call sync on the wallet; the SDK issues JSON-RPC and binary GETs/POSTs as needed.

Headers the SDK must send

Same as the authentication section of Call the daemon proxy: the project ID and the Bearer secret key. Prefer injecting them in your backend or a native secure store—never ship a long-lived secret in a public web bundle.

Browser wallets

A browser wallet cannot hold your secret key and cannot send custom headers. Instead, your backend asks for a short-lived sync URI and hands it to the page:

Request
curl -sS -X POST "https://blockchain.gray3.io/v1/monero/sync-token" \
  -H "X-Gray-Project-Id: proj_your_project_id" \
  -H "Authorization: Bearer gray_sk_your_secret" \
  -H "Content-Type: application/json" \
  -d '{ "ttlSeconds": 900 }'
json
{
  "data": {
    "token": "gray_xmr_eyJwIjoi…",
    "expiresAt": "2026-10-18T10:15:00.000Z",
    "path": "/v1/monero/t/gray_xmr_eyJwIjoi…",
    "uri": "https://blockchain.gray3.io/v1/monero/t/gray_xmr_eyJwIjoi…"
  }
}

Use uri as the wallet's daemon address with no headers. It works only for the daemon paths above, expires after ttlSeconds (60–3600, default 900), and stops working as soon as you rotate the project secret. Request a new one before expiresAt. A bad or expired URI returns 401 with unauthorized. With @gray3/cloud, call gray.monero.browserConnection().

js
// Backend route (Node.js)
export async function GET() {
  return Response.json(await gray.monero.browserConnection({ ttlSeconds: 900 }));
}

// Browser
const { uri } = await fetch("/api/monero-connection").then((r) => r.json());
await account.monero.sync({ connection: { uri } });

Related docs

The client side of Monero sync is documented in the Wallet SDKs guide, starting with Monero wallet types and Sync and restore height. This page describes the HTTP contract that the SDK uses.