Class: MoneroDaemonRpc

MoneroDaemonRpc

Implements a MoneroDaemon as a client of monerod.

Methods

(async) addListener(listener)

Register a listener to receive daemon notifications.
Parameters:
Name Type Description
listener MoneroDaemonListener listener to receive daemon notifications
Implements:
Source:

(async) checkForUpdate() → {MoneroDaemonUpdateCheckResult}

Check for update.
Implements:
Source:
Returns:
the result
Type
MoneroDaemonUpdateCheckResult

(async) downloadUpdate(path) → {MoneroDaemonUpdateDownloadResult}

Download an update.
Parameters:
Name Type Description
path string path to download the update (optional)
Implements:
Source:
Returns:
the result
Type
MoneroDaemonUpdateDownloadResult

(async) flushTxPool(hashes)

Flush transactions from the tx pool.
Parameters:
Name Type Description
hashes string | Array.<string> specific transactions to flush (defaults to all)
Implements:
Source:

(async) getAltBlockHashes() → {Array.<string>}

Get known block hashes which are not on the main chain.
Implements:
Source:
Returns:
known block hashes which are not on the main chain
Type
Array.<string>

(async) getAltChains() → {Array.<MoneroAltChain>}

Get alternative chains seen by the node.
Implements:
Source:
Returns:
alternative chains
Type
Array.<MoneroAltChain>

(async) getBlockByHash(blockHash) → {MoneroBlock}

Get a block by hash.
Parameters:
Name Type Description
blockHash string hash of the block to get
Implements:
Source:
Returns:
with the given hash
Type
MoneroBlock

(async) getBlockByHeight(height) → {MoneroBlock}

Get a block by height.
Parameters:
Name Type Description
height int height of the block to get
Implements:
Source:
Returns:
with the given height
Type
MoneroBlock

(async) getBlockHash(height) → {string}

Get a block's hash by its height.
Parameters:
Name Type Description
height int height of the block hash to get
Implements:
Source:
Returns:
the block's hash at the given height
Type
string

(async) getBlockHeaderByHash(blockHash) → {MoneroBlockHeader}

Get a block header by its hash.
Parameters:
Name Type Description
blockHash string hash of the block to get the header of
Implements:
Source:
Returns:
block's header
Type
MoneroBlockHeader

(async) getBlockHeaderByHeight(height) → {MoneroBlockHeader}

Get a block header by its height.
Parameters:
Name Type Description
height int height of the block to get the header of
Implements:
Source:
Returns:
block's header
Type
MoneroBlockHeader

(async) getBlockHeadersByRange(startHeight, endHeight) → {Array.<MoneroBlockHeader>}

Get block headers for the given range.
Parameters:
Name Type Description
startHeight int start height lower bound inclusive (optional)
endHeight int end height upper bound inclusive (optional)
Implements:
Source:
Returns:
for the given range
Type
Array.<MoneroBlockHeader>

(async) getBlocksByHeight(heights) → {Array.<MoneroBlock>}

Get blocks at the given heights.
Parameters:
Name Type Description
heights Array.<int> heights of the blocks to get
Implements:
Source:
Returns:
are blocks at the given heights
Type
Array.<MoneroBlock>

(async) getBlocksByRange(startHeight, endHeight) → {Array.<MoneroBlock>}

Get blocks in the given height range.
Parameters:
Name Type Description
startHeight int start height lower bound inclusive (optional)
endHeight int end height upper bound inclusive (optional)
Implements:
Source:
Returns:
are blocks in the given height range
Type
Array.<MoneroBlock>

(async) getBlocksByRangeChunked(startHeight, endHeight, maxChunkSize) → {Array.<MoneroBlock>}

Get blocks in the given height range as chunked requests so that each request is not too big.
Parameters:
Name Type Description
startHeight int start height lower bound inclusive (optional)
endHeight int end height upper bound inclusive (optional)
maxChunkSize int maximum chunk size in any one request (default 3,000,000 bytes)
Implements:
Source:
Returns:
blocks in the given height range
Type
Array.<MoneroBlock>

(async) getBlockTemplate(walletAddress, reserveSize) → {MoneroBlockTemplate}

Get a block template for mining a new block.
Parameters:
Name Type Description
walletAddress string address of the wallet to receive miner transactions if block is successfully mined
reserveSize int reserve size (optional)
Implements:
Source:
Returns:
is a block template for mining a new block
Type
MoneroBlockTemplate

(async) getDownloadLimit() → {int}

Get the download bandwidth limit.
Implements:
Source:
Returns:
download bandwidth limit
Type
int

(async) getFeeEstimate(graceBlocks) → {BigInteger}

Get the fee estimate per kB.
Parameters:
Name Type Description
graceBlocks int TODO
Implements:
Source:
Returns:
fee estimate per kB.
Type
BigInteger

(async) getHardForkInfo() → {MoneroHardForkInfo}

Look up information regarding hard fork voting and readiness.
Implements:
Source:
Returns:
contains hard fork information
Type
MoneroHardForkInfo

(async) getHeight() → {int}

