Class: MoneroDaemon

MoneroDaemon()

Monero daemon interface and default implementations.

Constructor

new MoneroDaemon()

Source:

Methods

(static) parseNetworkType(network) → {MoneroNetworkType}

Parses a network string to an enumerated type.
Parameters:
Name Type Description
network string is the network string to parse
Source:
Returns:
is the enumerated network type
Type
MoneroNetworkType

addBlockListener(listener({MoneroBlockHeader}))

Register a listener to be notified when blocks are added to the chain.
Parameters:
Name Type Description
listener({MoneroBlockHeader}) function is invoked when blocks are added to the chain
Source:

(async) checkForUpdate() → {MoneroDaemonUpdateCheckResult}

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

(async) downloadUpdate(path) → {MoneroDaemonUpdateDownloadResult}

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

(async) flushTxPool(ids)

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

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

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

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

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

(async) getBlockByHeight(height) → {MoneroBlock}

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

(async) getBlockById(blockId) → {MoneroBlock}

Get a block by id.
Parameters:
Name Type Description
blockId string is the id of the block to get
Source:
Returns:
with the given id
Type
MoneroBlock

(async) getBlockHeaderByHeight(height) → {MoneroBlockHeader}

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

(async) getBlockHeaderById(blockId) → {MoneroBlockHeader}

Get a block header by its id.
Parameters:
Name Type Description
blockId string is the id of the block to get the header of
Source:
Returns:
is the block's header
Type
MoneroBlockHeader

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

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

(async) getBlockId(height) → {string}

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

(async) getBlockIds(blockIds, startHeight) → {Array.<string>}

Get block ids as a binary request to the daemon.
Parameters:
Name Type Description
blockIds Array.<string> specify block ids to fetch; first 10 blocks id 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 block
startHeight int is the starting height of block ids to return
Source:
Returns:
are the requested block ids
Type
Array.<string>

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

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

(async) getBlocksById(blockIds, startHeight, prune) → {Array.<MoneroBlock>}

Get blocks by id.
Parameters:
Name Type Description
blockIds Array.<string> are array of hashes; first 10 blocks id 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 block
startHeight int is the start height to get blocks by id
prune boolean specifies if returned blocks should be pruned (defaults to false) // TODO: test default
Source:
Returns:
are the retrieved blocks
Type
Array.<MoneroBlock>

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

Get blocks in the given height range.
Parameters:
Name Type Description
startHeight int is the start height lower bound inclusive (optional)
endHeight int is the end height upper bound inclusive (optional)
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 is the start height lower bound inclusive (optional)
endHeight int is the end height upper bound inclusive (optional)
maxChunkSize int is the maximum chunk size in any one request (default 3,000,000 bytes)
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 is the address of the wallet to receive miner transactions if block is successfully mined
reserveSize int is the reserve size (optional)
Source:
Returns:
is a block template for mining a new block
Type
MoneroBlockTemplate

(async) getConnections() → {Array.<MoneroDaemonConnection>}

Get incoming and outgoing connections to the node.
Source:
Returns:
are the daemon's peer connections
Type
Array.<MoneroDaemonConnection>

(async) getDownloadLimit() → {int}

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

(async) getFeeEstimate(graceBlocks) → {BigInteger}

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

(async) getHardForkInfo() → {MoneroHardForkInfo}

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

(async) getHeight() → {int}

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

(async) getInfo() → {MoneroDaemonInfo}

Get general information about the state of the node and the network.
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 is key image hex to get the status of
Source:
Returns:
is the 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
Source:
Returns:
is the status for each key image
Type
Array.<MoneroKeyImageSpentStatus>

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

Get known peers including their last known online status.
Source:
Returns:
are known peers
Type
Array.<MoneroDaemonPeer>

(async) getLastBlockHeader() → {MoneroBlockHeader}

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

(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 is the height to start computing the miner sum
numBlocks int are the number of blocks to include in the sum
Source:
Returns:
encapsulates the total emissions and fees since the genesis block
Type
MoneroMinerTxSum

(async) getMiningStatus() → {MoneroMiningStatus}

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

(async) getNextBlockHeader() → {MoneroBlockHeader}

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

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

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

(async) getOutputs(outputs) → {Array.<MoneroOutput>}

Get outputs identified by a list of output amounts and indices as a binary request.
Parameters:
Name Type Description
outputs Array.<MoneroOutput> identify each output by amount and index
Source:
Returns:
are the identified outputs
Type
Array.<MoneroOutput>

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

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

(async) getSyncInfo() → {MoneroDaemonSyncInfo}

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

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

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

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

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

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

Get transaction hexes by ids.
Parameters:
Name Type Default Description
txIds Array.<string> are ids of transactions to get hexes from
prune boolean false specifies if the returned tx hexes should be pruned (defaults to false)
Source:
Returns:
are the 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.
Source:
Returns:
are transactions in the transaction pool
Type
Array.<MoneroTx>

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

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

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

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

(async) getTxPoolStats() → {MoneroTxPoolStats}

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

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

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

(async) getUploadLimit() → {int}

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

(async) isTrusted() → {boolean}

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

(async) relayTxById(txId)

Relays a transaction by id.
Parameters:
Name Type Description
txId string identifies the transaction to relay
Source:

(async) relayTxsById(txIds)

Relays transactions by id.
Parameters:
Name Type Description
txIds Array.<string> identify the transactions to relay
Source:

removeBlockListener(listener)

Unregister a listener to be notified when blocks are added to the chain.
Parameters:
Name Type Description
listener function is a previously registered listener to be unregistered
Source:

(async) resetDownloadLimit() → {int}

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

(async) resetUploadLimit() → {int}

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

(async) setDownloadLimit(limit) → {int}

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

(async) setIncomingPeerLimit(limit)

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

(async) setOutgoingPeerLimit(limit)

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

(async) setPeerBan(ban)

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

(async) setPeerBans(contain)

Ban peers nodes.
Parameters:
Name Type Description
contain Array.<MoneroBan> information about nodes to ban
Source:

(async) setUploadLimit(limit) → {int}

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

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

Start mining.
Parameters:
Name Type Description
address string is the address given miner rewards if the daemon mines a block
numThreads integer is the 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
Source:

(async) stop()

Safely disconnect and shut down the daemon.
Source:

(async) stopMining()

Stop mining.
Source:

(async) submitBlock(blockBlob)

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

(async) submitBlocks(blockBlobs)

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

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

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