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 implementCopyare tagged with#[getter(copy)]field attributes to avoid unnecessary references. This should be easily noticeable in theserialization_teststest crate, where any fields implementingCopybut 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.
- Using
-
A test has been added to the
serialization_teststest 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. - hex_
data π - Deserializes hex-encoded inputs such as the one required
for the
submitblockRPC method. - opthex
- A helper module to serialize and deserialize
Option<T: ToHex>as a hex string. - trees π
- Types and functions for note commitment tree RPCs.
- types π
- Types used in RPC methods.
StructsΒ§
- Block
Header Object - Verbose response to a
getblockheaderRPC request. - Block
Object - A Block object returned by the
getblockRPC request. - Consensus
Branch IdHex - A hex-encoded
ConsensusBranchIdstring. - GetAddress
Balance Request - A request for
RpcServer::get_address_balance. - GetAddress
Balance Response - The transparent balance of a set of addresses.
- GetAddress
TxIds Request - Parameters of
RpcServer::get_address_tx_idsRPC method. - GetAddress
Utxos Request - Parameters of
RpcServer::get_address_utxosRPC method. - GetAddress
Utxos Response Object - Response to a
getaddressutxosRPC request, whenchainInfois true. - GetBlock
Hash Response - Response to a
getbestblockhashandgetblockhashRPC request. - GetBlock
Height AndHash Response - Response to a
getbestblockheightandhashRPC request. - GetBlock
Trees - Information about the sapling and orchard note commitment trees if any.
- GetBlockchain
Info Response - Response to a
getblockchaininfoRPC request. - GetInfo
Response - Response to a
getinfoRPC request. - GetTx
OutResponse - Response to a
gettxoutRPC request. - Network
Upgrade Info - Information about
NetworkUpgradeactivation. - Orchard
Trees - Orchard note commitment tree information.
- RpcImpl
- RPC method implementations.
- Sapling
Trees - Sapling note commitment tree information.
- Send
RawTransaction Response - Response to a
sendrawtransactionRPC request. - TipConsensus
Branch - The
ConsensusBranchIds for the tip and the next block. - Utxo
- A UTXO returned by the
getaddressutxosRPC request.
EnumsΒ§
- AddNode
Command - Commands for the
addnodeRPC method. - DGet
Address πBalance Request - An intermediate type used to deserialize
AddressStrings. - DGet
Address πTxIds Request - An intermediate type used to deserialize
GetAddressTxIdsRequest. - DGet
Address πUtxos Request - An intermediate type used to deserialize
GetAddressUtxosRequest. - GetAddress
Utxos Response - Response to a
getaddressutxosRPC request. - GetBlock
Header Response - Response to a
getblockheaderRPC request. - GetBlock
Response - Response to a
getblockRPC request. - GetBlock
Transaction - The transaction list in a
getblockcall. Can be a list of transaction IDs or the full transaction details depending on verbosity. - GetRaw
Transaction Response - Response to a
getrawtransactionRPC request. - Network
Upgrade Status - The activation status of a
NetworkUpgrade.
ConstantsΒ§
- PARAM_
ADDRESS_ πDESC - PARAM_
ADDRESS_ πSTRINGS_ DESC - PARAM_
ADDR_ πDESC - PARAM_
BLOCK_ πHASH_ DESC - PARAM_
COMMAND_ πDESC - PARAM_
HASH_ πOR_ HEIGHT_ DESC - PARAM_
HEIGHT_ πDESC - PARAM_
HEX_ πDATA_ DESC - PARAM_
INCLUDE_ πMEMPOOL_ DESC - PARAM_
INDEX_ πDESC - PARAM_
LIMIT_ πDESC - PARAM_
NUM_ πBLOCKS_ DESC - PARAM_
N_ πDESC - PARAM_
PARAMETERS_ πDESC - PARAM_
POOL_ πDESC - PARAM_
RAW_ πTRANSACTION_ HEX_ DESC - PARAM_
REQUEST_ πDESC - PARAM_
START_ πINDEX_ DESC - PARAM_
TXID_ πDESC - PARAM_
VERBOSE_ πDESC - PARAM_
VERBOSITY_ πDESC - PARAM__
ALLOW_ πHIGH_ FEES_ DESC - PARAM__
PARAMETERS_ πDESC
StaticsΒ§
- METHODS
- Lookup table for JSON-RPC methods.
TraitsΒ§
- RpcServer
- Server trait implementation for the
RpcRPC API. - Validate
Addresses - A collection of validatable addresses
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. - build_
height_ πrange - Build a valid height range from the given optional start and end numbers.
- 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Β§
- Address
Strings Deprecated - A request to get the transparent balance of a set of addresses.
- Blockchain
Value Pool Balances - Type alias for the array of
GetBlockchainInfoBalanceobjects - Hash
- A block hash used by this crate that encodes as hex by default.
- Logged
Last Event - A type alias for the last event logged by the server.