Get the number of blocks in the longest chain known to the node.
Implements:
Source:
Returns:
the number of blocks
Type
int

(async) getInfo() → {MoneroDaemonInfo}

Get general information about the state of the node and the network.
Implements:
Source:
Returns:
is general information about the node and network
Type
MoneroDaemonInfo

(async) getKeyImageSpentStatus(keyImage) → {MoneroKeyImageSpentStatus}

Get the spent status of the given key image.
Parameters:
Name Type Description
keyImage string key image hex to get the status of
Implements:
Source:
Returns:
status of the key image
Type
MoneroKeyImageSpentStatus

(async) getKeyImageSpentStatuses(keyImages) → {Array.<MoneroKeyImageSpentStatus>}

Get the spent status of each given key image.
Parameters:
Name Type Description
keyImages Array.<string> are hex key images to get the statuses of
Implements:
Source:
Returns:
status for each key image
Type
Array.<MoneroKeyImageSpentStatus>

(async) getKnownPeers() → {Array.<MoneroPeer>}

Get known peers including their last known online status.
Implements:
Source:
Returns:
the daemon's known peers
Type
Array.<MoneroPeer>

(async) getLastBlockHeader() → {MoneroBlockHeader}

Get the last block's header.
Implements:
Source:
Returns:
last block's header
Type
MoneroBlockHeader

getListeners() → {Array.<MoneroDaemonListener>}

Get the listeners registered with the daemon.
Implements:
Source:
Returns:
the registered listeners
Type
Array.<MoneroDaemonListener>

(async) getMinerTxSum(height, numBlocks) → {MoneroMinerTxSum}

Gets the total emissions and fees from the genesis block to the current height.
Parameters:
Name Type Description
height int height to start computing the miner sum
numBlocks int number of blocks to include in the sum
Implements:
Source:
Returns:
encapsulates the total emissions and fees since the genesis block
Type
MoneroMinerTxSum

(async) getMiningStatus() → {MoneroMiningStatus}

Get the daemon's mining status.
Implements:
Source:
Returns:
daemon's mining status
Type
MoneroMiningStatus

(async) getOutputDistribution(amounts, cumulative, startHeight, endHeight) → {Array.<MoneroOutputDistributionEntry>}

Creates an output distribution.
Parameters:
Name Type Description
amounts Array.<BigInteger> amounts of outputs to make the distribution with
cumulative boolean specifies if the results should be cumulative (defaults to TODO)
startHeight int start height lower bound inclusive (optional)
endHeight int end height upper bound inclusive (optional)
Implements:
Source:
Returns:
are entries meeting the parameters
Type
Array.<MoneroOutputDistributionEntry>

(async) getOutputHistogram(amounts, minCount, maxCount, isUnlocked, recentCutoff) → {Array.<MoneroOutputHistogramEntry>}

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:
Name Type Description
amounts Array.<BigInteger> amounts of outputs to make the histogram with
minCount int TODO
maxCount int TODO
isUnlocked boolean makes a histogram with outputs with the specified lock state
recentCutoff int TODO
Implements:
Source:
Returns:
are entries meeting the parameters
Type
Array.<MoneroOutputHistogramEntry>

(async) getPeerBans() → {Array.<MoneroBan>}

Get peer bans.
Implements:
Source:
Returns:
entries about banned peers
Type
Array.<MoneroBan>

(async) getPeers() → {Array.<MoneroPeer>}

Get peers with active incoming or outgoing connections to the node.
Implements:
Source:
Returns:
the daemon's peers
Type
Array.<MoneroPeer>

getProcess()

Get the internal process running monerod.
Source:
Returns:
the process running monerod, undefined if not created from new process

(async) getRpcConnection() → {MoneroRpcConnection}

Get the daemon's RPC connection.
Source:
Returns:
the daemon's rpc connection
Type
MoneroRpcConnection

(async) getSyncInfo() → {MoneroDaemonSyncInfo}

Get synchronization information.
Implements:
Source:
Returns:
contains sync information
Type
MoneroDaemonSyncInfo

(async) getTx(txHash, prune) → {MoneroTx}

Get a transaction by hash.
Parameters:
Name Type Default Description
txHash string hash of the transaction to get
prune boolean false specifies if the returned tx should be pruned (defaults to false)
Implements:
Source:
Returns:
transaction with the given hash
Type
MoneroTx

(async) getTxHex(txHash, prune) → {string}

Get a transaction hex by hash.
Parameters:
Name Type Default Description
txHash string hash of the transaction to get hex from
prune boolean false specifies if the returned tx hex should be pruned (defaults to false)
Implements:
Source:
Returns:
tx hex with the given hash
Type
string

(async) getTxHexes(txHashes, prune) → {Array.<string>}

Get transaction hexes by hashes.
Parameters:
Name Type Default Description
txHashes Array.<string> hashes of transactions to get hexes from
prune boolean false specifies if the returned tx hexes should be pruned (defaults to false)
Implements:
Source:
Returns:
tx hexes
Type
Array.<string>

(async) getTxPool() → {Array.<MoneroTx>}

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.
Implements:
Source:
Returns:
are transactions in the transaction pool
Type
Array.<MoneroTx>

