From 84b6a68000c942e17bfe75c1493eddad7ceb5b78 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 20 Oct 2026 07:01:36 -0700 Subject: Developer docs at /docs/: which coinos to build against, Lightning addresses/LNURL/NIP-05/BIP-353, Nostr Wallet Connect (methods, budgets, who answers), the hosted REST API (coinos.io/api, moving to v2.coinos.io at the cutover), what migrating a username does to an API account, and testing on mutinynet (staging.coinos.io and its /api). The service worker leaves /docs alone, so it never becomes the offline shell. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013ZDf1cyCQLkfjftYhymZAg --- static/docs/index.html | 172 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 static/docs/index.html (limited to 'static') diff --git a/static/docs/index.html b/static/docs/index.html new file mode 100644 index 0000000..631faf9 --- /dev/null +++ b/static/docs/index.html @@ -0,0 +1,172 @@ + + + + + + +Coinos for developers + + + + + +
+
coinos
+ +

Building on coinos

+

There are two coinos wallets, and they connect to other software differently. The new one (v3, this site) keeps your keys on your device. The original one at coinos.io is a hosted account with a REST API.

+ + + +

Which one should I build against?

+
+ + + + + + +
coinos v3 (v3.coinos.io)coinos.io hosted accounts
CustodySelf-custodial. The wallet runs in the browser or the app; keys never leave the device.Custodial. coinos holds the balance.
Programmatic accessNostr Wallet Connect (NIP-47), with spending limits you set per connectionREST API with a bearer token, plus a websocket
ReceiveLightning address, LNURL-pay, BOLT12, Ark, on-chainLightning, on-chain, Liquid, internal
Send on-chain from codeNoYes: /bitcoin/send
Good forApps that pay or charge a user's own wallet: zaps, tips, small checkoutsServices that run unattended: shops, bots, swaps, POS hardware
+

v3 has no server-side API or token. There's no account on our side for one to reach. If your service has to run around the clock without anyone's wallet being open, use a hosted coinos.io account and the REST API.

+ +

Receiving: Lightning addresses, LNURL, BIP-353

+

Every coinos name name@coinos.io is a Lightning address, and it works the same whether the name belongs to a v3 wallet or a hosted account.

+

LNURL-pay (LUD-06/16)

+
GET https://coinos.io/.well-known/lnurlp/<name>
+

This returns a standard payRequest. Call its callback with ?amount=<millisats> to get a BOLT11 invoice. Comments up to 200 characters are accepted (LUD-12). allowsNostr is true, so NIP-57 zaps work and receipts are published.

+

Nostr identifiers (NIP-05)

+
GET https://coinos.io/.well-known/nostr.json?name=<name>
+

BIP-353 (₿name@coinos.io)

+

v3 names publish a DNSSEC-signed payment instruction:

+
dig TXT <name>.user._bitcoin-payment.coinos.io
+

The record is a bitcoin: URI carrying an Ark address and a BOLT12 offer (lno=). Wallets that speak BIP-353 can pay it with no web request at all.

+ +

Nostr Wallet Connect (v3)

+

NWC lets your app ask a user's v3 wallet to pay or create invoices over nostr. Your app never sees the wallet's keys. The user decides how much it may spend, and can cut it off at any time.

+

Getting a connection string

+
    +
  1. In coinos, open Settings → Nostr → Nostr Wallet Connect.
  2. +
  3. Add a connection: give it a name, a maximum per payment, and a budget (per day, week or month).
  4. +
  5. Copy the nostr+walletconnect://… string into your app.
  6. +
+

Supported methods

+
+ + + + + + + + +
MethodNotes
get_infoLists the methods below.
get_balanceSpendable balance, in millisats.
get_budgetWhat's left of this connection's budget, and when it renews.
pay_invoiceBOLT11. Refused past the per-payment cap or the budget.
make_invoiceA BOLT11 invoice paid into the wallet.
lookup_invoiceBy payment_hash or invoice; tells you whether it's settled.
list_transactionsRecent payments in and out.
+

NIP-47 has no on-chain method, and coinos doesn't add one. A revoked connection answers UNAUTHORIZED.

