2 releases
0.1.16-alpha.0 | Apr 2, 2023 |
---|---|
0.1.12-alpha.0 | Mar 4, 2023 |
#59 in #descriptor
2.5MB
10K
SLoC
bitcoinrpc-dump crate description
The bitcoinrpc-dump
crate is a direct
translation from C++ to Rust of the Bitcoin core
dump
module, which provides functionality for
importing, exporting, and manipulating data
related to the Bitcoin blockchain and wallets.
The crate includes various functions such as
dumpprivkey
, dumpwallet
, importaddress
,
importprivkey
, importwallet
,
listdescriptors
, removeprunedfunds
, and
rescan_wallet
, among others. These functions
enable importing and exporting data related to
Bitcoin transactions, keys, and addresses, as well
as rescanning wallet transactions and performing
descriptor imports.
In addition, the crate also includes functions for
processing imported data, such as
process_import
, process_import_descriptor
, and
process_import_legacy
, and for recursively
importing data, such as recurse_import_data
.
No mathematical ideas are associated with the tokens in this crate.
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.
106> could you describe these RPC functions and why we want to call them?
Sure! Here's a brief description of each of the
RPC functions in the bitcoinrpc-dump
crate:
-
abortrescan
: This RPC function aborts a wallet rescan that was previously started with therescan_wallet
function. It can be useful if the rescan is taking too long or if there is an error that needs to be addressed. -
and
: This function performs a logical AND operation on two boolean values and returns the result. While this function isn't specific to Bitcoin, it can be useful for implementing more complex logic in a script or application that interacts with the Bitcoin network. -
are
: This function is a utility function that checks whether all of the given boolean values are true. It can be useful for checking the status of multiple conditions before proceeding with a certain action. -
decode_dump_string
: This function decodes a hex-encoded dump string (as generated by thedumpprivkey
,dumpwallet
, orgetdescriptorinfo
functions) and returns the decoded data. -
dumpprivkey
: This function returns the private key associated with a Bitcoin address in WIF (Wallet Import Format) encoding. -
dumpwallet
: This function generates a dump of the wallet's private keys in a human-readable format. It can be useful for backing up the wallet or exporting the private keys for use with a different wallet. -
encode_dump_string
: This function encodes data as a hex-encoded dump string (as used by thedumpprivkey
,dumpwallet
, andgetdescriptorinfo
functions). -
get_import_timestamp
: This function returns the Unix timestamp when an address or script was added to the wallet using theimportaddress
,importmulti
,importprivkey
, orimportpubkey
functions. -
get_wallet_addresses_for_key
: This function returns a list of Bitcoin addresses associated with a private key. It can be useful for identifying all addresses that are at risk if a private key is compromised. -
importaddress
: This function adds a Bitcoin address to the wallet without its private key. This can be useful for tracking the balance of a watch-only address. -
importdescriptors
: This function imports a list of descriptors into the wallet. A descriptor is a concise representation of a set of output scripts that the wallet should be able to spend. This function can be useful for importing descriptors generated by external tools. -
importmulti
: This function imports a list of addresses or public keys into the wallet, along with any associated metadata. It can be used to add multiple addresses or keys at once. -
importprivkey
: This function adds a private key to the wallet. It can be useful for importing keys generated by external tools or for restoring a backup of the wallet. -
importprunedfunds
: This function imports a UTXO set from a pruned node. It can be useful for recovering funds from a node that has been pruned. -
importpubkey
: This function adds a public key to the wallet. It can be useful for tracking the balance of a watch-only address. -
importwallet
: This function imports a wallet dump generated by thedumpwallet
function. -
listdescriptors
: This function returns a list of all descriptors in the wallet. -
process_descriptor_import
: This function processes a single descriptor for import into the wallet. -
process_import
: This function processes a single address or public key for import into the wallet. -
process_import_descriptor
: This function processes a single descriptor for import into the wallet. -
process_import_legacy
: This function processes a single address or public key for import into the wallet. -
recurse_import_data
: This function is a utility function that recursively processes data
107> are there any others?
Yes, there are many other RPC functions in Bitcoin Core. Here are a few more examples:
-
getbalance
: returns the total balance of the wallet. -
getnewaddress
: generates a new address for receiving payments. -
sendtoaddress
: sends a specified amount of bitcoins to a given address. -
gettransaction
: retrieves information about a specific transaction by its ID. -
listunspent
: lists all unspent transaction outputs (UTXOs) in the wallet. -
createrawtransaction
: creates a new raw transaction that can be signed and broadcasted to the network. -
signrawtransactionwithwallet
: signs a raw transaction with the private keys stored in the wallet. -
sendrawtransaction
: broadcasts a signed transaction to the network. -
getmininginfo
: returns information about the current state of mining on the network, including the current block height and difficulty. -
getnetworkinfo
: returns information about the network, including the number of connected nodes and the current network hash rate.
These are just a few examples, and there are many other RPC functions available in Bitcoin Core for interacting with the network and managing the wallet.
108> I meant in this crate
My apologies for misunderstanding your question earlier.
In the bitcoinrpc-dump
crate, there are several
other RPC functions available besides the ones
I previously mentioned. Here are brief
descriptions of some of them:
-
abortrescan
: Stop current wallet rescan triggered by an RPCimportaddress
orimportpubkey
command. -
and
: Compute bitwiseAND
between each bit of two integers. -
are
: Test whether all arguments are non-zero. -
get_import_timestamp
: Returns the timestamp of the most recent wallet import. -
get_wallet_addresses_for_key
: Returns all addresses for a specified private key or list of private keys. -
listdescriptors
: Lists all available wallet descriptors. -
process_import_descriptor
: Import a descriptor with or without a range specified for the number of keys to derive. -
process_import_legacy
: Import using an old-style Bitcoin address or script. -
recurse_import_data
: Recursively import all files in a directory. -
removeprunedfunds
: Deletes specified transactions from the wallet that are pruned or contain pruned inputs. -
rescan_wallet
: Rescan the wallet for transactions that affect its balances.
These functions are used for various purposes such as importing private keys, importing descriptors, rescanning the wallet, and deleting transactions from the wallet.
Dependencies
~108MB
~1M SLoC