pub trait GetBlockTemplateRpc:
Sized
+ Send
+ Sync
+ 'static {
Show 15 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>>;
fn generate(&self, num_blocks: u32) -> BoxFuture<Result<Vec<GetBlockHash>>>;
// 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§
sourcefn get_block_count(&self) -> Result<u32>
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
.
sourcefn get_block_hash(&self, index: i32) -> BoxFuture<Result<GetBlockHash>>
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
.
sourcefn get_block_template(
&self,
parameters: Option<JsonParameters>,
) -> BoxFuture<Result<Response>>
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
.
sourcefn submit_block(
&self,
hex_data: HexData,
_parameters: Option<JsonParameters>,
) -> BoxFuture<Result<Response>>
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.
sourcefn get_mining_info(&self) -> BoxFuture<Result<Response>>
fn get_mining_info(&self) -> BoxFuture<Result<Response>>
Returns mining-related information.
zcashd reference: getmininginfo
method: post
tags: mining
sourcefn get_network_sol_ps(
&self,
num_blocks: Option<i32>,
height: Option<i32>,
) -> BoxFuture<Result<u64>>
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
sourcefn get_peer_info(&self) -> BoxFuture<Result<Vec<PeerInfo>>>
fn get_peer_info(&self) -> BoxFuture<Result<Vec<PeerInfo>>>
Returns data about each connected network node.
zcashd reference: getpeerinfo
method: post
tags: network
sourcefn validate_address(&self, address: String) -> BoxFuture<Result<Response>>
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
sourcefn z_validate_address(&self, address: String) -> BoxFuture<Result<Response>>
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
sourcefn get_block_subsidy(
&self,
height: Option<u32>,
) -> BoxFuture<Result<BlockSubsidy>>
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.
sourcefn get_difficulty(&self) -> BoxFuture<Result<f64>>
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
sourcefn z_list_unified_receivers(
&self,
address: String,
) -> BoxFuture<Result<Response>>
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
sourcefn generate(&self, num_blocks: u32) -> BoxFuture<Result<Vec<GetBlockHash>>>
fn generate(&self, num_blocks: u32) -> BoxFuture<Result<Vec<GetBlockHash>>>
Provided Methods§
sourcefn get_network_hash_ps(
&self,
num_blocks: Option<i32>,
height: Option<i32>,
) -> BoxFuture<Result<u64>>
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
sourcefn to_delegate<M: Metadata>(self) -> IoDelegate<Self, M>
fn to_delegate<M: Metadata>(self) -> IoDelegate<Self, M>
Create an IoDelegate
, wiring rpc calls to the trait methods.