forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 7
[WIP] Add BLSCT Raw Transaction and Balance Proof RPC Methods #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
gogoex
previously approved these changes
Jul 12, 2025
Collaborator
gogoex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read the high-level implementation of the newly added commands. If I'm not misunderstanding, specific_vout != -1 one should be fixed. Other ones are all minor.
The merge-base changed after approval.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add BLSCT Raw Transaction and Balance Proof RPC Methods
Summary
This PR adds six new RPC methods for handling BLSCT raw transactions and balance proofs, which are needed for BasicSwap integration; providing a complete workflow for creating, funding, signing, and decoding BLSCT transactions, as well as creating and verifying zero-knowledge balance proofs.
Also adds the getblsctrecoverydata RPC method for extracting recovery data from BLSCT transaction outputs.
New RPC Methods
BLSCT Raw Transaction Methods
1.
createblsctrawtransactionCreates an unsigned BLSCT transaction from specified inputs and outputs.
Parameters:
inputs(array): Array of input objects withtxid,vout, and optional fieldsoutputs(array): Array of output objects withaddress,amount, and optional fieldsReturns: Hex-encoded unsigned transaction
2.
fundblsctrawtransactionAdds inputs to a BLSCT transaction until it has enough value to cover outputs and fee.
Parameters:
hexstring(string): The hex string of the raw transactionchangeaddress(string, optional): The BLSCT address to receive changeReturns: Hex-encoded funded transaction
3.
signblsctrawtransactionSigns a BLSCT raw transaction by adding BLSCT signatures.
Parameters:
hexstring(string): The transaction hex stringReturns: Hex-encoded signed transaction
4.
decodeblsctrawtransactionDecodes a BLSCT raw transaction and returns a JSON object describing the transaction structure.
Parameters:
hexstring(string): The transaction hex stringReturns: JSON object with inputs, outputs, and fee information
BLSCT Balance Proof Methods
5.
createblsctbalanceproofCreates a zero-knowledge proof that the wallet has at least the specified balance.
Parameters:
amount(amount): The minimum balance to proveReturns: JSON object with serialized balance proof
6.
verifyblsctbalanceproofVerifies a zero-knowledge balance proof.
Parameters:
proof(string): The serialized balance proof (hex string)Returns: JSON object with validation result and minimum amount proven
BLSCT Recovery Data Methods
7.
getblsctrecoverydataCreates a zero-knowledge proof that the wallet has at least the specified balance.
Parameters:
txid_or_hex: The transaction id or raw transaction hexvout(optional): The output index. If omitted, shows data for all outputs.Returns: JSON object with the recovery data
Key Features
Testing
Added comprehensive functional tests in
test/functional/blsct_rawtransaction.pycovering:Usage Examples
Technical Details
blsct::UnsignedTransactionclass for transaction handlingOP_BLSCHECKSIG Opcode Support
Added support for the
OP_BLSCHECKSIGopcode, enabling BLS signature verification in transaction scripts:OP_BLSCHECKSIGfor BLS signature verificationTransactionSignatureCheckerto handle BLS signatures, which works as a collector and delegates the verification logic toblsct::VerifyTx.Technical implementation:
OP_BLSCHECKSIGcase insrc/script/interpreter.cppCheckBlsSignaturemethod inGenericTransactionSignatureCheckersrc/blsct/wallet/verification.cppto properly handle BLS signature verificationsrc/test/blsct_signature_checker_tests.cpp