Methods
(static) parseNetworkType(network) → {MoneroNetworkType}
Parses a network string to an enumerated type.
Parameters:
Name | Type | Description |
---|---|---|
network |
string | network string to parse |
Returns:
enumerated network type
- Type
- MoneroNetworkType
(async) addListener(listener)
Register a listener to receive daemon notifications.
Parameters:
Name | Type | Description |
---|---|---|
listener |
MoneroDaemonListener | listener to receive daemon notifications |
(async) checkForUpdate() → {MoneroDaemonUpdateCheckResult}
Check for update.
Returns:
the result
(async) downloadUpdate(path) → {MoneroDaemonUpdateDownloadResult}
Download an update.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | path to download the update (optional) |
Returns:
the result
(async) flushTxPool(hashes)
Flush transactions from the tx pool.
Parameters:
Name | Type | Description |
---|---|---|
hashes |
string | Array.<string> | specific transactions to flush (defaults to all) |
(async) getAltBlockHashes() → {Array.<string>}
Get known block hashes which are not on the main chain.
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.
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 |
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 |
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 |
Returns:
the block's hash at the given height
- Type
- string
(async) getBlockHashes(blockHashes, startHeight) → {Array.<string>}
Get block hashes as a binary request to the daemon.
Parameters:
Name | Type | Description |
---|---|---|
blockHashes |
Array.<string> | 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 block |
startHeight |
int | starting height of block hashes to return |
Returns:
requested block hashes
- Type
- Array.<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 |
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 |
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) |
Returns:
for the given range
- Type
- Array.<MoneroBlockHeader>
(async) getBlocksByHash(blockHashes, startHeight, prune) → {Array.<MoneroBlock>}
Get blocks by hash.
Parameters:
Name | Type | Description |
---|---|---|
blockHashes |
Array.<string> | array of hashes; first 10 blocks hashes 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 | start height to get blocks by hash |
prune |
boolean | specifies if returned blocks should be pruned (defaults to false) // TODO: test default |
Returns:
retrieved blocks
- Type
- Array.<MoneroBlock>
(async) getBlocksByHeight(heights) → {Array.<MoneroBlock>}
Get blocks at the given heights.
Parameters:
Name | Type | Description |
---|---|---|
heights |
Array.<int> | heights of the blocks to get |
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) |
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) |
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) |
Returns:
is a block template for mining a new block
- Type
- MoneroBlockTemplate
(async) getDownloadLimit() → {int}
Get the download bandwidth limit.
Returns:
download bandwidth limit
- Type
- int
(async) getFeeEstimate(graceBlocks) → {MoneroFeeEstimate}
Get mining fee estimates per kB.
Parameters:
Name | Type | Description |
---|---|---|
graceBlocks |
number | TODO |
Returns:
mining fee estimates per kB
- Type
- MoneroFeeEstimate
(async) getHardForkInfo() → {MoneroHardForkInfo}
Look up information regarding hard fork voting and readiness.
Returns:
contains hard fork information
- Type
- MoneroHardForkInfo
(async) getHeight() → {int}
Get the number of blocks in the longest chain known to the node.
Returns:
the number of blocks
- Type
- int
(async) getInfo() → {MoneroDaemonInfo}
Get general information about the state of the node and the network.
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 |
Returns:
status of the key image
(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 |
Returns:
status for each key image
- Type
- Array.<MoneroKeyImageSpentStatus>
(async) getKnownPeers() → {Array.<MoneroPeer>}
Get known peers including their last known online status.
Returns:
the daemon's known peers
- Type
- Array.<MoneroPeer>
(async) getLastBlockHeader() → {MoneroBlockHeader}
Get the last block's header.
Returns:
last block's header
- Type
- MoneroBlockHeader
getListeners() → {Array.<MoneroDaemonListener>}
Get the listeners registered with the daemon.
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 |
Returns:
encapsulates the total emissions and fees since the genesis block
- Type
- MoneroMinerTxSum
(async) getMiningStatus() → {MoneroMiningStatus}
Get the daemon's mining status.
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) |
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 |
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 |
Returns:
identified outputs
- Type
- Array.<MoneroOutput>
(async) getPeerBans() → {Array.<MoneroBan>}
Get peer bans.
Returns:
entries about banned peers
(async) getPeers() → {Array.<MoneroPeer>}
Get peers with active incoming or outgoing connections to the node.
Returns:
the daemon's peers
- Type
- Array.<MoneroPeer>
(async) getSyncInfo() → {MoneroDaemonSyncInfo}
Get synchronization information.
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) |
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) |
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) |
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.
Returns:
are transactions in the transaction pool
(async) getTxPoolBacklog() → {Array.<MoneroTxBacklogEntry>}
Get all transaction pool backlog.
Returns:
backlog entries
- Type
- Array.<MoneroTxBacklogEntry>
(async) getTxPoolHashes() → {Array.<string>}
Get hashes of transactions in the transaction pool.
Returns:
are hashes of transactions in the transaction pool
- Type
- Array.<string>
(async) getTxPoolStats() → {MoneroTxPoolStats}
Get transaction pool statistics.
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) |
Returns:
transactions with the given hashes
(async) getUploadLimit() → {int}
Get the upload bandwidth limit.
Returns:
upload bandwidth limit
- Type
- int
(async) getVersion() → {MoneroVersion}
Gets the version of the daemon.
Returns:
the version of the daemon
- Type
- MoneroVersion
(async) isConnected() → {boolean}
Indicates if the client is connected to the daemon via RPC.
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.
Returns:
true if the daemon is trusted, false otherwise
- Type
- boolean
(async) relayTxByHash(txHash)
Relays a transaction by hash.
Parameters:
Name | Type | Description |
---|---|---|
txHash |
string | hash of the transaction to relay |
(async) relayTxsByHash(txHashes)
Relays transactions by hash.
Parameters:
Name | Type | Description |
---|---|---|
txHashes |
Array.<string> | hashes of the transactinos to relay |
(async) removeListener(listener)
Unregister a listener to receive daemon notifications.
Parameters:
Name | Type | Description |
---|---|---|
listener |
MoneroDaemonListener | listener to unregister |
(async) resetDownloadLimit() → {int}
Reset the download bandwidth limit.
Returns:
download bandwidth limit after resetting
- Type
- int
(async) resetUploadLimit() → {int}
Reset the upload bandwidth limit.
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) |
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 |
(async) setOutgoingPeerLimit(limit)
Limit number of outgoing peers.
Parameters:
Name | Type | Description |
---|---|---|
limit |
int | maximum number of outgoing peers |
(async) setPeerBan(ban)
Ban a peer node.
Parameters:
Name | Type | Description |
---|---|---|
ban |
MoneroBan | contains information about a node to ban |
(async) setPeerBans(bans)
Ban peers nodes.
Parameters:
Name | Type | Description |
---|---|---|
bans |
Array.<MoneroBan> | specify which peers to ban |
(async) setUploadLimit(limit) → {int}
Set the upload bandwidth limit.
Parameters:
Name | Type | Description |
---|---|---|
limit |
upload limit to set (-1 to reset to default) |
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 |
(async) stop()
Safely disconnect and shut down the daemon.
(async) stopMining()
Stop mining.
(async) submitBlock(blockBlob)
Submit a mined block to the network.
Parameters:
Name | Type | Description |
---|---|---|
blockBlob |
string | mined block to submit |
(async) submitBlocks(blockBlobs)
Submit mined blocks to the network.
Parameters:
Name | Type | Description |
---|---|---|
blockBlobs |
Array.<string> | mined blocks to submit |
(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) |
Returns:
contains submission results
- Type
- MoneroSubmitTxResult
(async) waitForNextBlockHeader() → {MoneroBlockHeader}
Get the header of the next block added to the chain.
Returns:
header of the next block added to the chain
- Type
- MoneroBlockHeader