Skip to content

chainwayxyz/BitVM

 
 

Repository files navigation

BitVM Bridge: A Trust-minimized Bitcoin Bridge

License: MIT

Warning

DO NOT USE IN PRODUCTION!

The official implementation of BitVM2, running a SNARK verifier.

The code follows the implementation of Arkworks

Overview

The repository contains the implementation of a groth16 SNARK verifier that is executable via the optimistic BitVM paradigm on Bitcoin without any soft forks.

It is designed to be modular, allowing developers to reuse bitcoin scripts for u32 data types, hashes and curve operations.

Components

BitVM is composed of several components. Below is a list of the components and their purpose.

  • u32 Operations: Basic arithmetic operations of u32 for hash functions, including add, sub, or, xor, rotation, shift.

  • u4 Operations: u4 version arithmetic operations, providing a more efficient way to construct hashes.

  • Hash Functions: Two types of hash functions:

    • SHA256: comparing block headers and measuring Bitcoin difficulty.
    • BLAKE3: compressing intermediate states in the chunker.
  • Big Integer: Variable-length big integer operations, including of add, sub, mul, div, inverse and other operations.

  • BN254: Point expression of BN254 elliptic curves and operations based on BN254, including addition, multiplication, pairing. The pairing part is related to the "Algorithm 9" in the paper "On Proving Pairings"

  • Groth16: Groth16 uses BN254 to verify proof, the script is currently around 1 GB. Some hints are precomputed in this part, which is related to the paper "On Proving Pairings".

  • Chunker: Splits Groth16 into chunks. These chunks make sure two principles:

    1. Any chunks shouldn't be success with a right proof.
    2. There are always some successful chunks with a wrong proof.
  • Signatures: Bit commitment using Winternitz signature.

  • Bridge: Definitions for the context (roles), connectors, Bitcoin transaction construction, Bitcoin client wrapper, etc.

BitVM1

If you are looking for the deprectated BitVM1 implementation, please check out BitVM1.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.9%
  • Shell 0.1%