Package monero.daemon
Interface MoneroDaemon
- All Known Implementing Classes:
MoneroDaemonDefault
,MoneroDaemonRpc
public interface MoneroDaemon
Monero daemon interface.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(MoneroDaemonListener listener) Register a listener to receive daemon notifications.Check for update.Download an update.downloadUpdate
(String path) Download an update.void
Flushes all transactions from the tx pool.void
flushTxPool
(String... hashes) Flush transactions from the tx pool.void
flushTxPool
(Collection<String> hashes) Flush transactions from the tx pool.Get known block hashes which are not on the main chain.Get alternative chains seen by the node.getBlockByHash
(String blockHash) Get a block by hash.getBlockByHeight
(long height) Get a block by height.getBlockHash
(long height) Get a block's hash by its height.getBlockHashes
(List<String> blockHashes, Long startHeight) Get block hashes as a binary request to the daemon.getBlockHeaderByHash
(String blockHash) Get a block header by its hash.getBlockHeaderByHeight
(long height) Get a block header by its height.getBlockHeadersByRange
(Long startHeight, Long endHeight) Get block headers for the given range.getBlocksByHash
(List<String> blockHashes, Long startHeight, Boolean prune) Get blocks by hash.getBlocksByHeight
(List<Long> heights) Get blocks at the given heights.getBlocksByRange
(Long startHeight, Long endHeight) Get blocks in the given height range.getBlocksByRangeChunked
(Long startHeight, Long endHeight) Get blocks in the given height range as chunked requests so that each request is not too big.getBlocksByRangeChunked
(Long startHeight, Long endHeight, Long maxChunkSize) Get blocks in the given height range as chunked requests so that each request is not too big.getBlockTemplate
(String walletAddress) Get a block template for mining a new block.getBlockTemplate
(String walletAddress, Integer reserveSize) Get a block template for mining a new block.int
Get the download bandwidth limit.Get mining fee estimates per kB.getFeeEstimate
(Integer graceBlocks) Get mining fee estimates per kB.Look up information regarding hard fork voting and readiness.long
Get the number of blocks in the longest chain known to the node.getInfo()
Get general information about the state of the node and the network.getKeyImageSpentStatus
(String keyImage) Get the spent status of the given key image.getKeyImageSpentStatuses
(Collection<String> keyImages) Get the spent status of each given key image.Get all known peers including their last known online status.Get the last block's header.Get the listeners registered with the daemon.getMinerTxSum
(long height, Long numBlocks) Gets the total emissions and fees from the genesis block to the current height.Get the daemon's mining status.getOutputDistribution
(Collection<BigInteger> amounts) Creates an output distribution.getOutputDistribution
(Collection<BigInteger> amounts, Boolean isCumulative, Long startHeight, Long endHeight) Creates an output distribution.getOutputHistogram
(Collection<BigInteger> amounts, Integer minCount, Integer maxCount, Boolean isUnlocked, Integer recentCutoff) Get a histogram of output amounts.getOutputs
(Collection<MoneroOutput> outputs) Get outputs identified by a list of output amounts and indices as a binary request.Get peer bans.getPeers()
Get peers with active incoming or outgoing connections to the node.Get synchronization information.Get a transaction by hash.Get a transaction by hash.Get a transaction hex by hash.Get a transaction hex by hash.getTxHexes
(Collection<String> txHashes) Get transaction hexes by hashes.getTxHexes
(Collection<String> txHashes, Boolean prune) Get transaction hexes by hashes.Get valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the tx pool.Get all transaction pool backlog.Get hashes of transactions in the transaction pool.Get transaction pool statistics.getTxs
(Collection<String> txHashes) Get transactions by hashes.getTxs
(Collection<String> txHashes, Boolean prune) Get transactions by hashes.int
Get the upload bandwidth limit.Gets the version of the daemon.boolean
Indicates if the daemon is trusted or untrusted.static MoneroNetworkType
parseNetworkType
(String network) Parses a network string to an enumerated type.pruneBlockchain
(boolean check) Prune the blockchain.void
relayTxByHash
(String txHash) Relays a transaction by hash.void
relayTxsByHash
(Collection<String> txHashes) Relays transactions by hash.void
removeListener
(MoneroDaemonListener listener) Unregister a listener to receive daemon notifications.int
Reset the download bandwidth limit.int
Reset the upload bandwidth limit.int
setDownloadLimit
(int limit) Set the download bandwidth limit.void
setIncomingPeerLimit
(int limit) Limit number of incoming peers.void
setOutgoingPeerLimit
(int limit) Limit number of outgoing peers.void
setPeerBan
(MoneroBan ban) Ban a peer node.void
setPeerBans
(List<MoneroBan> bans) Ban peers nodes.int
setUploadLimit
(int limit) Set the upload bandwidth limit.void
startMining
(String address, Long numThreads, Boolean isBackground, Boolean ignoreBattery) Start mining.void
stop()
Safely disconnect and shut down the daemon.void
Stop mining.void
submitBlock
(String blockBlob) Submit a mined block to the network.void
submitBlocks
(Collection<String> blockBlobs) Submit mined blocks to the network.submitTxHex
(String txHex) Submits a transaction to the daemon's pool.submitTxHex
(String txHex, Boolean doNotRelay) Submits a transaction to the daemon's pool.Get the header of the next block added to the chain.
-
Method Details
-
addListener
Register a listener to receive daemon notifications.- Parameters:
listener
- the listener to unregister
-
removeListener
Unregister a listener to receive daemon notifications.- Parameters:
listener
- a previously registered listener to be unregistered
-
getListeners
List<MoneroDaemonListener> getListeners()Get the listeners registered with the daemon.- Returns:
- the registered listeners
-
getVersion
MoneroVersion getVersion()Gets the version of the daemon.- Returns:
- the version of the daemon
-
isTrusted
boolean isTrusted()Indicates if the daemon is trusted or untrusted.- Returns:
- true if the daemon is trusted, false otherwise
-
getHeight
long getHeight()Get the number of blocks in the longest chain known to the node.- Returns:
- the number of blocks
-
getBlockHash
Get a block's hash by its height.- Parameters:
height
- is the height of the block hash to get- Returns:
- the block's hash at the given height
-
getBlockTemplate
Get a block template for mining a new block.- Parameters:
walletAddress
- is the address of the wallet to receive miner transactions if block is successfully mined- Returns:
- a block template for mining a new block
-
getBlockTemplate
Get a block template for mining a new block.- Parameters:
walletAddress
- is the address of the wallet to receive miner transactions if block is successfully minedreserveSize
- is the reserve size (optional)- Returns:
- a block template for mining a new block
-
getLastBlockHeader
MoneroBlockHeader getLastBlockHeader()Get the last block's header.- Returns:
- the last block's header
-
getBlockHeaderByHash
Get a block header by its hash.- Parameters:
blockHash
- is the hash of the block to get the header of- Returns:
- the block's header
-
getBlockHeaderByHeight
Get a block header by its height.- Parameters:
height
- is the height of the block to get the header of- Returns:
- the block's header
-
getBlockHeadersByRange
Get block headers for the given range.- Parameters:
startHeight
- is the start height lower bound inclusive (optional)endHeight
- is the end height upper bound inclusive (optional)- Returns:
- block headers in the given range
-
getBlockByHash
Get a block by hash.- Parameters:
blockHash
- is the hash of the block to get- Returns:
- the block with the given hash
-
getBlocksByHash
Get blocks by hash.- Parameters:
blockHashes
- are array of hashes; first 10 blocks hash goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis blockstartHeight
- is the start height to get blocks by hashprune
- specifies if returned blocks should be pruned (defaults to false) // TODO: test default- Returns:
- the retrieved blocks
-
getBlockByHeight
Get a block by height.- Parameters:
height
- is the height of the block to get- Returns:
- the block at the given height
-
getBlocksByHeight
Get blocks at the given heights.- Parameters:
heights
- are the heights of the blocks to get- Returns:
- blocks at the given heights
-
getBlocksByRange
Get blocks in the given height range.- Parameters:
startHeight
- is the start height lower bound inclusive (optional)endHeight
- is the end height upper bound inclusive (optional)- Returns:
- blocks in the given height range
-
getBlocksByRangeChunked
Get blocks in the given height range as chunked requests so that each request is not too big.- Parameters:
startHeight
- is the start height lower bound inclusive (optional)endHeight
- is the end height upper bound inclusive (optional)- Returns:
- blocks in the given height range
-
getBlocksByRangeChunked
Get blocks in the given height range as chunked requests so that each request is not too big.- Parameters:
startHeight
- is the start height lower bound inclusive (optional)endHeight
- is the end height upper bound inclusive (optional)maxChunkSize
- is the maximum chunk size in any one request (default 3,000,000 bytes)- Returns:
- blocks in the given height range
-
getBlockHashes
Get block hashes as a binary request to the daemon.- Parameters:
blockHashes
- specify block hashes to fetch; first 10 blocks hash goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis blockstartHeight
- is the starting height of block hashes to return- Returns:
- the requested block hashes
-
getTx
Get a transaction by hash.- Parameters:
txHash
- is the hash of the transaction to get- Returns:
- the transaction with the given hash or null if not found
-
getTx
Get a transaction by hash.- Parameters:
txHash
- is the hash of the transaction to getprune
- specifies if the returned tx should be pruned (defaults to false)- Returns:
- the transaction with the given hash or null if not found
-
getTxs
Get transactions by hashes.- Parameters:
txHashes
- are hashes of transactions to get- Returns:
- found transactions with the given hashes
-
getTxs
Get transactions by hashes.- Parameters:
txHashes
- are hashes of transactions to getprune
- specifies if the returned txs should be pruned (defaults to false)- Returns:
- found transactions with the given hashes
-
getTxHex
Get a transaction hex by hash.- Parameters:
txHash
- is the hash of the transaction to get hex from- Returns:
- the tx hex with the given hash
-
getTxHex
Get a transaction hex by hash.- Parameters:
txHash
- is the hash of the transaction to get hex fromprune
- specifies if the returned tx hex should be pruned (defaults to false)- Returns:
- the tx hex with the given hash
-
getTxHexes
Get transaction hexes by hashes.- Parameters:
txHashes
- are hashes of transactions to get hexes from- Returns:
- are the tx hexes
-
getTxHexes
Get transaction hexes by hashes.- Parameters:
txHashes
- are hashes of transactions to get hexes fromprune
- specifies if the returned tx hexes should be pruned (defaults to false)- Returns:
- are the tx hexes
-
getMinerTxSum
Gets the total emissions and fees from the genesis block to the current height.- Parameters:
height
- is the height to start computing the miner sumnumBlocks
- are the number of blocks to include in the sum- Returns:
- the sum emission and fees since the geneis block
-
getFeeEstimate
MoneroFeeEstimate getFeeEstimate()Get mining fee estimates per kB.- Returns:
- mining fee estimates per kB
-
getFeeEstimate
Get mining fee estimates per kB.- Parameters:
graceBlocks
- TODO- Returns:
- mining fee estimates per kB
-
submitTxHex
Submits a transaction to the daemon's pool.- Parameters:
txHex
- is the raw transaction hex to submit- Returns:
- the submission results
-
submitTxHex
Submits a transaction to the daemon's pool.- Parameters:
txHex
- is the raw transaction hex to submitdoNotRelay
- specifies if the tx should be relayed (optional)- Returns:
- the submission results
-
relayTxByHash
Relays a transaction by hash.- Parameters:
txHash
- identifies the transaction to relay
-
relayTxsByHash
Relays transactions by hash.- Parameters:
txHashes
- identify the transactions to relay
-
getTxPool
Get valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the tx pool.- Returns:
- transactions in the transaction pool
-
getTxPoolHashes
Get hashes of transactions in the transaction pool.- Returns:
- hashes of transactions in the transaction pool
-
getTxPoolBacklog
List<MoneroTxBacklogEntry> getTxPoolBacklog()Get all transaction pool backlog.- Returns:
- transaction pool backlog entries
-
getTxPoolStats
MoneroTxPoolStats getTxPoolStats()Get transaction pool statistics.- Returns:
- statistics about the transaction pool
-
flushTxPool
void flushTxPool()Flushes all transactions from the tx pool. -
flushTxPool
Flush transactions from the tx pool.- Parameters:
hashes
- are hashes of transactions to flush
-
flushTxPool
Flush transactions from the tx pool.- Parameters:
hashes
- are hashes of transactions to flush
-
getKeyImageSpentStatus
Get the spent status of the given key image.- Parameters:
keyImage
- is key image hex to get the status of- Returns:
- the status of the key image
-
getKeyImageSpentStatuses
Get the spent status of each given key image.- Parameters:
keyImages
- are hex key images to get the statuses of- Returns:
- the spent status for each key image
-
getOutputs
Get outputs identified by a list of output amounts and indices as a binary request.- Parameters:
outputs
- identify each output by amount and index- Returns:
- the identified outputs
-
getOutputHistogram
List<MoneroOutputHistogramEntry> getOutputHistogram(Collection<BigInteger> amounts, Integer minCount, Integer maxCount, Boolean isUnlocked, Integer recentCutoff) Get a histogram of output amounts. For all amounts (possibly filtered by parameters), gives the number of outputs on the chain for that amount. RingCT outputs counts as 0 amount.- Parameters:
amounts
- are amounts of outputs to make the histogram withminCount
- TODOmaxCount
- TODOisUnlocked
- makes a histogram with outputs with the specified lock staterecentCutoff
- TODO- Returns:
- output histogram entries meeting the parameters
-
getOutputDistribution
Creates an output distribution.- Parameters:
amounts
- are amounts of outputs to make the distribution with- Returns:
- output distribution entries meeting the parameters
-
getOutputDistribution
List<MoneroOutputDistributionEntry> getOutputDistribution(Collection<BigInteger> amounts, Boolean isCumulative, Long startHeight, Long endHeight) Creates an output distribution.- Parameters:
amounts
- are amounts of outputs to make the distribution withisCumulative
- specifies if the results should be cumulative (defaults to TODO)startHeight
- is the start height lower bound inclusive (optional)endHeight
- is the end height upper bound inclusive (optional)- Returns:
- output distribution entries meeting the parameters
-
getInfo
MoneroDaemonInfo getInfo()Get general information about the state of the node and the network.- Returns:
- general information about the node and network
-
getSyncInfo
MoneroDaemonSyncInfo getSyncInfo()Get synchronization information.- Returns:
- contains sync information
-
getHardForkInfo
MoneroHardForkInfo getHardForkInfo()Look up information regarding hard fork voting and readiness.- Returns:
- hard fork information
-
getAltChains
List<MoneroAltChain> getAltChains()Get alternative chains seen by the node.- Returns:
- alternative chains seen by the node
-
getAltBlockHashes
Get known block hashes which are not on the main chain.- Returns:
- known block hashes which are not on the main chain
-
getDownloadLimit
int getDownloadLimit()Get the download bandwidth limit.- Returns:
- is the download bandwidth limit
-
setDownloadLimit
int setDownloadLimit(int limit) Set the download bandwidth limit.- Parameters:
limit
- is the download limit to set (-1 to reset to default)- Returns:
- int is the new download limit after setting
-
resetDownloadLimit
int resetDownloadLimit()Reset the download bandwidth limit.- Returns:
- the download bandwidth limit after resetting
-
getUploadLimit
int getUploadLimit()Get the upload bandwidth limit.- Returns:
- is the upload bandwidth limit
-
setUploadLimit
int setUploadLimit(int limit) Set the upload bandwidth limit.- Parameters:
limit
- is the upload limit to set (-1 to reset to default)- Returns:
- int is the new upload limit after setting
-
resetUploadLimit
int resetUploadLimit()Reset the upload bandwidth limit.- Returns:
- the upload bandwidth limit after resetting
-
getPeers
List<MoneroPeer> getPeers()Get peers with active incoming or outgoing connections to the node.- Returns:
- the daemon's peers
-
getKnownPeers
List<MoneroPeer> getKnownPeers()Get all known peers including their last known online status.- Returns:
- the daemon's known peers
-
setOutgoingPeerLimit
void setOutgoingPeerLimit(int limit) Limit number of outgoing peers.- Parameters:
limit
- is the maximum number of outgoing peers
-
setIncomingPeerLimit
void setIncomingPeerLimit(int limit) Limit number of incoming peers.- Parameters:
limit
- is the maximum number of incoming peers
-
getPeerBans
Get peer bans.- Returns:
- entries about banned peers
-
setPeerBan
Ban a peer node.- Parameters:
ban
- contains information about a node to ban
-
setPeerBans
Ban peers nodes.- Parameters:
bans
- are bans to apply against peer nodes
-
startMining
Start mining.- Parameters:
address
- is the address given miner rewards if the daemon mines a blocknumThreads
- is the number of mining threads to runisBackground
- specifies if the miner should run in the background or notignoreBattery
- specifies if the battery state (e.g. on laptop) should be ignored or not
-
stopMining
void stopMining()Stop mining. -
getMiningStatus
MoneroMiningStatus getMiningStatus()Get the daemon's mining status.- Returns:
- the daemon's mining status
-
submitBlock
Submit a mined block to the network.- Parameters:
blockBlob
- is the mined block to submit
-
submitBlocks
Submit mined blocks to the network.- Parameters:
blockBlobs
- are the mined blocks to submit
-
pruneBlockchain
Prune the blockchain.- Parameters:
check
- specifies to check the pruning (default false)- Returns:
- the prune result
-
checkForUpdate
MoneroDaemonUpdateCheckResult checkForUpdate()Check for update.- Returns:
- the result of the update check
-
downloadUpdate
MoneroDaemonUpdateDownloadResult downloadUpdate()Download an update.- Returns:
- the result of the update download
-
downloadUpdate
Download an update.- Parameters:
path
- is the path to download the update (optional)- Returns:
- the result of the update download
-
stop
void stop()Safely disconnect and shut down the daemon. -
waitForNextBlockHeader
MoneroBlockHeader waitForNextBlockHeader()Get the header of the next block added to the chain.- Returns:
- the header of the next block added to the chain
-
parseNetworkType
Parses a network string to an enumerated type.- Parameters:
network
- is the network string to parse- Returns:
- the enumerated network type
-