public interface DaemonRpcClient
Represents a connection to a Monero P2P daemon.
See newInstance(URI)
to create a new instance.
-
Method Summary
Modifier and TypeMethodDescriptiongetBlock(long height)
Get a block header and the transaction hashes it contains by its height.Get a block header and the transaction hashes it contains by its hash.getBlockAsync(long height)
Asynchronously get a block header and the transaction hashes it contains by its height.getBlockAsync(String hash)
Asynchronously get a block header and the transaction hashes it contains by its hash.long
Look up how many blocks are in the longest chain known to the daemon.Asynchronously look up how many blocks are in the longest chain known to the daemon.getBlockHeader(long height)
Fetch a block's header by its height.getBlockHeader(String hash)
Fetch a block's header by its hash.getBlockHeaderAsync(long height)
Asynchronously fetch a block's header by its height.getBlockHeaderAsync(String hash)
Asynchronously fetch a block's header by its hash.getBlockTemplate(String walletAddress, int reserveSize)
Create a block template.getBlockTemplateAsync(String walletAddress, int reserveSize)
Asynchronously create a block template.static DaemonRpcClient
newInstance(URI address)
Create a new instance of aDaemonRpcClient
void
submitBlock(String blob)
Send a mined block for broadcast to the network.submitBlockAsync(String blob)
Asynchronously send a mined block for broadcast to the network.
-
Method Details
-
newInstance
Create a new instance of aDaemonRpcClient
- Parameters:
address
- address of JSON-RPC endpoint, e.g.URI.create("http://localhost:18081/json_rpc")
- Returns:
- new instance of
DaemonRpcClient
-
getBlock
Get a block header and the transaction hashes it contains by its height.- Parameters:
height
- height of block to look up (0 based)- Returns:
- block containing header and transaction hashes
- See Also:
getBlockAsync(long)
-
getBlockAsync
Asynchronously get a block header and the transaction hashes it contains by its height.- Parameters:
height
- height of block to look up (0 based)- Returns:
- a future that completes to block containing header and transaction hashes
- See Also:
getBlock(long)
-
getBlock
Get a block header and the transaction hashes it contains by its hash.- Parameters:
hash
- hash of block to lookup- Returns:
- block containing header and transaction hashes
- See Also:
getBlock(long)
,getBlockAsync(String)
-
getBlockAsync
Asynchronously get a block header and the transaction hashes it contains by its hash.- Parameters:
hash
- hash of block to lookup- Returns:
- a future that completes to block containing header and transaction hashes
- See Also:
getBlockAsync(long)
,getBlock(String)
-
getBlockCount
long getBlockCount()Look up how many blocks are in the longest chain known to the daemon.- Returns:
- number of blocks in longest chain seen by the node
- See Also:
getBlockCountAsync()
-
getBlockCountAsync
CompletableFuture<Long> getBlockCountAsync()Asynchronously look up how many blocks are in the longest chain known to the daemon.- Returns:
- a future that completes to the number of blocks in the longest chain seen by the node
- See Also:
getBlockCount()
-
getBlockHeader
Fetch a block's header by its hash.- Parameters:
hash
- hash of the block to lookup, as a hex string- Returns:
- block header
- Throws:
RpcException
- for malformed or non-existent block hash- See Also:
getBlockHeader(long)
,getBlockHeaderAsync(String)
-
getBlockHeaderAsync
Asynchronously fetch a block's header by its hash.- Parameters:
hash
- hash of the block to lookup, as a hex string- Returns:
- a future that completes to the requested block header
- See Also:
getBlockHeader(String)
-
getBlockHeader
Fetch a block's header by its height.- Parameters:
height
- height of the block to lookup- Returns:
- block header
- Throws:
RpcException
- for non-existent block height- See Also:
getBlockHeader(String)
,getBlockHeaderAsync(long)
-
getBlockHeaderAsync
Asynchronously fetch a block's header by its height.- Parameters:
height
- height of the block to lookup- Returns:
- a future that completes to the requested block header
- See Also:
getBlockHeader(long)
-
getBlockTemplate
Create a block template.- Parameters:
walletAddress
- wallet address to send mining reward toreserveSize
- number of bytes to reserve for extra nonce in miner reward tx- Returns:
- a new block template
- See Also:
getBlockTemplateAsync(String, int)
-
getBlockTemplateAsync
Asynchronously create a block template.- Parameters:
walletAddress
- wallet address to send mining reward toreserveSize
- number of bytes to reserve for extra nonce in miner reward tx- Returns:
- a future that completes to a new block template
- See Also:
getBlockTemplate(String, int)
-
submitBlock
Send a mined block for broadcast to the network.- Parameters:
blob
- hex encoded block blob
-
submitBlockAsync
Asynchronously send a mined block for broadcast to the network.- Parameters:
blob
- hex encoded block blob- Returns:
- a future that completes when the call is finished
-