pub trait GetBlockTemplateRpcServer:
Sized
+ Send
+ Sync
+ 'static {
Show 15 methods
// Required methods
fn get_block_count(&self) -> Result<u32>;
fn get_block_hash<'life0, 'async_trait>(
&'life0 self,
index: i32,
) -> Pin<Box<dyn Future<Output = Result<GetBlockHash>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_block_template<'life0, 'async_trait>(
&'life0 self,
parameters: Option<JsonParameters>,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn submit_block<'life0, 'async_trait>(
&'life0 self,
hex_data: HexData,
_parameters: Option<JsonParameters>,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_mining_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_network_sol_ps<'life0, 'async_trait>(
&'life0 self,
num_blocks: Option<i32>,
height: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_peer_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn validate_address<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn z_validate_address<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_block_subsidy<'life0, 'async_trait>(
&'life0 self,
height: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<BlockSubsidy>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_difficulty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<f64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn z_list_unified_receivers<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn generate<'life0, 'async_trait>(
&'life0 self,
num_blocks: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<GetBlockHash>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn get_network_hash_ps<'life0, 'async_trait>(
&'life0 self,
num_blocks: Option<i32>,
height: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn into_rpc(self) -> RpcModule<Self> { ... }
}
Expand description
Server trait implementation for the GetBlockTemplateRpc
RPC API.
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<'life0, 'async_trait>(
&'life0 self,
index: i32,
) -> Pin<Box<dyn Future<Output = Result<GetBlockHash>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block_hash<'life0, 'async_trait>(
&'life0 self,
index: i32,
) -> Pin<Box<dyn Future<Output = Result<GetBlockHash>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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<'life0, 'async_trait>(
&'life0 self,
parameters: Option<JsonParameters>,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block_template<'life0, 'async_trait>(
&'life0 self,
parameters: Option<JsonParameters>,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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<'life0, 'async_trait>(
&'life0 self,
hex_data: HexData,
_parameters: Option<JsonParameters>,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn submit_block<'life0, 'async_trait>(
&'life0 self,
hex_data: HexData,
_parameters: Option<JsonParameters>,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_mining_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns mining-related information.
zcashd reference: getmininginfo
method: post
tags: mining
sourcefn get_network_sol_ps<'life0, 'async_trait>(
&'life0 self,
num_blocks: Option<i32>,
height: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_network_sol_ps<'life0, 'async_trait>(
&'life0 self,
num_blocks: Option<i32>,
height: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_peer_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns data about each connected network node.
zcashd reference: getpeerinfo
method: post
tags: network
sourcefn validate_address<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn validate_address<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn z_validate_address<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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<'life0, 'async_trait>(
&'life0 self,
height: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<BlockSubsidy>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block_subsidy<'life0, 'async_trait>(
&'life0 self,
height: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<BlockSubsidy>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<f64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_difficulty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<f64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn z_list_unified_receivers<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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§
sourcefn get_network_hash_ps<'life0, 'async_trait>(
&'life0 self,
num_blocks: Option<i32>,
height: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_network_hash_ps<'life0, 'async_trait>(
&'life0 self,
num_blocks: Option<i32>,
height: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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