RGB asset transfers in a browser: the proxy is not a server, and five errors that cost me a day

One stateless relay is all a browser RGB transfer needs. Measured end to end: 713-byte consignment, offline validation, five errors with exact text and fix.

Published 2026-12-01. Everything below was measured, not read off a README. Live tool: https://pixelox.top/rgb/ · Source: https://github.com/ufo1898/zero-server-rgb (MIT) · Previous post: https://pixelox.top/report.html

TL;DR

  • Issuing RGB20 assets in a browser needs no server at all — that part I already had, verified on regtest, signet, testnet3 and testnet4.
  • Transferring them needs exactly one thing: a stateless RGB JSON-RPC proxy. Not a node, not an indexer of your own, not a backend. One endpoint URI, shared by everyone, that stores a ~700-byte blob for a few hours and forgets it.
  • My previous post said “no bitcoind, no Docker, no proxy, no server.” The first two are still true. The third was true only for issuance. Corrected below, with the numbers.
  • A full A→B transfer now runs entirely inside the page: invoice → send → two refreshes → Settled on both sides → a 713-byte transfer consignment exported on either side → validateConsignmentOffchain returns {"valid": true} without a wallet, an indexer or a network connection.

Receipts: transfer txid 4a8bed7fea321cb59c61e52f93995ff41fe04b9bd31ff7f1956dbd659074afdc, asset rgb:57pSd_ph-qz0Bo66-Jr59DMW-VdAb6uL-OByMnOm-RqqHkU0 (supply 1000, ticker ZSUI), sender settled at 700, receiver at 300, consignment id rgb:csg:x3VLvHkT-lMDyMgr-zD6iK9b-SPU2PnY-biGiCz8-0cHOc6s#field-polka-legalcontract.

What a consignment is for, in one paragraph

Bitcoin stores a commitment and nothing else. When you move an RGB asset, the chain records a Taproot output key tweaked with the transfer’s commitment; it does not record who owns how much. Ownership lives in consignments — signed, blinded bundles of history that the receiver validates against the chain, client-side, and keeps. That is the whole design: the sender hands the receiver a proof, the receiver checks it, the world does not need to agree on anything. Which is exactly why a transfer needs a courier and a mailbox: someone has to carry the bundle, and the receiver might be offline.

What the proxy actually is

RGB JSON-RPC protocol 1.0 is a small API between an rgb-lib wallet and a relay. The upstream implementation is RGB-Tools/rgb-proxy-server — TypeScript, MIT, v0.4.0. It:

  • stores pending consignments (a few hundred bytes to a few hundred KB),
  • serves them to the recipient named in the blinded message,
  • carries the recipient’s acknowledgement back to the sender,
  • and expires everything (24 h grace, 30 d max in my config).

It never sees a private key. It cannot sign or move anything. Losing it loses only uncollected transfers, which the sender can re-push. An endpoint looks like rpc://host:port/path in cleartext or rpcs://host/path over TLS, and the sender embeds it in the invoice (endpoints=…) so the receiver does not have to be told where to look.

That last sentence is the architectural point worth keeping: the relay is a shared utility, not per-application infrastructure. A wallet needs to know one endpoint; a browser wallet needs to know one endpoint; and because the endpoint is inside the invoice, a receiver can be on a different relay entirely and it still works. So “serverless” was the wrong word for me to use. The right word is one stateless shared relay, and it is now a solved dependency rather than a blocker.

My instance: https://pixelox.top/rgb-proxy/json-rpc (rpcs://pixelox.top/rgb-proxy/json-rpc), reporting protocol_version=1.0, version=0.4.0, max_expiry_secs=2592000, retention_grace_secs=86400. Run against a regtest node on a separate machine, from a browser, end to end.

Five errors, exact text, exact cause

1. Asset ID is required

blindReceive({amount: 300, durationSeconds: 3600}) with no assetId produces a perfectly valid asset-agnostic invoice. Then onchainSend({invoice}) throws Asset ID is required, because the sender never said which asset to pay with. The SDK’s onchainSend resolves the asset as invoice.assetId ?? params.assetId and gives up if both are absent.