(async) getTxPoolBacklog() → {Array.<MoneroTxBacklogEntry>}

Get all transaction pool backlog.
Implements:
Source:
Returns:
backlog entries
Type
Array.<MoneroTxBacklogEntry>

(async) getTxPoolHashes() → {Array.<string>}

Get hashes of transactions in the transaction pool.
Implements:
Source:
Returns:
are hashes of transactions in the transaction pool
Type
Array.<string>

(async) getTxPoolStats() → {MoneroTxPoolStats}

Get transaction pool statistics.
Implements:
Source:
Returns:
contains statistics about the transaction pool
Type
MoneroTxPoolStats

(async) getTxs(txHashes, prune) → {Array.<MoneroTx>}

Get transactions by hashes.
Parameters:
Name Type Default Description
txHashes Array.<string> hashes of transactions to get
prune boolean false specifies if the returned txs should be pruned (defaults to false)
Implements:
Source:
Returns:
transactions with the given hashes
Type
Array.<MoneroTx>

(async) getUploadLimit() → {int}

Get the upload bandwidth limit.
Implements:
Source:
Returns:
upload bandwidth limit
Type
int

(async) getVersion() → {MoneroVersion}

Gets the version of the daemon.
Implements:
Source:
Returns:
the version of the daemon
Type
MoneroVersion

(async) isConnected() → {boolean}

Indicates if the client is connected to the daemon via RPC.
Implements:
Source:
Returns:
true if the client is connected to the daemon, false otherwise
Type
boolean

(async) isTrusted() → {boolean}

Indicates if the daemon is trusted xor untrusted.
Implements:
Source:
Returns:
true if the daemon is trusted, false otherwise
Type
boolean

(async) relayTxsByHash(txHashes)

Relays transactions by hash.
Parameters:
Name Type Description
txHashes Array.<string> hashes of the transactinos to relay
Implements:
Source:

(async) removeListener(listener)

Unregister a listener to receive daemon notifications.
Parameters:
Name Type Description
listener MoneroDaemonListener listener to unregister
Implements:
Source:

(async) resetDownloadLimit() → {int}

Reset the download bandwidth limit.
Implements:
Source:
Returns:
download bandwidth limit after resetting
Type
int

(async) resetUploadLimit() → {int}

Reset the upload bandwidth limit.
Implements:
Source:
Returns:
upload bandwidth limit after resetting
Type
int

(async) setDownloadLimit(limit) → {int}

Set the download bandwidth limit.
Parameters:
Name Type Description
limit int download limit to set (-1 to reset to default)
Implements:
Source:
Returns:
new download limit after setting
Type
int

(async) setIncomingPeerLimit(limit)

Limit number of incoming peers.
Parameters:
Name Type Description
limit int maximum number of incoming peers
Implements:
Source:

(async) setOutgoingPeerLimit(limit)

Limit number of outgoing peers.
Parameters:
Name Type Description
limit int maximum number of outgoing peers
Implements:
Source:

(async) setPeerBan(ban)

Ban a peer node.
Parameters:
Name Type Description
ban MoneroBan contains information about a node to ban
Implements:
Source:

(async) setPeerBans(bans)

Ban peers nodes.
Parameters:
Name Type Description
bans Array.<MoneroBan> specify which peers to ban
Implements:
Source:

(async) setUploadLimit(limit) → {int}

Set the upload bandwidth limit.
Parameters:
Name Type Description
limit upload limit to set (-1 to reset to default)
Implements:
Source:
Returns:
new upload limit after setting
Type
int

(async) startMining(address, numThreads, isBackground, ignoreBattery)

Start mining.
Parameters:
Name Type Description
address string address given miner rewards if the daemon mines a block
numThreads integer number of mining threads to run
isBackground boolean specifies if the miner should run in the background or not
ignoreBattery boolean specifies if the battery state (e.g. on laptop) should be ignored or not
Implements:
Source:

(async) stop()

Safely disconnect and shut down the daemon.
Implements:
Source:

(async) stopMining()

Stop mining.
Implements:
Source:

(async) stopProcess()

Stop the internal process running monerod, if applicable.
Source:

(async) submitBlock(blockBlob)

Submit a mined block to the network.
Parameters:
Name Type Description
blockBlob string mined block to submit
Implements:
Source:

(async) submitBlocks(blockBlobs)

Submit mined blocks to the network.
Parameters:
Name Type Description
blockBlobs Array.<string> mined blocks to submit
Implements:
Source:

(async) submitTxHex(txHex, doNotRelay) → {MoneroSubmitTxResult}

Submits a transaction to the daemon's pool.
Parameters:
Name Type Description
txHex string raw transaction hex to submit
doNotRelay boolean specifies if the tx should be relayed (optional)
Implements:
Source:
Returns:
contains submission results
Type
MoneroSubmitTxResult

(async) waitForNextBlockHeader() → {MoneroBlockHeader}

Get the header of the next block added to the chain.
Implements:
Source:
Returns:
header of the next block added to the chain
Type
MoneroBlockHeader