2 releases

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

#112 in #across

Download history 86/week @ 2024-08-30 80/week @ 2024-09-06 84/week @ 2024-09-13 94/week @ 2024-09-20 70/week @ 2024-09-27 24/week @ 2024-10-04 58/week @ 2024-10-11 56/week @ 2024-10-18 42/week @ 2024-10-25 88/week @ 2024-11-01 11/week @ 2024-11-08 51/week @ 2024-11-15 61/week @ 2024-11-22 122/week @ 2024-11-29 142/week @ 2024-12-06 91/week @ 2024-12-13

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

MIT license

2MB
7K 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

~98MB
~877K SLoC