
btcnotar
io.github.yordank/btcnotar
Free Bitcoin timestamps: notarize texts and files, verify proofs. Only hashes are sent.
Documentation
๐ BTCNotar
Bitcoin Notarization Library
Batch document hashes into a Merkle tree, anchor the root on Bitcoin via OP_RETURN โ automatically, once a day โ and get back proofs verifiable against the live chain
๐ฆ Repository layout
packages/btcnotarโ the npm library. Install it withnpm install btcnotar. See its README for the full API.packages/btcnotar-mcpโ MCP server for AI agents (Claude, Cursor, VS Code):npx -y btcnotar-mcp. See its README.packages/pythonโ the Python client (pip install btcnotar, no dependencies). Same proof format. See its README.specโ the format specification and test vectors for versions in other languages.examples/webappโ a demo Express app using the library: a paid single-hash instant anchor (via Lightning), plus the library's automatic daily batch notarization wired up as a set of/api/notary/*endpoints.
๐ Use case: every git commit on Bitcoin
This repository notarizes its own commits. The GitHub Action .github/workflows/notarize-commits.yml runs scripts/notarize-commits.mjs: for each commit it sends sha256(git cat-file commit <sha>) to the free server, and every hour it saves the proof files on the branch btcnotar-proofs.
# check a commit yourself (only the blockchain is needed)
git cat-file commit <sha> > commit.bin
npx btcnotar verify-file <sha>.btcnotar.json --doc commit.bin
To use it in your repo: copy the script and the workflow file, push, then run the workflow once by hand (Actions โ notarize commits โ Run workflow) to send the whole history.
๐ง Overview
BTCNotar allows anyone to prove that a document existed at a specific moment in time โ without uploading the document itself.
๐ Only a hash (e.g. SHA-256) is ever sent to the library
๐ Hashes are batched into a Merkle tree; only the root touches the blockchain
๐ Every hash gets a small proof that is independently, unambiguously verifiable against the live chain โ down to the transaction id, block and date
โ๏ธ How batch notarization works
- ๐ฅ App calls
notary.addHash(hash)for each document as it comes in - โฐ Once a day (configurable), the library builds a Merkle tree over everything queued
- โ๏ธ Only the Merkle root is written on-chain, in one
OP_RETURNtransaction - ๐งพ Each hash gets an inclusion proof + the transaction id
- ๐
notary.verify(hash)recomputes the root from the proof and checks it against the actual on-chain transaction โ reporting the block, date and confirmation status
๐ This is fully reversible: with only a document's hash and its proof, anyone can prove whether โ and exactly when, in which transaction and block โ it was anchored, with no need to trust the notary's own records.
โจ Features
- ๐ Installable library (
npm install btcnotar), usable from any Node.js app - ๐ณ Merkle-tree batching โ unlimited hashes per on-chain transaction
- โฐ Automatic scheduled settlement (once a day by default, configurable)
- ๐ Reversible proofs โ cryptographic + live on-chain verification
- ๐ Pluggable storage (in-memory, JSON file, or bring your own DB) and chain provider
- ๐ฅ๏ธ CLI (
btcnotar add/settle/proof/verify) - โก Demo app: single-hash instant anchoring paid via Lightning (Breez SDK)
- ๐ก Broadcast via mempool.space
- ๐งพ No document storage (privacy-first) โ only hashes ever leave your app
๐งฑ Tech Stack
- Node.js (library: zero framework dependency)
- bitcoinjs-lib + tiny-secp256k1
- mempool.space REST API (default chain provider)
- Demo app: Express, Breez SDK (Lightning)
๐ ๏ธ Setup
1. Clone & install (installs both workspaces)
git clone https://github.com/yordank/BTCNotar.git
cd BTCNotar
npm install
2. Use the library directly
npm install btcnotar # in your own project
See packages/btcnotar/README.md for the full API and examples.
3. Or run the demo web app
cp examples/webapp/.env.example examples/webapp/.env
# fill in OPRETURN_WIF_MAINNET, BREEZ_API_KEY, BREEZ_MNEMONIC
npm start
๐ Open: http://localhost:8787
๐ Demo app API
โก Lightning
POST /api/ln/invoice
GET /api/ln/status/:checkingId
GET /api/balance
โ๏ธ Instant single-hash anchor (paid)
POST /api/opreturn { hashHex }
๐ณ Batch notarization (library-backed, settles automatically once a day)
POST /api/notary/hash { hashHex } โ queue a hash
POST /api/notary/settle โ settle the current batch now
GET /api/notary/proof/:hash โ fetch the stored proof
GET /api/notary/verify/:hash โ verify against the live chain
๐ Security (IMPORTANT)
โ ๏ธ Anchoring uses a real Bitcoin private key (WIF), and the demo app additionally uses a Breez (Lightning) mnemonic and API keys.
๐ Never commit .env to GitHub
๐ If exposed โ rotate immediately
๐ Use only hot wallets with small amounts
๐ก Use Cases
- ๐ Document timestamping
- ๐ง Intellectual property protection
- โ๏ธ Legal proof of existence
- ๐ป Source code verification
- ๐งพ Digital evidence anchoring
โ ๏ธ Limitations
- โ Only a hash is stored, never the document
- โ Verification requires recomputing the hash of the original document
- โ Bitcoin fees vary; one settlement pays one fee for the whole batch
- โ Not a legal guarantee by itself (depends on jurisdiction)
๐ Roadmap
โ Done
- Batch anchoring via Merkle tree โ only the root goes on-chain
- Reversible, independently verifiable Merkle proofs
- Automatic scheduled settlement (daily by default)
- Installable library / SDK (
btcnotaron npm) - CLI for add / settle / proof / verify
๐ Next
- Browser-side proof verification widget
- Pluggable database-backed store (Postgres/SQLite) reference implementation
- Webhooks on settlement
- Docker deployment for the demo app
- Rate limiting / multi-tenant support for the demo app
๐ง Vision
A lightweight, open-source Bitcoin notarization layer
Not just a website โ but:
- A library / SDK
- A reference API
- Infrastructure for proof systems
๐ญ Philosophy
- ๐ Minimal on-chain data
- ๐ Maximum verifiability
- ๐ Privacy-first
- ๐งฉ Composable & open
โก Support the project
BTC Notar is free. If you like it, you can send any amount of sats to this Lightning address:
trappedknight861@walletofsatoshi.com
๐ License
MIT
โ ๏ธ Disclaimer
This software is provided for educational purposes.
Use at your own risk.
๐ Always protect your private keys and funds.
No installation packages available.