Overview
This proposal outlines the development of a library for handling gasless, trust-minimized RFQ (Request for Quote) transactions between Bitcoin and Ethereum. The core functionality includes partially signed Bitcoin transactions (PSBT), Merkle-based participant authentication, and integration with Ethereum smart contracts to facilitate an efficient cross-chain swap mechanism.
Key Features
PSBT Generation: The library will create Bitcoin PSBT transactions for cross-chain transfers.
Taproot-Based Authorization: Only whitelisted participants (determined via Taproot Script Tree) can finalize transactions.
Support for Single and Dual Hashlock Mechanisms: Offers flexibility based on security needs.
Timeout and Refund Mechanisms: Enables secure fallback in case of failed execution.
Transaction Flow
Auction Generation (Maker, Alice)
-
The backend provides Alice with a list of N resolvers (public keys) and M price points for the auction.
-
Alice generates N * M unique secrets k_i.
-
For each k_i, Alice computes h_i = HASH256(k_i).
-
Alice constructs N * M Taproot Leaf Scripts:
If using dual hashlocks:
- Alice adds a timeout refund script:
-
Alice constructs a Taproot Script Tree from all Leaf Scripts, generating Taproot Root.
-
Alice creates a PSBT, embedding Taproot Root in scriptPubKey.
-
Alice signs the PSBT and submits it to the backend along with the full Merkle Tree.
Auction Publication and Resolver Participation
-
The backend stores the full Merkle Tree and PSBT transaction.
-
The backend publishes the auction details making the full Merkle Tree available to all participants.
-
Resolvers receive the auction data, including Taproot Root, and able to compute their Merkle Proof from the public Merkle Tree.
Winner Selection and Escrow Deployment (Resolver, Bob)
-
Bob retrieves Taproot Root.
-
Bob finds his corresponding Leaf Script in the Merkle Tree.
-
Bob verifies that his Leaf Script corresponds to Taproot Root.
-
Bob deploys an escrow in the EVM network when the auction reaches the appropriate price.
-
Once conditions are met, Bob receives the corresponding k_i only with Bob
Final Execution (Resolver and Maker)
- Bob inserts k_i into PSBT and signs it:
-
Bitcoin verifies:
a. Merkle Proof confirms that Leaf Script belongs to Taproot Root.
b. OP_CHECKSIG validates Bob’s signature.
c. H(k_i) == h_i ensures secret correctness.
-
Bob submits the PSBT to the Bitcoin network, unlocking BTC.
-
k_i becomes publicly available in the Bitcoin blockchain.
-
Alice reads k_i from Bitcoin and uses it in the Ethereum contract to claim her ETH.
Taproot-Based Authorization
Tree Construction: Each resolver and price point has a unique Taproot Leaf Script.
Merkle Tree Formation: A Merkle tree is constructed from all Leaf Scripts, producing a Taproot Root.
PSBT Inclusion: Taproot Root is embedded in the scriptPubKey of the Bitcoin transaction.
Resolver Validation: Each resolver can independently verify its participation by computing the Merkle Proof for their Leaf Script.
Security Comparison
Single Hashlock
Gas Cost - Lower
Security - Basic
Complexity - Simple
Trust Required - Medium
Atomic Guarantee - Partial
Dual Hashlock
Gas Cost -Higher
Security - Enhanced
Complexity - More Complex
Trust Required - None
Atomic Guarantee - Full
Development Roadmap
Milestone 1: Research
Deliverables: Test Merkle proof verification & gather additional requirements.
Duration: 1 week
Milestone 2: PSBT Transaction Library
Deliverables: Develop Bitcoin transaction handling
Duration: 3 weeks
Milestone 3: Testing & Documentation
Deliverables: Final testing & provide developer guide
Duration: 1 week
Considerations
Total Costs: $65 000



