Bitcoin SPV Prover SDK #8570
Alex-distributed-lab
started this conversation in
[NRG#4] Developer Tools
Replies: 2 comments 2 replies
-
I have a question: the link to https://github.com/distributed-lab/spv-contracts is not working. Is it a Solidity contract as you mention Ethereum? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This proposal outlines the development of a Bitcoin Simplified Payment Verification (SPV) prover implemented in the Noir language. This tool will enable developers to generate sophisticated proofs concerning the Bitcoin blockchain, with the long-term objective of establishing comprehensive Bitcoin-type definitions, data structures, and ecosystem components within the Noir environment.
Rationale
We want to extend the Noir language ecosystem with robust mechanisms for facilitating interoperability between EVM and Bitcoin-like networks. Our first step included developing the SPV contract, which collects and verifies Bitcoin block headers, manages reorganization, etc. The biggest problem with the naive SPV contract is the operating cost. Having a single block header verification ~$1.7 (on Ethereum, as of May 19th) and around 900,000 blocks in Bitcoin, we can calculate the cost of full synchronization >$1.5m. So, an initial idea included covering the majority of verifications with a recursive proof and launching SPV from the n-th block.
Then we came up with the idea of creating a library for the Noir that covers some additional points and provides an opportunity to build a bunch of practical things, like:
Furthermore, this initiative will introduce standardized libraries for Bitcoin entities, including types, algorithms, and data structures, to the Noir toolchain.
Methodology
The implementation will proceed in three phases.
Phase 1: Simple History Validation
This phase involves verifying block hash integrity, confirming the equality of the previous hash field in a block header with the preceding block's hash, and validating difficulty adjustments based on block height.
Two approaches are proposed:
Phase 2: Validation of Output Expenditure and Preimage Knowledge
Building upon the established historical validation and implementation of Merkle trees with double SHA256 hashing, verification of transaction inclusion within a block's Merkle root becomes feasible. This extends validation to full blocks with transactions and allows users to demonstrate the existence of a transaction within a particular block. This is particularly useful for verifying the spending of Bitcoin outputs.
Additionally, this phase involves proving knowledge of expenditure conditions for P2WSH, P2SH, and P2TR outputs. For P2WSH and P2SH, this entails proving knowledge of the SHA256 preimage. P2TR requires the implementation of “tagged” SHA256 hashes within the Merkle Tree, which is achievable.
Phase 3: Validation of Output Witness Fulfillment
While previous phases focus on validating preimages, hash computations, and value derivations, the Noir language enables more advanced functionality, specifically validating Bitcoin Script Interpreter execution. This permits demonstrating knowledge of a script witness that executes successfully, combined with a script from an existing transaction.
Phase 4: (Future Development) Comprehensive Chain Verification with Double Spending Detection
In the future, we may also prove that double spending is impossible without a Bitcoin node, but this could be unachievable soon (we need to dedicate more time to researching this direction).
Timeline and Deliverables
What Noir has and what else needs to be implemented
Team
Distributed Lab
[email protected]
Start Date
26.05.25
Beta Was this translation helpful? Give feedback.
All reactions