Fix: pass assetId. In the UI I tried the invoice first, fell back to the wallet’s first NIA asset, and wrote it back into the field so the user can see what was chosen.

2. Insufficient bitcoin funds: needed '2000', available '0' — from blindReceive

Nothing to do with your balance. A blinded receive reserves a colorable allocation, exactly like issuance does, and a fresh wallet has none. On regtest you must createUtxos, mine a block, then invoice. The error names satoshis, which is why it sends you looking at the wrong thing. (Same root cause as the Insufficient allocations error I wrote about last time, different message.)

3. WalletTransfer has no assetId

listTransfers() returns kind/status/idx/txid/assignments — but not the asset. getConsignment(assetId, txid) therefore cannot be called from the transfer record alone, and you get to cannot tell which asset this transfer belongs to. Fix: enumerate listAssets() and try each candidate id; a lookup that misses returns nothing, so the first non-empty hit is the right one.

4. Invalid expiration

The sender’s operation expiry must be ≤ min(invoice expiry) − 600 s; rgb-lib also caps at MAX_EXPIRATION_SECS = 3650 days and keeps a 300 s proxy clock-skew margin plus a MIN_SENDER_RETENTION_GRACE_SECS = 86400 retention floor. If the proxy’s RETENTION_GRACE_SECS is below 86400 the receiver will NACK — the relay must outlive the invoice, not the other way round.

5. Error: Cannot find module 'json-rpc-2.0' on a production install

Upstream lists json-rpc-2.0 under devDependencies, but dist/src/controllers/api.js requires it at runtime. npm ci --omit=dev installs a proxy that crashes on first request and systemd restart-loops it. Install dev dependencies too, or move that package to dependencies.

Bonus, if you deploy behind nginx: client_max_body_size (consignments can be MBs), proxy_read_timeout ≥ 300 s (PoW grinding is slow by design), and MAX_POW_DIFFICULTY=0 if clients are browsers — the upstream default of 24 will happily spend a minute of CPU per request to prove work you do not need.

What the 713 bytes prove

The exported transfer consignment is 713 bytes. Inspected offline:

isTransfer: true
transition: Transfer
  inputs:  [{ Fungible: 1000 }]          // the issuer's seal, spent
  outputs: [{ Fungible: 700 },            // sender's change, vout 1, terminal
            { concealed: 300 }]           // receiver's blinded amount
witness: opretFirst, one witness tx
validateConsignmentOffchain(bytes, txid, 'Regtest') → { valid: true, warnings: [] }

The receiver’s 300 is concealed in the proof — the sender cannot see it, an observer cannot see it, and yet the receiver can prove to anyone that the 300 is his by revealing the blinding factor. This is what client-side validation buys, and it is why an explorer cannot tell you your RGB balance.

Verification here ran with no wallet, no indexer, no proxy: bytes in, verdict out, in the same browser tab that just did the transfer.

So what needs a server, in the end?

Operation Needs
Create / restore wallet (WASM) nothing
Issue RGB20 (NIA), export contract an Esplora-compatible indexer (public ones exist)
Build an invoice (blindReceive) indexer + a proxy endpoint in the invoice
Send (onchainSend) indexer + proxy + a colorable UTXO
Collect + settle (refresh) indexer + proxy
Export consignment nothing
Verify consignment offline nothing

One indexer for chain data, one relay for delivery. Both are shared, both are replaceable, neither holds keys. For WDK-style wallets the conclusion is narrow and concrete: a browser wallet needs proxyEndpoint plumbing and an import path for consignments — not a backend. That is the gap I keep pointing at, and it is a few hundred lines, not a service.

Reproduce it

Everything is in the repo, MIT: the browser app in src/main.js, the two-wallet wasm harness in research/ab.js, and the UI-level end-to-end driver in ui-e2e.mjs (two isolated browser contexts, real button clicks, regtest). The deployment is a systemd unit and eleven lines of nginx.

If you are building an RGB wallet and want the transfer leg to work in a tab, point your invoice at rpcs://pixelox.top/rgb-proxy/json-rpc and see what breaks. I would rather hear what breaks than what sounds promising.


Write a comment