Skip to content

BlockstreamResearch/shrincs-simplicity-verifier

Repository files navigation

SHRINCS Simplicity Verifier

This repo contains hash-based signatures that can protect Bitcoin against quantum computers

⚠️ This project is a work in progress and is provided as-is for research, learning, and experimentation. It is not production-ready and has not undergone a formal security audit, code review, or verification process. This library may be incorrect, incomplete, or insecure.

🛠 Requirements

We use #include and #define directives, so you may need to install mcpp:

brew install mcpp

Important

Currently, this project requires the bundled ./simfony binary due to upstream incompatibilities in simfony-cli. This will be updated once the upstream issues are resolved.

🔐 Signatures

Signature Scheme File Path Description
Lamport lamport.simf Lamport one-time signature implementation.
WOTS wots.simf Winternitz One-Time Signature implementation.
SHRINCS shrincs/shrincs.simf SHRINCS implementation. C++. 📖 Read docs

Note: Each signature contains method X_verify (where X is the scheme name) that verifies the validity of the signature for the corresponding message hash and public key

🧪 Running tests

  • make test - runs all tests

  • make lamport_example - runs Lamport verification example

  • make shrincs_example MODE={stateful|stateless} - runs SHRINCS verification example

    • Use MODE=stateful for XMSS-based stateful trees or MODE=stateless for SPHINCS-like stateless verification.

🚀 Usage

To execute this code, import the required signature file using #include directive and then run:

mkdir -p target
mcpp -P -I . your-file.simf -o target/your-file.simf

To run the preprocessed file, run:

./simfony run --witness your-witness.wit target/your-file.simf

💻 Code example

#include "./shrincs/shrincs.simf"

fn main() {
    let message: u256 = ...;
    let pk: (u128, u128) = ...;
    let signature: Either<UXMSSSignature, SPHINCSSignature> = ...;
    let known_pk_part: u128 = ...;

    shrincs_verify((message, pk, signature, known_pk_part));
}

🧩 Type Definitions: Wondering how UXMSSSignature or SPHINCSSignature are structured under the hood? Check out the full type definitions in types.simf.

📂 More Examples: For complete, runnable code including witness data setup, explore the examples/ directory.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors