Remove Node.js hooks, require ots CLI only

- Delete hooks/post-commit-node (local proofs only, no attestation)
- Delete hooks/pre-commit-node (no upgrade support)
- Update hooks/install.sh to require ots CLI (no fallback)
- Update documentation with clear ots CLI requirement
- Add prominent warnings about Node.js limitations

Rationale: The @opentimestamps/ots Node.js package only creates
local proofs without calendar submission or Bitcoin attestation.
For tamper-evident timestamps, ots CLI is the only complete
implementation. No partial/fallback implementations.
This commit is contained in:
Otto 2026-03-08 00:50:32 +01:00
parent b1e305d831
commit b4e2eb3c12
6 changed files with 203 additions and 357 deletions

122
README.md
View file

@ -1,24 +1,25 @@
# Git OpenTimestamp Hook
Automatically generate and manage [OpenTimestamp](https://opentimestamps.org/) proofs for git commits.
Automatically generate [OpenTimestamp](https://opentimestamps.org/) proofs for git commits with full Bitcoin attestation.
## What It Does
## ⚠️ Requirements
- **Post-commit hook**: Creates cryptographic proof for every commit
- **Pre-commit backfill**: Upgrades historical proofs to Bitcoin-attested status
- **Proof chaining**: Links commits together for full history integrity
- **Smart caching**: Minimizes network calls after initial backfill
**Required:** `opentimestamps-client` (ots CLI)
Proofs are stored in `.ots/` and can be versioned alongside your code for tamper-evident history.
```bash
pipx install opentimestamps-client
```
> **Note:** The Node.js `@opentimestamps/ots` package is **not supported** - it only creates local proofs without calendar submission or Bitcoin attestation. For tamper-evident timestamps, you must use the Python `opentimestamps-client`.
## Quick Install
```bash
# Clone or download this skill
# Clone this repository
git clone <repository-url>
cd git-ots-hook
# Install both hooks (auto-detects ots CLI or Node.js)
# Install hooks (requires ots CLI)
./hooks/install.sh /path/to/your/repo
# Commit the proofs
@ -27,102 +28,85 @@ git add .ots/
git commit -m "Add OpenTimestamp proofs"
```
That's it! The hooks are now installed and will automatically timestamp every commit.
That's it! Every commit will now be timestamped and anchored to Bitcoin.
## Manual Installation
### For ots CLI (Recommended)
```bash
# Copy hooks
cp hooks/post-commit-ots .git/hooks/post-commit
cp hooks/pre-commit-ots .git/hooks/pre-commit
chmod +x .git/hooks/post-commit .git/hooks/pre-commit
# Setup .gitignore
echo ".ots/.attestation-cache" >> .gitignore
```
### For Node.js (Local proofs only)
## What You Get
```bash
cp hooks/post-commit-node .git/hooks/post-commit
cp hooks/pre-commit-node .git/hooks/pre-commit
chmod +x .git/hooks/post-commit .git/hooks/pre-commit
```
### Setup .gitignore
```
.ots/.attestation-cache
node_modules/
```
### Commit Initial Proofs
```bash
git add .ots/
git commit -m "Add OpenTimestamp proofs"
```
## Prerequisites
Install the OpenTimestamp client:
```bash
# Recommended: Python CLI
pipx install opentimestamps-client
# Alternative: Node.js package
npm install -g @opentimestamps/ots
```
Verify installation:
```bash
ots --version
```
- **Automatic timestamping** - Every commit gets a cryptographic proof
- **Bitcoin attestation** - Proofs anchored to Bitcoin blockchain (~10 min)
- **Full history** - Backfill hook upgrades all historical commits
- **Smart caching** - Minimal network overhead after initial setup
- **Tamper-evident** - Anyone can verify your commit history
## Generated Files
```
repo/
├── .ots/
│ ├── <commit-hash>.ots # Individual proof per commit
│ ├── proof.ots # Latest commit proof
│ ├── prev-commit.txt # Previous commit reference
│ ├── commit-chain.txt # Full commit chain
│ └── .attestation-cache # Local cache (gitignore this)
│ ├── <commit-hash>.ots # Individual proof (commit this)
│ ├── proof.ots # Latest proof (commit this)
│ ├── prev-commit.txt # Chain link (commit this)
│ ├── commit-chain.txt # Full chain (commit this)
│ └── .attestation-cache # Local cache (ignore this)
└── ...
```
## Verification
Verify a proof:
**Check a proof:**
```bash
ots info .ots/<commit-hash>.ots
```
**Verify attestation:**
```bash
ots verify .ots/<commit-hash>.ots
```
Check attestation status:
**Upgrade pending proofs:**
```bash
./scripts/check-attestation.sh .ots/<commit-hash>.ots
# Output: "attested" or "pending"
ots upgrade .ots/<commit-hash>.ots
```
## How It Works
1. **Commit created** → Post-commit hook runs
2. **Proof generated**`ots stamp` creates `.ots` file
3. **Submitted to calendars** → 4+ remote calendars receive hash
4. **Bitcoin anchoring** → Calendars batch and anchor to Bitcoin (~10 min)
5. **Attestation** → Proof becomes fully verifiable against Bitcoin blockchain
1. You make a git commit
2. Post-commit hook extracts commit hash
3. Hash submitted to 4+ remote calendar servers
4. Calendars aggregate and anchor to Bitcoin
5. After ~10 min: proof becomes Bitcoin-attested
6. Pre-commit hook upgrades old proofs before new commits
## Performance
- **First backfill**: 30-60s (scans history, contacts calendars)
- **Subsequent commits**: 10-15s (cached status skips redundant calls)
- **Cache**: 1-hour validity, 10-min recheck for pending proofs
- **First backfill:** 30-60s (full history scan)
- **Normal commits:** 10-15s (cached, minimal network)
- **Attestation:** ~10 min (Bitcoin block time)
## License
## Uninstall
MIT
```bash
rm .git/hooks/post-commit .git/hooks/pre-commit
```
## Links
- [OpenTimestamp](https://opentimestamps.org/)
- [ots Client](https://github.com/opentimestamps/opentimestamps-client)
- [opentimestamps-client](https://github.com/opentimestamps/opentimestamps-client)
- [Bitcoin anchoring explained](https://petertodd.org/2016/opentimestamps-announcement)
## License
MIT