A Rust implementation of OpenTimestamps, providing provable timestamping using the Bitcoin blockchain. This library has reached feature parity with the Python reference implementation (v0.4.5).
- Parse and serialize
.otstimestamp files - Verify timestamps against Bitcoin block headers
- Stamp files by submitting them to calendar servers
- Upgrade pending timestamps once they are confirmed in the blockchain
- Prune redundant attestation paths, keeping only the best proof
- Merkle tree construction for batching multiple files into a single timestamp
- Embedded Tor support via Arti for private calendar access
- SOCKS5 proxy support for routing through a system Tor instance
Add to your Cargo.toml:
[dependencies]
opentimestamps = "0.4"| Feature | Description |
|---|---|
calendar |
Calendar server client and timestamp upgrade support (enables ureq) |
tor |
Embedded Tor via Arti for anonymous calendar connections |
cli |
Full CLI binary with all features enabled |
use opentimestamps::DetachedTimestampFile;
let bytes = std::fs::read("example.ots").unwrap();
let timestamp = DetachedTimestampFile::from_reader(&bytes[..]).unwrap();
println!("{}", timestamp);use opentimestamps::{DetachedTimestampFile, Timestamp};
use opentimestamps::verify::verify;
use opentimestamps::attestation::Attestation;
let bytes = std::fs::read("example.ots").unwrap();
let dtf = DetachedTimestampFile::from_reader(&bytes[..]).unwrap();
verify(&dtf.timestamp, |attestation, msg| {
// Called for each Bitcoin attestation found in the proof tree.
// Supply a block header lookup to complete verification.
Ok(())
});Build the ots binary with all features:
cargo build --release --features cli-torots info <file.ots> Show timestamp structure
ots stamp <file>... Submit files to calendar servers
ots verify <file.ots> [<file>] Verify a timestamp against Bitcoin
ots upgrade <file.ots> Upgrade a pending timestamp
ots prune <file.ots> Keep only the best attestation path
| Option | Description |
|---|---|
-v / -vv |
Increase verbosity (debug / trace) |
-q / -qq |
Decrease verbosity (warnings / errors only) |
--bitcoin-node <URL> |
Bitcoin Core RPC endpoint (http://user:pass@host:port/) |
--btc-testnet |
Use Bitcoin testnet |
--btc-regtest |
Use Bitcoin regtest |
--no-bitcoin |
Skip Bitcoin node verification |
--cache <DIR> |
Custom timestamp cache directory |
--no-cache |
Disable timestamp cache |
--socks5-proxy <ADDR> |
Route calendar traffic through a SOCKS5 proxy |
--tor |
Use embedded Tor (Arti) for calendar connections |
The MSRV of this project is Rust 1.63.0.
This project is licensed under the terms of the MIT or Apache-2.0 license.