+
Who answers. Requests are answered by the user's wallet itself, not by a coinos server. It answers while coinos is open, and in the background too if the user turned on Answer while closed, which uses push notifications to wake it. Expect a few seconds of latency when it has to wake. Don't rely on it like an always-on server.
+

Requests and responses go through wss://relay.coinos.io, plus any relays in the connection string.

+ +

The coinos REST API (hosted accounts)

+

The REST API at https://coinos.io/api keeps working for hosted accounts. The full reference is at coinos.io/docs. A short tour:

+
BASE=https://coinos.io/api
+
+# an account and a token (or copy a token from the coinos.io settings page)
+curl -X POST $BASE/register -H 'content-type: application/json' \
+  -d '{"user":{"username":"myshop","password":"…"}}'
+curl -X POST $BASE/login -H 'content-type: application/json' \
+  -d '{"username":"myshop","password":"…"}'          # → {"token": "…"}
+
+AUTH="authorization: Bearer $TOKEN"
+curl $BASE/me -H "$AUTH"                              # balance and profile
+
+# receive: a Lightning invoice (type "bitcoin" or "liquid" for an address)
+curl -X POST $BASE/invoice -H "$AUTH" -H 'content-type: application/json' \
+  -d '{"invoice":{"amount":1000,"type":"lightning"}}'  # → {"hash", "text": "lnbc…", …}
+curl $BASE/invoice/<hash>                            # received / pending
+
+# pay a Lightning invoice
+curl -X POST $BASE/payments -H "$AUTH" -H 'content-type: application/json' \
+  -d '{"payreq":"lnbc…"}'
+
+# pay a Lightning address
+curl -X POST $BASE/send/alice@coinos.io/1000 -H "$AUTH"
+
+# on-chain: estimate, then send
+curl -X POST $BASE/bitcoin/fee  -H "$AUTH" -H 'content-type: application/json' -d '{"address":"bc1…","amount":50000}'
+curl -X POST $BASE/bitcoin/send -H "$AUTH" -H 'content-type: application/json' -d '{"address":"bc1…","amount":50000}'
+
+curl "$BASE/payments" -H "$AUTH"                      # history
+

Don't poll for payments: connect to wss://coinos.io/ws, send {"type":"login","data":"<token>"}, and receive payment events as they happen. Exact request fields can change; coinos.io/docs is authoritative.

+
When v3 takes over the coinos.io homepage, the hosted wallet and its API move to v2.coinos.io. We'll announce the date ahead of time. Until then nothing changes, and https://coinos.io/api is the right base URL. v3.coinos.io has no equivalent API.
+ +

Moving a username to v3

+

A hosted account's username can move to a v3 wallet. After that, new payments to the hosted account (Lightning, BOLT12, on-chain, Liquid) are forwarded to the v3 wallet automatically. Payments between coinos accounts aren't forwarded. Your API token keeps working, but the money won't stay in the hosted balance. So if your code receives into a hosted account and then spends from it (a swap or a payout), don't migrate that account's username. Use a separate name for your v3 wallet.

+ +

Testing without real money

+

Both wallets have a copy on mutinynet, a test network with 30-second blocks. Its coins are free and worthless.

+
+ + + + + +
WhatWhere
REST API on mutinynethttps://staging.coinos.io/api: the same endpoints as coinos.io/api, with separate accounts. Websocket: wss://staging.coinos.io/api/ws
v3 wallet on mutinynetstaging.coinos.io: the same app, defaulting to mutinynet, with its own Ark server and Lightning node
Test coinsfaucet.mutinynet.com: on-chain coins, or pay a mutinynet Lightning invoice
Block explorermutinynet.com
+

Switch your base URL to https://staging.coinos.io/api and register a fresh account there. Mutinynet addresses start with tb1, and its invoices with lntbs. Liquid is switched off on staging. The test server is reset now and then, so don't keep anything there you'd miss.

+ +

Source code

+ +

Questions, or something here that's wrong? Message adam@coinos.io on nostr.

+ + +
+ + -- cgit v1.2.3