This repository was archived by the owner on Jun 1, 2026. It is now read-only.
implement btc/bch/zcash signing in rust#1143
Open
0xh3rman wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements signing support for Bitcoin, Bitcoin Cash, Litecoin, Dogecoin, and Zcash, introducing a new BitcoinChainSigner and a transaction planner with fee estimation. The review feedback identifies critical performance improvements, such as precomputing sighash components to prevent O(N^2) complexity and optimizing the use of cryptographic contexts. Additionally, the reviewer recommends implementing dust threshold checks for transaction amounts and utilizing standard library abstractions for address parsing to enhance code reliability and maintainability.
ddf7c26 to
a5ebee4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bitcoin Signer Test Matrix
Scope:
corebranchbitcoin-signer— migration of Bitcoin/BCH/Litecoin/Doge/Zcash signing from Trust Wallet Core tocrates/gem_bitcoin::signer.Goal: prove on real networks that signatures verify, fees are sensible, and change/dust handling never loses funds. Unit tests in
gem_bitcoincover preimage shape and byte-exact vectors; this matrix covers what only mainnet/testnet can confirm.Transfer Matrix
sign_bitcoin_like+UtxoPlanner::Exact9f71a30b…) 2 in → 2 out (payment + change), 208 vB, fee 418 sat (~2 sat/vB)UtxoPlanner::Maxb99c4551…) 1-in, LTC (009a0abc…) 1-in, BTC (5072b15a…) 3-in. All 1 output, no changetry_build_planno-change branch (spend.rs:144-152)op_return_output+spend_outputssign_bitcoin_likelegacy pathb99c4551…) D8g1MD… → DL8fYJ…, 191 vB, fee 0.0193 DOGEbitcoin_cash::sign_plan(BIP143 + 0x41)7360dbab…) 192 B, fee 1,920 sat (~10 sat/B)zcash::sign_transparentZIP-244 v509cc92df…) v5, 240 B, fee 10,000 zat (ZIP-317 min, 2 actions). Mempool-accepted → sighash verifies at consensus levelUtxoPlanner::Max+ ZIP-317 feee5d68d6b…) block 3,351,057, v5, 2 in → 1 out, no change, 355 B, fee 10,000 zat (ZIP-317 floor)Swap Matrix
SpendRequest::swapTransfertest_sign_swap_memo_op_returncovers the pathuse_max_amount7360dbab…confirmed at block 952,079 + intent1JSnFERGiXnamsvNCPNQapoFpa1sU61S5N— NEAR indexer pending SOL creditSpendRequest::swapContract (request.rs:42-58)5519a6b5…) confirmed on Bitcoin but rejected by Chainflip CFE — only 2 outputs (deposit + OP_RETURN), missing mandatory 3rd output that Chainflip uses as refund address. Fix: forceis_max=falsefor Contract data type inrequest.rs; tests updated to require 3-output structure. Pending re-test