Struct bitcoin_rpc::BitcoinRpc [−][src]
pub struct BitcoinRpc { /* fields omitted */ }
A Handle to a Bitcoin JSON-RPC connection
Methods
impl BitcoinRpc
[src]
impl BitcoinRpc
pub fn new(url: String, user: Option<String>, pass: Option<String>) -> Self
[src]
pub fn new(url: String, user: Option<String>, pass: Option<String>) -> Self
Creates a client to a bitcoind JSON-RPC server.
pub fn getblockcount(&self) -> RpcResult<u64>
[src]
pub fn getblockcount(&self) -> RpcResult<u64>
Returns the numbers of block in the longest chain.
pub fn getbestblockhash(&self) -> RpcResult<String>
[src]
pub fn getbestblockhash(&self) -> RpcResult<String>
Returns the hash of the best (tip) block in the longest blockchain.
pub fn waitfornewblock(&self, timeout: u64) -> RpcResult<BlockRef>
[src]
pub fn waitfornewblock(&self, timeout: u64) -> RpcResult<BlockRef>
Waits for a specific new block and returns useful info about it. Returns the current block on timeout or exit.
Arguments
timeout
: Time in milliseconds to wait for a response. 0 indicates no timeout.
pub fn waitforblock(
&self,
blockhash: String,
timeout: u64
) -> RpcResult<BlockRef>
[src]
pub fn waitforblock(
&self,
blockhash: String,
timeout: u64
) -> RpcResult<BlockRef>
Waits for a specific new block and returns useful info about it. Returns the current block on timeout or exit.
Arguments
blockhash
: Block hash to wait for.timeout
: Time in milliseconds to wait for a response. 0 indicates no timeout.
pub fn getblockchaininfo(&self) -> RpcResult<BlockchainInfo>
[src]
pub fn getblockchaininfo(&self) -> RpcResult<BlockchainInfo>
Returns a data structure containing various state info regarding blockchain processing.
pub fn estimatesmartfee<E>(
&self,
conf_target: u16,
estimate_mode: E
) -> Result<EstimateSmartFee, Error> where
E: Into<Option<EstimateMode>>,
[src]
pub fn estimatesmartfee<E>(
&self,
conf_target: u16,
estimate_mode: E
) -> Result<EstimateSmartFee, Error> where
E: Into<Option<EstimateMode>>,
pub fn getconnectioncount(&self) -> RpcResult<u64>
[src]
pub fn getconnectioncount(&self) -> RpcResult<u64>
Returns the number of connections to other nodes.
pub fn ping(&self) -> RpcResult<()>
[src]
pub fn ping(&self) -> RpcResult<()>
Requests that a ping be sent to all other nodes, to measure ping time.
Results provided in getpeerinfo
, pingtime
and pingwait
fields
are decimal seconds.
Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.
pub fn getpeerinfo(&self) -> RpcResult<Vec<PeerInfo>>
[src]
pub fn getpeerinfo(&self) -> RpcResult<Vec<PeerInfo>>
Returns data about each connected network node as an array of
PeerInfo
pub fn addnode(&self, node: &str, commnad: AddNode) -> RpcResult<()>
[src]
pub fn addnode(&self, node: &str, commnad: AddNode) -> RpcResult<()>
Attempts to add or remove a node from the addnode list.
Or try a connection to a node once.
Nodes added using addnode
(or -connect
) are protected from DoS
disconnection and are not required to be full nodes/support SegWit
as other outbound peers are (though such peers will not be synced
from).
Arguments:
node
: The node (seegetpeerinfo
for nodes)command
:AddNode::Add
to add a node to the list,AddNode::Remove
to remove a node from the list,AddNode::OneTry
to try a connection to the node once
pub fn getnetworkinfo(&self) -> RpcResult<NetworkInfo>
[src]
pub fn getnetworkinfo(&self) -> RpcResult<NetworkInfo>
Auto Trait Implementations
impl Send for BitcoinRpc
impl Send for BitcoinRpc
impl Sync for BitcoinRpc
impl Sync for BitcoinRpc