Skip to content

BIP340 reference project

BIP340 specifies 64-byte Schnorr signatures over secp256k1. This reference project encodes BIP340 verification as a Longfellow circuit and keeps the application module outside the base library.

Module layout

  • bip340_witness.h constructs the private and derived witness values.
  • bip340_verify.h defines the verification relation.
  • bip340_guard.h checks guarded conditions used by the circuit.
  • bip340_test.cc covers the installed project target.

Consume the package

cmake
find_package(LongfellowZK CONFIG REQUIRED)
find_package(LongfellowZKBIP340 CONFIG REQUIRED)
target_link_libraries(app PRIVATE LongfellowZKBIP340::bip340)

Like ECDSA, BIP340 is currently an interface library. Its public headers are compiled by the consuming C++20 project.

What this reference establishes

The project provides a concrete circuit, witness model, installable CMake target, and test boundary for BIP340 verification. It does not implement the Bitcoin consensus rules surrounding Taproot, transaction validation, wallet policy, multisignatures, or key management.