2 releases
0.1.16-alpha.0 | Apr 2, 2023 |
---|---|
0.1.12-alpha.0 | Mar 4, 2023 |
#7 in #previous
2MB
7.5K
SLoC
bitcoinrpc-txn
This Rust crate is a translation of the
bitcoin-txn
component of the Bitcoin system. It
provides functions related to creating, analyzing,
decoding, and signing Bitcoin transactions.
Notice: This crate is part of a direct translation from C++ to Rust of the bitcoin core. As such, some of the function bodies may still be in the process of translation. Please note that this system will become testable once the translation process is complete.
The following mathematical ideas are associated with the tokens in this crate:
-
construct_transaction
: This function is used to construct a Bitcoin transaction, which is a set of inputs and outputs that transfer Bitcoin between addresses. The inputs to a transaction are unspent outputs from previous transactions, and the outputs specify the destination addresses and amounts to be transferred. The mathematical idea behind transactions is the concept of a digital signature scheme, which allows a user to prove that they are the owner of a particular Bitcoin address and authorize the transfer of funds from that address. -
sign_transaction
: This function is used to sign a Bitcoin transaction with a private key associated with one of the inputs. The mathematical idea behind digital signatures is the use of elliptic curve cryptography to create a pair of keys, a private key and a public key, which are used to sign and verify transactions respectively. The signature is a mathematical proof that the owner of the private key authorized the transaction. -
parse_prevouts
: This function parses the previous transaction outputs (prevouts) from a serialized Bitcoin transaction. The mathematical idea behind prevouts is the concept of a transaction input, which refers to an unspent output from a previous transaction. The prevout contains information about the transaction output being spent, including its amount and the scriptPubKey that controls the funds. -
tx_tojson
: This function converts a Bitcoin transaction to a JSON format. The mathematical idea behind this function is the use of a standard data format to represent the transaction, which allows it to be easily transmitted and processed by different software systems.
Other functions in this crate, such as
analyzepsbt
, combinepsbt
, getrawtransaction
,
and verifytxoutproof
, are used for analyzing,
decoding, and verifying Bitcoin transactions, and
do not have direct mathematical ideas associated
with them.
118> which RPC endpoints are associated with this subsystem?
The following RPC endpoints are associated with
the bitcoinrpc-txn
subsystem:
analyzepsbt
combinepsbt
combinerawtransaction
converttopsbt
createpsbt
createrawtransaction
decodepsbt
decoderawtransaction
decodescript
finalizepsbt
getrawtransaction
gettxoutproof
joinpsbts
sendrawtransaction
signrawtransactionwithkey
testmempoolaccept
utxoupdatepsbt
verifytxoutproof
These endpoints allow the user to create, analyze, and modify transactions in various ways, such as constructing raw transactions, signing transactions, and verifying transaction proofs.
119> what do these do? could you describe them in more detail?
Sure! Here is a brief description of each of the
RPC endpoints associated with the bitcoinrpc-txn
subsystem:
-
analyzepsbt
: Analyzes and provides information about a partially signed Bitcoin transaction. -
combinepsbt
: Combines multiple partially signed Bitcoin transactions into one. -
combinerawtransaction
: Combines multiple raw transactions into one. -
converttopsbt
: Converts a raw transaction to a partially signed Bitcoin transaction. -
createpsbt
: Creates a partially signed Bitcoin transaction. -
createrawtransaction
: Creates a raw Bitcoin transaction. -
decodepsbt
: Decodes a partially signed Bitcoin transaction. -
decoderawtransaction
: Decodes a raw Bitcoin transaction. -
decodescript
: Decodes a Bitcoin script. -
finalizepsbt
: Finalizes a partially signed Bitcoin transaction. -
getrawtransaction
: Returns a raw Bitcoin transaction. -
gettxoutproof
: Returns a proof that a transaction is included in a block. -
joinpsbts
: Joins multiple partially signed Bitcoin transactions into one. -
sendrawtransaction
: Submits a raw Bitcoin transaction to the network. -
signrawtransactionwithkey
: Signs a raw Bitcoin transaction with a private key. -
testmempoolaccept
: Tests acceptance of a raw transaction in the mempool. -
utxoupdatepsbt
: Updates a partially signed Bitcoin transaction with UTXO information. -
verifytxoutproof
: Verifies that a proof is a valid proof of a transaction being included in a block. -
construct_transaction
: Constructs a Bitcoin transaction given a set of inputs and outputs. -
parse_prevouts
: Parses the previous outputs referenced by a Bitcoin transaction. -
sign_transaction
: Signs a Bitcoin transaction with a set of private keys. -
sign_transaction_result_tojson
: Converts the result of asign_transaction
call to a JSON object. -
tx_in_error_tojson
: Converts a transaction input error to a JSON object.
These RPC endpoints allow for a wide range of operations related to constructing, analyzing, decoding, and signing Bitcoin transactions.
Dependencies
~108MB
~1M SLoC