BIP-322 signing
Every orangecheck sibling signs the canonical message via BIP-322 (opens in a new tab) ("Generic Signed Message Format"). This page explains why that specific scheme, what wallets support it, and how to validate a signature in the two reference languages.
Why BIP-322 specificallyLink to this section
The older scheme — Bitcoin Core's legacy signmessage RPC, circa 2012 — only
works for P2PKH addresses (1… on mainnet, m…/n… on testnet). It doesn't
handle SegWit (bc1q…), Taproot (bc1p…), or P2SH wrappers.
BIP-322 fixes this: it specifies a signing scheme that works for every standard script type, including the ones you'll actually see in 2026 wallets. It does this by building a virtual "to-sign" transaction that spends a virtual "to-spend" transaction, and signing the to-sign with the key that controls the address.
If BIP-322 hadn't existed, orangecheck would have had to invent something like it. Since it does exist and has real wallet support, we use it.
What the wallet signsLink to this section
The wallet signs the byte-exact canonical message (see canonical message). The wallet does not sign a hash of the message, does not strip whitespace, does not trim trailing newlines — it signs the raw bytes you pass it.
This is critical: any canonicalization or trimming the wallet does would cause the signature to validate against different bytes than the verifier uses when recomputing the attestation ID, and the whole chain breaks.
What the verifier acceptsLink to this section
What @orangecheck/bip322 1.1.2 accepts, measured by
signing and verifying rather than by reading its code:
| Address | BIP-322 simple | simple with smp | BIP-322 full (ful) | Legacy signmessage (BIP-137) |
|---|---|---|---|---|
P2WPKH (bc1q…) | accepted | accepted | refused | accepted |
P2TR (bc1p…, one key) | accepted | accepted | refused | accepted |
P2SH-P2WPKH (3…) | accepted | accepted | refused | accepted |
P2PKH (1…) | refused | refused | refused | accepted |
Uppercase bech32 (BC1Q…) | refused | refused | refused | refused |
- Legacy signatures. A 65-byte
signmessagesignature passes for any of these address types when the key it recovers is the address's own: its hash for P2PKH, P2WPKH and P2SH-P2WPKH, its BIP-86 output key for P2TR. The header's address-type flag is not checked, so a wallet that signs a SegWit address with the P2PKH flags passes the same as one that uses BIP-137's SegWit flags. That is how Electrum signs; no Electrum version has been run against it. - The
smpprefix. The finalized BIP-322 prefixes a simple signature withsmp. A verifier needs@orangecheck/bip3221.1.0 or later to accept it; older verifiers, andbip322-js, refuse it.signMessageleaves the prefix off unless asked. - Full and proof-of-funds signatures (
ful,pof) are refused unread, so a wallet that produces only those cannot sign on the family's sites. - Uppercase addresses. Verification reads bech32 only in lowercase, so one
key never has two addresses. QR codes carry bech32 in capitals: pass what a
person types or scans through
normalizeAddress()(normalize_address()in Python 2.5.0), which lowercases an all-capitals address, trims whitespace and returnsnullfor mixed case or anything that is not an address.
Wallet support matrixLink to this section
| Wallet | Type | BIP-322 support |
|---|---|---|
| UniSat (opens in a new tab) | browser extension | Yes, all address types |
| Xverse (opens in a new tab) | browser + mobile | Yes, all address types |
| Leather (opens in a new tab) | browser | Yes, all address types |
| Alby (opens in a new tab) | browser | No. WebLN signs with a Lightning node key, not a Bitcoin address |
| Sparrow (opens in a new tab) | desktop | Yes, via "Sign message" (right-click an address) |
| Bitcoin Core (opens in a new tab) | desktop + CLI | Partial. BIP-322 for P2WPKH / P2TR via signmessage, version-dependent |
| Electrum (opens in a new tab) | desktop | Yes, through its legacy signmessage signature (see above) |
| Hardware wallets (Coldcard / Trezor / Ledger) | HW | Partial, via a PSBT flow. Not one-click signing |
If your wallet isn't on the list, the canonical test is: does signing a message
produce an output that
@orangecheck/bip322 (opens in a new tab)
accepts? If yes, it works.
Error: sig_unsupported_scriptLink to this section
From @orangecheck/sdk 1.16.0 this code means one thing: the wallet made a
BIP-322 full or proof-of-funds signature (ful, pof), which no verifier here
reads. Sign with a BIP-322 simple signature, or with legacy message signing,
which every address type in the table accepts. The signature's bytes decide the
scheme, never the address: a 65-byte signature that verifies is sig_ok_legacy
on any address type, and a BIP-137 signature from the wrong key is
sig_invalid.
Before 1.16.0 the same code meant a legacy signature on a SegWit address, and whether a 3… address got it depended on the signature's recovery id.
Verifying a BIP-322 signatureLink to this section
TypeScriptLink to this section
import { normalizeAddress, verifySignature } from '@orangecheck/bip322';
declare const typed: string; // the address as the person entered it
declare const canonicalMsg: string;
declare const signatureBase64: string;
const address = normalizeAddress(typed); // BC1Q… from a QR code becomes bc1q…; null if not an address
if (!address) throw new Error('Not a Bitcoin address');
const valid = verifySignature(
address, // bc1q... or bc1p... or 3... or 1...
canonicalMsg, // exact bytes the wallet signed
signatureBase64
); // true | false, never throws
@orangecheck/bip322 is built only on @noble/curves, @noble/hashes and
@scure/base, with no bitcoinjs-lib underneath. @orangecheck/sdk ≥ 1.12 uses
it. bip322-js stopped verifying on a fresh install once bitcoinjs-lib 6.1.9
tightened PSBT extraction.
PythonLink to this section
from orangecheck import normalize_address, verify_bip322_signature
def is_valid(typed: str, canonical_msg: str, signature_base64: str) -> bool:
address = normalize_address(typed) # None if not an address
if address is None:
raise ValueError("Not a Bitcoin address")
return verify_bip322_signature(address, canonical_msg, signature_base64)
The Python SDK bridges the Rust-backed
bip322 (opens in a new tab) package, which in turn wraps
bitcoin + secp256k1 — the same audited crates the Rust Bitcoin ecosystem
runs on. Install the verification path with:
pip install 'orangecheck[verify]'
Signatures are base64, not hexLink to this section
Every reference SDK accepts base64-encoded BIP-322 "simple" signatures. Some wallets hand you hex by default; convert to base64 before passing it to the verifier. The TypeScript SDK auto-detects hex and converts; the Python SDK is strict.
See alsoLink to this section
- Canonical message — what the wallet signs
- OC Attest — verification — the full verification algorithm
@orangecheck/wallet-adapter— onegetSigner(wallet, { address })API across UniSat / Xverse / Leather / OKX / Phantom