Self-hosting the verifier
The site behind attest.ochk.io is not public, so you cannot clone or deploy it.
Everything that decides a verdict is published under MIT:
@orangecheck/sdk (opens in a new tab),
@orangecheck/gate (opens in a new tab) and
@orangecheck/bip322 (opens in a new tab).
attest.ochk.io's /api/check calls the same check() you can run inside your
own server. This page shows how.
What you're standing upLink to this section
Each hosted endpoint has a published counterpart you call in-process:
| Hosted endpoint | In your own code |
|---|---|
GET / | check( from @, or @ in front of a route |
POST / | verify( from @ |
GET / | readAttestations( from @, which says when the relays did not finish (unread) |
/ | issueChallenge( and verifyChallenge( from @; see Sign in with Bitcoin |
None of these needs a database. They read attestations from Nostr relays and coins from an Esplora API.
PrerequisitesLink to this section
- Node.js 18+.
- An Esplora-compatible Bitcoin endpoint —
mempool.space(opens in a new tab) andblockstream.info(opens in a new tab) both work and are pre-wired as primary and fallback. For full sovereignty, run your own Bitcoin node with Blockstream Esplora (opens in a new tab) on top. - Access to Nostr relays for attestation discovery. The SDK's defaults are
wss://relay.damus.io,wss://nos.lol,wss://nostr.oxtr.devandwss://relay.ochk.io; override them to pin specific relays.
Pointing the SDK at your own relays + explorerLink to this section
@orangecheck/sdk doesn't call /api/check at all. The SDK is a full local
verifier — check() queries Nostr for the attestation, runs BIP-322
verification in-process, and fetches UTXOs directly from Esplora. It never
round-trips through attest.ochk.io. So "self-hosting" means pointing it at
your own relays and your own Esplora node, not at a replacement API.
import { check } from '@orangecheck/sdk';
await check({
addr: 'bc1q...',
minSats: 100_000,
// Query YOUR relays instead of the defaults.
relays: ['wss://relay.internal.example', 'wss://relay-2.internal.example'],
// Point verification at your own Bitcoin node + Esplora frontend.
verifyOptions: {
esploraMainnetBase: 'https://esplora.internal.example/api',
},
});
To gate HTTP routes, @orangecheck/gate wraps the same check():
Gate an Express route shows ocGate, and the package
also exports ocGateFastify, ocGateHono and ocGateFetch. Its relays
option sets the relays; it takes no Esplora option.
The Python SDK (orangecheck on PyPI) is a client for the hosted HTTP API
(https://ochk.io by default). It takes no relay or Esplora options, so it
cannot run check() on its own.
What stays hosted. Two things have no published counterpart:
- Family sign-in on ochk.io (
/api/auth/*and itsoc_sessioncookie). For sessions on your own site, Sign in with Bitcoin runs the challenge flow on your server. - The attest.ochk.io pages: create, verify, dashboard and the share links.
Operational notesLink to this section
- Rate limiting. attest.ochk.io's limits do not apply to code you run. If
you expose your own endpoint, put a limiter in front of it (a WAF, Cloudflare,
reverse-proxy rules or a Redis-backed limiter): each
check()costs relay queries and an Esplora lookup. See Security implications for context. - Chain-state caching. attest.ochk.io caches
/api/checkanswers for 60 s.@orangecheck/gatecaches each lookup in process (cacheTtlMs, 60 s by default). With barecheck(), cache as your traffic needs. - Multi-relay Nostr queries. Pass
relaystocheck()or the gate. Always query ≥ 3 relays so one partition doesn't break discovery. - Esplora fallback.
mempool.spaceis tried first,blockstream.infois the fallback. Both are public — no API key needed.esploraMainnetBasereplaces the first; theblockstream.infofallback stays.
Security hardening checklistLink to this section
- Rate limiting in front of any endpoint you expose.
- Multi-relay Nostr discovery (at least three distinct operators).
- Challenges carry your own
audienceandpurpose, and you pass them toverifyChallenge()asexpectedAudienceandexpectedPurpose, preventing replay against a different host. -
@orangecheck/sdkand@orangecheck/bip322kept up to date (bip322depends only on@noble/curves,@noble/hashesand@scure/base). - Read Security implications end to end before going live.
What you get by self-hostingLink to this section
- No dependency on attest.ochk.io —
check()talks to relays and an Esplora API, never to attest.ochk.io. - No attest.ochk.io rate limits — the relays and Esplora API you use may have their own.
- Pin the relays you trust, or query your own.
- Your own chain source — point
esploraMainnetBaseat your own node.
The verdict logic is the same code: attest.ochk.io's /api/check calls this
check(). Given the same relays and chain state, your answer matches the hosted
one. attest.ochk.io reads wss://nos.lol, wss://relay.primal.net,
wss://nostr.oxtr.dev and wss://relay.ochk.io; pass those as relays to see
what it sees.
FurtherLink to this section
/api/auth/*reference — ochk.io's session endpoints.@orangecheck/sdk— the SDK reference.@orangecheck/gate— the middleware reference.- Security implications — operational threat model.
- Source: github.com/orangecheck/oc-packages (opens in a new tab) — the published SDK, gate and BIP-322 packages.