2 releases

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

#90 in #across

Download history 99/week @ 2024-03-11 122/week @ 2024-03-18 206/week @ 2024-03-25 200/week @ 2024-04-01 87/week @ 2024-04-08 118/week @ 2024-04-15 124/week @ 2024-04-22 113/week @ 2024-04-29 140/week @ 2024-05-06 119/week @ 2024-05-13 114/week @ 2024-05-20 76/week @ 2024-05-27 92/week @ 2024-06-03 90/week @ 2024-06-10 102/week @ 2024-06-17 126/week @ 2024-06-24

410 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

~97MB
~850K SLoC