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 implementCopy
are tagged with#[getter(copy)]
field attributes to avoid unnecessary references. This should be easily noticeable in theserialization_tests
test crate, where any fields implementingCopy
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.
- Using
-
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§
- Address
Strings - A wrapper type with a list of transparent address strings.
- Block
Header Object - Verbose response to a
getblockheader
RPC request. - Block
Object - A Block object returned by the
getblock
RPC request. - Consensus
Branch IdHex - A hex-encoded
ConsensusBranchId
string. - GetAddress
Balance Response - The transparent balance of a set of addresses.
- GetAddress
TxIds Request - A struct to use as parameter of the
getaddresstxids
. - GetBlock
Hash Response - Response to a
getbestblockhash
andgetblockhash
RPC request. - GetBlock
Height AndHash Response - Response to a
getbestblockheightandhash
RPC request. - GetBlock
Trees - Information about the sapling and orchard note commitment trees if any.
- GetBlockchain
Info Response - Response to a
getblockchaininfo
RPC request. - GetInfo
Response - Response to a
getinfo
RPC request. - Network
Upgrade Info - Information about
NetworkUpgrade
activation. - Orchard
Trees - Orchard note commitment tree information.
- RpcImpl
- RPC method implementations.
- Sapling
Trees - Sapling note commitment tree information.
- Send
RawTransaction Response - Response to a
sendrawtransaction
RPC request. - TipConsensus
Branch - The
ConsensusBranchId
s for the tip and the next block. - Utxo
- A UTXO returned by the
getaddressutxos
RPC request.
Enums§
- AddNode
Command - Commands for the
addnode
RPC method. - GetBlock
Header Response - Response to a
getblockheader
RPC request. - GetBlock
Response - Response to a
getblock
RPC request. - GetBlock
Transaction - The transaction list in a
getblock
call. Can be a list of transaction IDs or the full transaction details depending on verbosity. - GetRaw
Transaction Response - Response to a
getrawtransaction
RPC request. - Network
Upgrade Status - 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§
- GetAddress
Balance Request - A request to get the transparent balance of a set of addresses.
- GetAddress
Utxos Response - Response to a
getaddressutxos
RPC request. - 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.