2 releases

0.1.16-alpha.0 Apr 2, 2023
0.1.12-alpha.0 Jan 19, 2023

#80 in #across

Download history 134/week @ 2023-12-17 135/week @ 2023-12-24 55/week @ 2023-12-31 80/week @ 2024-01-07 120/week @ 2024-01-14 68/week @ 2024-01-21 40/week @ 2024-01-28 68/week @ 2024-02-04 79/week @ 2024-02-11 112/week @ 2024-02-18 113/week @ 2024-02-25 94/week @ 2024-03-03 127/week @ 2024-03-10 120/week @ 2024-03-17 171/week @ 2024-03-24 201/week @ 2024-03-31

622 downloads per month
Used in 48 crates (12 directly)

MIT license

2.5MB
8K SLoC

Rust Crate Description for bitcoinrpc-util

Short Description

bitcoinrpc-util is a Rust crate that provides utility functions and data structures used across various components of the Bitcoin system.

Long Description

bitcoinrpc-util is an essential component of the Bitcoin system that provides a set of utility functions and data structures for various components of the Bitcoin system. It is a Rust crate that provides useful tools for handling and processing Bitcoin addresses, keys, and transactions. The crate contains a set of data structures and functions that can be used to construct, encode, and decode Bitcoin transactions, keys, and addresses. Additionally, the crate provides functions for parsing and validating input parameters for various RPC commands.

Some of the functions provided by this crate include parse_descriptor_range, which is used to parse descriptor ranges, addr_to_pub_key, which is used to convert a Bitcoin address to a public key, hex_to_pub_key, which is used to convert a hexadecimal string to a public key, rpc_type_check, which is used to check the type of RPC arguments, and eval_descriptor_string_or_object, which is used to evaluate descriptor strings or objects.

This crate also contains various data structures and types, such as RPCArg, RPCArgList, RPCResult, RPCExamples, Section, Sections, Type, RPCMethodImpl, RPCHelpMan, and RPCResults. These data structures and types are used to facilitate the handling and processing of various input and output parameters for RPC commands.

Overall, bitcoinrpc-util is an essential component of the Bitcoin system, providing a set of utility functions and data structures that are used across various components of the system.

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.

121> could you teach me more about the interface?

Certainly! The bitcoinrpc-util crate provides various utility functions and types that are used across different components of the Bitcoin system. Here are some of the important parts of the interface:

  • RPCArg and RPCArgList: These are helper types used for defining arguments and argument lists for RPC methods. They allow you to specify the name, data type, and default value of an argument, as well as whether the argument is optional or not.

  • RPCResult: This is a helper type used for defining the return value of an RPC method. It allows you to specify the data type of the return value, as well as any error codes and messages that should be returned in case of an error.

  • RPCMethodImpl: This is a trait that defines the interface for implementing an RPC method. It requires you to define the method's name, arguments, return value, and implementation code.

  • RPCExamples: This is a helper type used for defining examples of how to use an RPC method, both as a command-line invocation and as an RPC request.

  • RPCHelpMan: This is a helper type used for defining the help message for an RPC method. It allows you to specify the method's name, arguments, description, examples, and other details that may be helpful for users.

There are also various utility functions provided by this crate, such as describe_address, which returns a description of a Bitcoin address, and hex_to_pub_key, which converts a hexadecimal string to a public key. These functions are used by other components of the Bitcoin system to perform common tasks.

Overall, the bitcoinrpc-util crate provides a useful set of tools and functions that can be used across different components of the Bitcoin system, making it easier to develop and maintain the system as a whole.

Dependencies

~97MB
~824K SLoC