Derive locally
Generate hot and recovery keys, a unique preimage r and its hash H(r) in your signer. Send public keys and the hash only.
OPS
All operations ↗
DEVELOPER REFERENCE / BITCOIN
Build a defensive Bitcoin vault from public inputs, prepare unsigned spends, and verify a post-quantum anchor against a key your application already trusts.
Reference implementation in source. No hosted PQ Shield API or production readiness is claimed.
The Rust HTTP service exists and can be run locally. Its Bitcoin vault and Bloch anchor components are foundational and unaudited for production use. This page describes an API contract, not a live hosted endpoint.
01 / SYSTEM MODEL
PQ Shield builds a P2WSH deposit and delayed trigger output on unmodified Bitcoin. A client or watchtower can prepare a recovery spend while the normal branch waits for its relative timelock.
Generate hot and recovery keys, a unique preimage r and its hash H(r) in your signer. Send public keys and the hash only.
The API returns P2WSH scripts, addresses, unsigned Bitcoin transactions and BIP-143 sighashes.
Your signer assembles witnesses. Your PQ key signs the anchor commitment on your device.
Your node or watchtower watches the trigger and submits a clawback to a fresh safe address when required.
Bitcoin script enforces its hashlock and branch delay. Without a Bitcoin covenant, the deposit-to-trigger policy also depends on pre-signed transaction handling and secure deletion of any bypass key.
02 / HTTP CONTRACT
Run the separate native service locally. JSON fields named like a mnemonic, seed, private key, WIF or preimage are rejected with HTTP 400. Bitcoin public keys must be 33-byte compressed secp256k1 keys.
Exact route paths, public request fields, unsigned response artifacts and error shape. The only server listed is your local process; importing this file does not connect to a hosted API.
cd services/pq-shield-api
cargo run
curl http://127.0.0.1:8787/health/vault/addressBuild deposit and trigger P2WSH addresses and witness scripts from public keys, H(r) and a CSV delay.
/vault/unvault-txReturn an unsigned deposit → trigger transaction, hot-key sighash and trigger output details.
UNSIGNED TX/vault/branch-a-txPrepare the delayed trigger → destination spend and its hot-key sighash.
CSV-DELAYED/vault/clawback-txPrepare the immediate recovery-key spend to a fresh, anchored safe destination.
UNSIGNED TX/anchor/commitmentReturn canonical anchor bytes for client-side PQ signing and Bloch guard hashes.
SIGN LOCALLY/anchor/verifyVerify a signature against a required trusted_pq_pubkey obtained outside the supplied anchor.
RUN LOCALLY / REGTEST
This contains only public test inputs. The recovery hash is a demonstration value; derive a unique real H(r) in your own signer for each vault.
Save the client and offline test beside each other, then run node --test pq-shield-client.test.mjs without a service. For the live regtest examples, start the Rust API on loopback and run node client-workflow.mjs or node client-routes-check.mjs. The client validates response shapes and rejects secret-shaped request fields; these checks do not independently verify Bitcoin transaction bytes or PQ signatures. The scripts use dummy outpoints and never sign or broadcast. A valid signature requires a separately enrolled client-side PQ signer. The older single-route example and contract check remain available.
curl -sS http://127.0.0.1:8787/vault/address \
-H 'Content-Type: application/json' \
-d '{
"network": "regtest",
"hot_pubkey": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
"recovery_pubkey": "02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5",
"recovery_hash": "5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a",
"csv_delay": 144
}'PUBLIC-INPUT CONTRACT
The API returns construction artifacts. A local signer must validate every address, amount, outpoint and sighash before signing. None of these routes broadcasts a transaction.
/vault/addressnetwork is bitcoin, testnet, signet or regtest. Supply compressed hot_pubkey and recovery_pubkey, a 32-byte SHA-256 recovery_hash, and csv_delay as a 16-bit integer. Keep its preimage private.
/vault/*-txRepeat public vault parameters under vault. Provide the relevant deposit_outpoint or trigger_outpoint (txid and vout), input amount in satoshis, destination and fee_sat. The response includes unsigned_tx_hex and a signer-specific sighash_hex.
/anchor/commitmentSupply target chain, deposit address, recovery hash, PQ public key, designated safe destination, delay and policy. Sign only the returned commitment_bytes_hex in your own signer. A target-chain label is metadata; it does not deploy an adapter or change that chain's rules.
/anchor/verifySupply a signed anchor and trusted_pq_pubkey obtained independently through an authenticated registration. Compare the returned valid and reason; never treat the key carried inside the anchor as its own trust root.
For machine-readable payloads and response fields, download the OpenAPI contract; the service README explains the flow. The example deliberately stops before funding, signing or broadcasting.
03 / SECURITY BOUNDARY
A valid anchor signature matters only when your application already knows which PQ public key belongs to the owner. The anchor's own key cannot authenticate itself.
Keep Bitcoin hot and recovery private keys, the PQ secret key and preimage r in your signer. Use a dedicated hardened derivation branch for new vault keys.
/anchor/verify requires trusted_pq_pubkey from registration or another authenticated channel.
Recovery relies on detection and a successful transaction race before the delayed branch matures.
Bitcoin still validates classical signatures. An external PQ anchor does not make native Bitcoin assets unconditionally quantum secure.
The crate and service have no independent production security qualification. Bloch-side PQ enforcement is not consensus-wired. Bitcoin covenant limits, exposed or reused keys, offline monitoring and preimage fee races remain material risks.
04 / INTEGRATION PATH
Only the Bitcoin construction and anchor verification API described above are implemented here. Chain names accepted by the anchor format do not mean vaults or adapters exist on those chains.
Local Rust service with public-input construction, unsigned transaction preparation and anchor verification.
Independent review, adversarial tests, watchtower operations, signer integration and a deployment contract.
Managed access, versioned policies, authenticated calls and operational reporting after qualification.
Separate threat models and chain-specific spend enforcement. No cross-chain vault deployment is represented here.
BUILD FROM THE IMPLEMENTATION
Review the route contract and honest limits, then run the reference service in an isolated environment.
Open implementation ↗