Quick Start
Everything in this repository is working code. There are no placeholders, no “coming soon” sections, no hand-waving. The contracts are deployed on Soroban testnet. The tests pass. Start here and have something running in under 5 minutes.Prerequisites
Install the following before proceeding:Clone the Repository
Run All Tests
Soroban contracts (Rust)
bitcoin-spv, zk-verifier, commitment-tree, and private-lend.
Relayer service (TypeScript)
Bitcoin script toolkit (TypeScript)
ZK circuits (Circom + snarkjs)
All together: 268 tests, all passing.
Build the Contracts
contracts/target/wasm32v1-none/release/:
bitcoin_spv.wasm— 28.4 KBzk_verifier.wasm— 11.8 KBcommitment_tree.wasm— ~38 KBprivate_lend.wasm— 23.7 KB
Use the Testnet Deployments
All four contracts are live on Soroban testnet. You can call them directly without deploying:Run the Full ZK End-to-End Flow
This script runs the complete deposit → borrow → repay cycle on Soroban testnet using the deployed contracts. It generates real ZK proofs and submits them on-chain.- Initializes the commitment-tree contract with a USDC pool
- Supplies 1,000 USDC to the pool
- Generates a Groth16 deposit proof (circom WASM)
- Submits the SPV proof + ZK proof → commitment created on-chain
- Inserts the commitment into the Merkle tree (Poseidon root updated)
- Generates a Groth16 borrow proof (150% collateral ratio enforced)
- Submits the borrow → 200 XLM transferred from pool
- Generates a Groth16 repay proof (field-negation amount recovery)
- Submits the repay → debt cleared
Run the Bitcoin P2WSH End-to-End
This script tests the Bitcoin locking and release flow on Bitcoin Signet. No funds required for a dry run.- Generate a unique P2WSH address
- Send Signet BTC to the address
- Build the Path A co-signed release transaction
- Sign with both user and protocol keys (PSBT round-trip)
- Broadcast to Bitcoin Signet
Deploy Your Own Contracts
If you want to deploy fresh contract instances to testnet:contracts/deployments/testnet.md for the full init sequence and verified transaction hashes.
Repository Layout for Developers
Next: Bitcoin SPV SDK →