Grant Request: Development of a Gasless RFQ Bitcoin Transaction Library

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)

  1. The backend provides Alice with a list of N resolvers (public keys) and M price points for the auction.

  2. Alice generates N * M unique secrets k_i.

  3. For each k_i, Alice computes h_i = HASH256(k_i).

  4. Alice constructs N * M Taproot Leaf Scripts:

If using dual hashlocks:

  1. Alice adds a timeout refund script:

  1. Alice constructs a Taproot Script Tree from all Leaf Scripts, generating Taproot Root.

  2. Alice creates a PSBT, embedding Taproot Root in scriptPubKey.

  3. Alice signs the PSBT and submits it to the backend along with the full Merkle Tree.

Auction Publication and Resolver Participation

  1. The backend stores the full Merkle Tree and PSBT transaction.

  2. The backend publishes the auction details making the full Merkle Tree available to all participants.

  3. 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)

  1. Bob retrieves Taproot Root.

  2. Bob finds his corresponding Leaf Script in the Merkle Tree.

  3. Bob verifies that his Leaf Script corresponds to Taproot Root.

  4. Bob deploys an escrow in the EVM network when the auction reaches the appropriate price.

  5. Once conditions are met, Bob receives the corresponding k_i only with Bob

Final Execution (Resolver and Maker)

  1. Bob inserts k_i into PSBT and signs it:

  1. 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.

  2. Bob submits the PSBT to the Bitcoin network, unlocking BTC.

  3. k_i becomes publicly available in the Bitcoin blockchain.

  4. 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

3 Likes

likujyht dcc xszaq ftt

ujyhbvfc sdewuio nmklo