pub trait GetBlockTemplateRpc: Sized + Send + Sync + 'static {
Show 14 methods // Required methods fn get_block_count(&self) -> Result<u32>; fn get_block_hash(&self, index: i32) -> BoxFuture<Result<GetBlockHash>>; fn get_block_template( &self, parameters: Option<JsonParameters> ) -> BoxFuture<Result<Response>>; fn submit_block( &self, hex_data: HexData, _parameters: Option<JsonParameters> ) -> BoxFuture<Result<Response>>; fn get_mining_info(&self) -> BoxFuture<Result<Response>>; fn get_network_sol_ps( &self, num_blocks: Option<i32>, height: Option<i32> ) -> BoxFuture<Result<u64>>; fn get_peer_info(&self) -> BoxFuture<Result<Vec<PeerInfo>>>; fn validate_address(&self, address: String) -> BoxFuture<Result<Response>>; fn z_validate_address(&self, address: String) -> BoxFuture<Result<Response>>; fn get_block_subsidy( &self, height: Option<u32> ) -> BoxFuture<Result<BlockSubsidy>>; fn get_difficulty(&self) -> BoxFuture<Result<f64>>; fn z_list_unified_receivers( &self, address: String ) -> BoxFuture<Result<Response>>; // Provided methods fn get_network_hash_ps( &self, num_blocks: Option<i32>, height: Option<i32> ) -> BoxFuture<Result<u64>> { ... } fn to_delegate<M: Metadata>(self) -> IoDelegate<Self, M> { ... }
}
Expand description

getblocktemplate RPC method signatures.

Required Methods§

source

fn get_block_count(&self) -> Result<u32>

Returns the height of the most recent block in the best valid block chain (equivalently, the number of blocks in this chain excluding the genesis block).

zcashd reference: getblockcount method: post tags: blockchain

§Notes

This rpc method is available only if zebra is built with --features getblocktemplate-rpcs.

source

fn get_block_hash(&self, index: i32) -> BoxFuture<Result<GetBlockHash>>

Returns the hash of the block of a given height iff the index argument correspond to a block in the best chain.

zcashd reference: getblockhash method: post tags: blockchain

§Parameters
  • index: (numeric, required, example=1) The block index.
§Notes
  • If index is positive then index = block height.
  • If index is negative then -1 is the last known valid block.
  • This rpc method is available only if zebra is built with --features getblocktemplate-rpcs.
source

fn get_block_template( &self, parameters: Option<JsonParameters> ) -> BoxFuture<Result<Response>>

Returns a block template for mining new Zcash blocks.

§Parameters
  • jsonrequestobject: (string, optional) A JSON object containing arguments.

zcashd reference: getblocktemplate method: post tags: mining

§Notes

Arguments to this RPC are currently ignored. Long polling, block proposals, server lists, and work IDs are not supported.

Miners can make arbitrary changes to blocks, as long as:

  • the data sent to submitblock is a valid Zcash block, and
  • the parent block is a valid block that Zebra already has, or will receive soon.

Zebra verifies blocks in parallel, and keeps recent chains in parallel, so moving between chains and forking chains is very cheap.

This rpc method is available only if zebra is built with --features getblocktemplate-rpcs.

source

fn submit_block( &self, hex_data: HexData, _parameters: Option<JsonParameters> ) -> BoxFuture<Result<Response>>

Submits block to the node to be validated and committed. Returns the submit_block::Response for the operation, as a JSON string.

zcashd reference: submitblock method: post tags: mining

§Parameters
  • hexdata: (string, required)
  • jsonparametersobject: (string, optional) - currently ignored
§Notes
  • jsonparametersobject holds a single field, workid, that must be included in submissions if provided by the server.
source

fn get_mining_info(&self) -> BoxFuture<Result<Response>>

Returns mining-related information.

zcashd reference: getmininginfo method: post tags: mining

source

fn get_network_sol_ps( &self, num_blocks: Option<i32>, height: Option<i32> ) -> BoxFuture<Result<u64>>

Returns the estimated network solutions per second based on the last num_blocks before height.

If num_blocks is not supplied, uses 120 blocks. If it is 0 or -1, uses the difficulty averaging window. If height is not supplied or is -1, uses the tip height.

zcashd reference: getnetworksolps method: post tags: mining

source

fn get_peer_info(&self) -> BoxFuture<Result<Vec<PeerInfo>>>

Returns data about each connected network node.

zcashd reference: getpeerinfo method: post tags: network

source

fn validate_address(&self, address: String) -> BoxFuture<Result<Response>>

Checks if a zcash address is valid. Returns information about the given address if valid.

zcashd reference: validateaddress method: post tags: util

§Parameters
  • address: (string, required) The zcash address to validate.
§Notes
  • No notes
source

fn z_validate_address(&self, address: String) -> BoxFuture<Result<Response>>

Checks if a zcash address is valid. Returns information about the given address if valid.

zcashd reference: z_validateaddress method: post tags: util

§Parameters
  • address: (string, required) The zcash address to validate.
§Notes
  • No notes
source

fn get_block_subsidy( &self, height: Option<u32> ) -> BoxFuture<Result<BlockSubsidy>>

Returns the block subsidy reward of the block at height, taking into account the mining slow start. Returns an error if height is less than the height of the first halving for the current network.

zcashd reference: getblocksubsidy method: post tags: mining

§Parameters
  • height: (numeric, optional, example=1) Can be any valid current or future height.
§Notes

If height is not supplied, uses the tip height.

source

fn get_difficulty(&self) -> BoxFuture<Result<f64>>

Returns the proof-of-work difficulty as a multiple of the minimum difficulty.

zcashd reference: getdifficulty method: post tags: blockchain

source

fn z_list_unified_receivers( &self, address: String ) -> BoxFuture<Result<Response>>

Returns the list of individual payment addresses given a unified address.

zcashd reference: z_listunifiedreceivers method: post tags: wallet

§Parameters
  • address: (string, required) The zcash unified address to get the list from.
§Notes
  • No notes

Provided Methods§

source

fn get_network_hash_ps( &self, num_blocks: Option<i32>, height: Option<i32> ) -> BoxFuture<Result<u64>>

Returns the estimated network solutions per second based on the last num_blocks before height.

This method name is deprecated, use getnetworksolps instead. See that method for details.

zcashd reference: getnetworkhashps method: post tags: mining

source

fn to_delegate<M: Metadata>(self) -> IoDelegate<Self, M>

Create an IoDelegate, wiring rpc calls to the trait methods.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Mempool, State, Tip, BlockVerifierRouter, SyncStatus, AddressBook> GetBlockTemplateRpc for GetBlockTemplateRpcImpl<Mempool, State, Tip, BlockVerifierRouter, SyncStatus, AddressBook>
where Mempool: Service<Request, Response = Response, Error = BoxError> + Clone + Send + Sync + 'static, Mempool::Future: Send, State: Service<ReadRequest, Response = ReadResponse, Error = BoxError> + Clone + Send + Sync + 'static, <State as Service<ReadRequest>>::Future: Send, Tip: ChainTip + Clone + Send + Sync + 'static, BlockVerifierRouter: Service<Request, Response = Hash, Error = BoxError> + Clone + Send + Sync + 'static, <BlockVerifierRouter as Service<Request>>::Future: Send, SyncStatus: ChainSyncStatus + Clone + Send + Sync + 'static, AddressBook: AddressBookPeers + Clone + Send + Sync + 'static,