Module methods

Source
Expand description

Zebra supported RPC methods.

Based on the zcashd RPC methods as used by lightwalletd.

Some parts of the zcashd RPC documentation are outdated. So this implementation follows the zcashd server and lightwalletd client implementations.

§Developing this module

If RPCs are added or changed, ensure the following:

  • Request types can be instantiated from dependent crates, and response types are fully-readable (up to each leaf component), meaning every field on response types can be read, and any types used in response types has an appropriate API for either directly accessing their fields, or has an appropriate API for accessing any relevant data.

    This should be achieved, wherever possible, by:

    • Using derive(Getters, new) to keep new code succinct and consistent. Ensure that fields on response types that implement Copy are tagged with #[getter(copy)] field attributes to avoid unnecessary references. This should be easily noticeable in the serialization_tests test crate, where any fields implementing Copy but not tagged with #[getter(Copy)] will be returned by reference, and will require dereferencing with the dereference operator, *. If a value returned by a getter method requires dereferencing, the associated field in the response type should likely be tagged with #[getter(Copy)].
    • If a field is added, use #[new(...)] so that it’s not added to the constructor. If that is unavoidable, then it will require a major version bump.
  • A test has been added to the serialization_tests test crate to ensure the above.

Re-exports§

pub use self::GetInfoResponse as GetInfo;
pub use self::GetAddressBalanceResponse as AddressBalance;
pub use self::SendRawTransactionResponse as SentTransactionHash;
pub use self::GetBlockResponse as GetBlock;
pub use self::GetBlockHeaderResponse as GetBlockHeader;
pub use BlockHeaderObject as GetBlockHeaderObject;
pub use self::GetBlockHashResponse as GetBlockHash;
pub use GetBlockHeightAndHashResponse as GetBestBlockHeightAndHash;
pub use self::GetRawTransactionResponse as GetRawTransaction;
pub use self::Utxo as GetAddressUtxos;

Modules§

arrayhex
A helper module to serialize and deserialize [u8; N] as a hex string.
opthex
A helper module to serialize and deserialize Option<T: ToHex> as a hex string.

Structs§

AddressStrings
A wrapper type with a list of transparent address strings.
BlockHeaderObject
Verbose response to a getblockheader RPC request.
BlockObject
A Block object returned by the getblock RPC request.
ConsensusBranchIdHex
A hex-encoded ConsensusBranchId string.
GetAddressBalanceResponse
The transparent balance of a set of addresses.
GetAddressTxIdsRequest
A struct to use as parameter of the getaddresstxids.
GetBlockHashResponse
Response to a getbestblockhash and getblockhash RPC request.
GetBlockHeightAndHashResponse
Response to a getbestblockheightandhash RPC request.
GetBlockTrees
Information about the sapling and orchard note commitment trees if any.
GetBlockchainInfoResponse
Response to a getblockchaininfo RPC request.
GetInfoResponse
Response to a getinfo RPC request.
NetworkUpgradeInfo
Information about NetworkUpgrade activation.
OrchardTrees
Orchard note commitment tree information.
RpcImpl
RPC method implementations.
SaplingTrees
Sapling note commitment tree information.
SendRawTransactionResponse
Response to a sendrawtransaction RPC request.
TipConsensusBranch
The ConsensusBranchIds for the tip and the next block.
Utxo
A UTXO returned by the getaddressutxos RPC request.

Enums§

AddNodeCommand
Commands for the addnode RPC method.
GetBlockHeaderResponse
Response to a getblockheader RPC request.
GetBlockResponse
Response to a getblock RPC request.
GetBlockTransaction
The transaction list in a getblock call. Can be a list of transaction IDs or the full transaction details depending on verbosity.
GetRawTransactionResponse
Response to a getrawtransaction RPC request.
NetworkUpgradeStatus
The activation status of a NetworkUpgrade.

Traits§

RpcServer
Server trait implementation for the Rpc RPC API.

Functions§

best_chain_tip_height
Returns the best chain tip height of latest_chain_tip, or an RPC error if there are no blocks in the state.
chain_tip_difficulty
Returns the proof-of-work difficulty as a multiple of the minimum difficulty.
height_from_signed_int
Given a potentially negative index, find the corresponding Height.

Type Aliases§

GetAddressBalanceRequest
A request to get the transparent balance of a set of addresses.
GetAddressUtxosResponse
Response to a getaddressutxos RPC request.
Hash
A block hash used by this crate that encodes as hex by default.
LoggedLastEvent
A type alias for the last event logged by the server.