Quickstart
Goal: go from a file on your disk to a published, verifiable stamp in under a minute.
You will need:
- A Bitcoin wallet that can sign a message: UniSat, Xverse, Leather, OKX,
Phantom and Sparrow sign with BIP-322, and Electrum's legacy
signmessagesignature is accepted too (which forms). - A browser.
No account. No server. No fees.
Option A — use the hosted web clientLink to this section
- Open stamp.ochk.io/create (opens in a new tab).
- Drop the file you want to stamp. Your browser hashes it in-place; the bytes never leave your tab.
- Enter your Bitcoin address. Signed in with a wallet, one click fills it.
- Sign. The page shows the six-line canonical message (starting with
oc-stamp:v1) and the id computed from it; what you sign is that id, a 64-character hex string. Sign with your browser wallet (UniSat, Xverse, Leather, OKX or Phantom), or sign the id in any wallet and paste the signature. - The client submits the envelope id to the three default OpenTimestamps calendars (alice, bob, finney); two must answer. You get a pending proof immediately. It becomes a confirmed anchor once it lands in a Bitcoin block, usually within a few hours; open the stamp on stamp.ochk.io/verify (opens in a new tab) then to save the confirmed proof.
- Download the
.stampfile. Ship it alongside your content, or copy the share link.
Later, anyone can drop that .stamp into
stamp.ochk.io/verify (opens in a new tab) and check authorship and
priority; anyone with Bitcoin block headers can do the same offline. A stake
reference is re-checked against the chain when verified.
Option B — use the SDKLink to this section
npm install @orangecheck/stamp-core @orangecheck/stamp-ots @orangecheck/bip322import { normalizeAddress } from '@orangecheck/bip322';
import { stamp } from '@orangecheck/stamp-core';
import { submitToCalendars, toStampOts } from '@orangecheck/stamp-ots';
declare const typed: string; // the address field
declare function walletSignBIP322(message: string): Promise<string>; // your wallet's BIP-322 signer
// Your address as typed or scanned: 'BC1Q…' from a QR code becomes 'bc1q…'.
const address = normalizeAddress(typed);
if (!address) throw new Error('Not a Bitcoin address');
// 1. Build a signed stamp envelope.
const env = await stamp({
content: new TextEncoder().encode('hello stamp'),
mime: 'text/plain',
signer: {
address,
signMessage: async (msg) => walletSignBIP322(msg), // your wallet
},
});
// 2. Anchor to Bitcoin (pending proof).
const proof = await submitToCalendars(env.id);
const anchored = { ...env, ots: toStampOts(proof) };
// 3. Share — the envelope is self-contained JSON.
console.log(JSON.stringify(anchored, null, 2));
signed_at defaults to now. To set it, pass signedAt as a Date (its
milliseconds are kept) or as a string already in the spec's form,
YYYY-MM-DDTHH:MM:SSZ or YYYY-MM-DDTHH:MM:SS.sssZ, which is used exactly as
given. The id covers signed_at as written, so stamp() never rounds it:
anything else throws E_MALFORMED.
submitToCalendars sends the id to the three default calendars and needs two of
them to answer, as the spec recommends. Pass minSuccesses: 1 to accept one.
signMessage receives the envelope id as a 64-character hex string and must
return a base64 BIP-322 signature of it by address. In a browser,
getSigner('unisat', { address }) from @orangecheck/wallet-adapter returns
one (also xverse, leather, okx, phantom). On a server, signMessage
from @orangecheck/bip322 (1.1 and later) signs with a key you hold, for its
P2WPKH or P2TR address:
import { addressFromPrivateKey, signMessage } from '@orangecheck/bip322';
const key = process.env.STAMP_KEY!; // WIF, 64 hex characters, or 32 bytes
const signer = {
address: addressFromPrivateKey(key, 'p2wpkh'), // or 'p2tr'
signMessage: async (id: string) => signMessage(signer.address, id, key),
};
Pass that signer to stamp() in place of the one above.
A file too big to hold in memoryLink to this section
content also takes the file's hash and size instead of its bytes:
{ hash, length }, where hash is sha256: followed by 64 lowercase hex
characters and length is the size in bytes. A bare hex digest, or uppercase
hex, is rejected with E_MALFORMED. In Node, hash the file as a stream:
import type { StampInput } from '@orangecheck/stamp-core';
import { createHash } from 'node:crypto';
import { createReadStream } from 'node:fs';
import { stat } from 'node:fs/promises';
import { stamp } from '@orangecheck/stamp-core';
declare const signer: StampInput['signer']; // the signer from above
const path = 'release.tar.zst';
const sha = createHash('sha256');
for await (const chunk of createReadStream(path)) sha.update(chunk);
const env = await stamp({
content: {
hash: `sha256:${sha.digest('hex')}`,
length: (await stat(path)).size,
},
mime: 'application/zstd',
signer, // { address, signMessage }, as above
});
The envelope is the one stamp() would make from the bytes. To check the file
later, hash it the same way and compare the result with env.content.hash,
rather than passing the whole file to verify() as content.
VerifyLink to this section
An envelope you receive, from a .stamp file, a Nostr event or a request body,
goes through parseStamp first. It checks every field's shape and type and
returns the envelope typed, or throws StampError with E_MALFORMED (or
E_UNSUPPORTED_VERSION for a newer v). Never cast JSON.parse to
StampEnvelope.
import { verifySignature } from '@orangecheck/bip322';
import { parseStamp, verify } from '@orangecheck/stamp-core';
declare const text: string;
const received = parseStamp(text); // the .stamp file or JSON you were sent
const result = await verify({
envelope: received,
content: new TextEncoder().encode('hello stamp'), // optional; checks bytes match
verifyBip322: async (msg, sig, addr) => verifySignature(addr, msg, sig),
});
if (!result.ok) throw new Error(`${result.code}: ${result.message}`);
console.log('signed by', result.envelope.signer.address); // authorship + content
console.log('anchor:', result.anchor.status); // 'pending' until a block confirms it
verify() calls verifyBip322(message, signatureB64, address), where message
is the envelope id as 64 lowercase hex characters. Note the order:
@orangecheck/bip322's verifySignature takes the address first, hence the
wrapper. Leave verifyBip322 out and verify() fails closed with E_BAD_SIG;
only skipSignatureVerification: true skips the check.
This proves who signed and that the bytes match. Priority needs a confirmed
anchor checked against Bitcoin block headers: upgrade the proof, then pass
verifyOtsAnchor — see OpenTimestamps anchor.
See the envelope format for the wire schema and the full verification algorithm for the seven check steps.
What's nextLink to this section
- Why OC Stamp? — the design rationale and the hypothesis stress tests.
- The spec — normative rules if you're implementing in another language.
- Security model — what OC Stamp proves, what it doesn't, and the trust assumptions.