Methods
(static) .createDaemonClient(opts) → {RPCDaemon}
Factory that creates a RPCDaemon client object.
Parameters:
opts
(
Object
)
Properties
url
(
string
)
complete url with port 'http://127.0.0.1:20000' or 'https://127.0.0.1:20000'.
username
(
string
)
<optional>username.
password
(
string
)
<optional>password.
- Source:
(async, inner) .flushTxPool(optsopt) → {Promise.<object>}
Flush tx ids from transaction pool.
Parameters:
opts
(
Object
)
<optional>Properties
txids
(
Array.<string>
)
<optional>list of transactions IDs to flush from pool (all tx ids flushed if empty).
- Source:
(async, inner) .getAlternateChains()
Display alternative chains seen by the node.
- Source:
(async, inner) .getBans() → {Promise.<object>}
Get list of banned IPs.
- Source:
Example
{
bans:
[
{ host: '192.168.1.50', ip: 838969536, seconds: 30 },
{ host: '192.168.1.51', ip: 855746752, seconds: 30 }
],
status: 'OK'
}
(async, inner) .getBlock(opts) → {Promise.<object>}
Full block information can be retrieved by either block height or hash.
Parameters:
opts
(
Object
)
Properties
height
(
number
)
<optional>The block's height.
hash
(
string
)
<optional>The block's hash.
- Source:
Example
{
blob: '0a0ab294a0e305be9bcd157ff60f9b174217608a5b419c451afa1d9d76c49edf54ac829bf24e
743b62008002a6fc0601ff94fc0601a5a7a3bf4702f0f7be480164ced3d5d28c49dd9baeb5ab2bd3
29910838afd3e26cd85ad49b3e6101311398a1783551ba88c64c00135d0439d982fc4d70f48e1dff
cca8146454e84303210091abcad5e3b8bc208e5361ffeebbb68a35e102a5225f4865e3503cf7e76a
ff92021b000000000000000000000000005602009e000000000000000000000000',
block_header:
{
block_size: 147,
cumulative_difficulty: 16146009479722,
depth: 31535,
difficulty: 109000131,
hash: '5859dbfca776cc006f6bfd00a41363f8ffcc20e6f217c484df0b47ae8cc2458a',
height: 114196,
major_version: 10,
minor_version: 10,
nonce: 2147508795,
num_txes: 0,
orphan_status: false,
pow_hash: '',
prev_hash: 'be9bcd157ff60f9b174217608a5b419c451afa1d9d76c49edf54ac829bf24e74',
reward: 19191616421,
timestamp: 1550322226
},
json: '{\n "major_version": 10, \n "minor_version": 10, \n "timestamp": 15503222
26, \n "prev_id": "be9bcd157ff60f9b174217608a5b419c451afa1d9d76c49edf54ac829bf2
4e74", \n "nonce": 2147508795, \n "miner_tx": {\n "version": 2, \n "unlo
ck_time": 114214, \n "vin": [ {\n "gen": {\n "height": 114196
\n }\n }\n ], \n "vout": [ {\n "amount": 19191616421, \
n "target": {\n "key": "f0f7be480164ced3d5d28c49dd9baeb5ab2bd329
910838afd3e26cd85ad49b3e"\n }\n }\n ], \n "extra": [ 1, 49, 19
, 152, 161, 120, 53, 81, 186, 136, 198, 76, 0, 19, 93, 4, 57, 217, 130, 252, 77,
112, 244, 142, 29, 255, 204, 168, 20, 100, 84, 232, 67, 3, 33, 0, 145, 171, 202
, 213, 227, 184, 188, 32, 142, 83, 97, 255, 238, 187, 182, 138, 53, 225, 2, 165,
34, 95, 72, 101, 227, 80, 60, 247, 231, 106, 255, 146, 2, 27, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 86, 2, 0, 158, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\n ], \n
"rct_signatures": {\n "type": 0\n }\n }, \n "tx_hashes": [ ]\n}',
miner_tx_hash: '691e09ce198a2953c391a292ed79d7a239ec929740503400a0ab3e3ee8cfad84',
status: 'OK',
untrusted: false
}
(async, inner) .getBlockCount() → {Promise.<object>}
Look up how many blocks are in the longest chain known to the node.
- Source:
(async, inner) .getBlockHash(opts) → {Promise.<object>}
Look up a block's hash by its height.
Parameters:
opts
(
Object
)
Properties
height
(
number
)
block height.
- Source:
(async, inner) .getBlockHeaderByHash(opts) → {Promise.<object>}
Block header information can be retrieved using hash.
Parameters:
opts
(
Object
)
Properties
hash
(
string
)
The block's sha256 hash.
- Source:
Example
{
block_header:
{
block_size: 147,
cumulative_difficulty: 16146009479722,
depth: 30823,
difficulty: 109000131,
hash: '5859dbfca776cc006f6bfd00a41363f8ffcc20e6f217c484df0b47ae8cc2458a',
height: 114196,
major_version: 10,
minor_version: 10,
nonce: 2147508795,
num_txes: 0,
orphan_status: false,
pow_hash: '',
prev_hash: 'be9bcd157ff60f9b174217608a5b419c451afa1d9d76c49edf54ac829bf24e74',
reward: 19191616421,
timestamp: 1550322226
},
status: 'OK',
untrusted: false
}
(async, inner) .getBlockHeaderByHeight(opts) → {Promise.<object>}
Block header information can be retrieved using height.
Parameters:
opts
(
Object
)
Properties
height
(
number
)
The block's height.
- Source:
Example
{
block_header:
{
block_size: 147,
cumulative_difficulty: 16146009479722,
depth: 30823,
difficulty: 109000131,
hash: '5859dbfca776cc006f6bfd00a41363f8ffcc20e6f217c484df0b47ae8cc2458a',
height: 114196,
major_version: 10,
minor_version: 10,
nonce: 2147508795,
num_txes: 0,
orphan_status: false,
pow_hash: '',
prev_hash: 'be9bcd157ff60f9b174217608a5b419c451afa1d9d76c49edf54ac829bf24e74',
reward: 19191616421,
timestamp: 1550322226
},
status: 'OK',
untrusted: false
}
(async, inner) .getBlockHeadersRange(opts) → {Promise.<object>}
Similar to get_block_header_by_height above, but for a range of blocks. This method includes a starting block height and an ending block height as parameters.
Parameters:
opts
(
Object
)
Properties
start_height
(
number
)
The starting block's height.
end_height
(
number
)
The ending block's height.
- Source:
Example
{
headers:
[
{
block_size: 147,
cumulative_difficulty: 16146009479722,
depth: 30831,
difficulty: 109000131,
hash: '5859dbfca776cc006f6bfd00a41363f8ffcc20e6f217c484df0b47ae8cc2458a',
height: 114196,
major_version: 10,
minor_version: 10,
nonce: 2147508795,
num_txes: 0,
orphan_status: false,
pow_hash: '',
prev_hash: 'be9bcd157ff60f9b174217608a5b419c451afa1d9d76c49edf54ac829bf24e74',
reward: 19191616421,
timestamp: 1550322226
},
{
block_size: 147,
cumulative_difficulty: 16146120479856,
depth: 30830,
difficulty: 111000134,
hash: 'c27c128325bb3f47d76816789995d376268ee25f3cdcfb714580e34fe5cc8e08',
height: 114197,
major_version: 10,
minor_version: 10,
nonce: 541065496,
num_txes: 0,
orphan_status: false,
pow_hash: '',
prev_hash: '5859dbfca776cc006f6bfd00a41363f8ffcc20e6f217c484df0b47ae8cc2458a',
reward: 19191607270,
timestamp: 1550322551
}
],
status: 'OK',
untrusted: false
}
(async, inner) .getBlocksRange(opts) → {Promise.<object>}
Return a range of blocks containing the block header and its attached transactions. The first transaction in block is the coinbase transaction. This method includes a starting block height and an ending block height as parameters.
Parameters:
opts
(
Object
)
Properties
start_height
(
number
)
The starting block's height.
end_height
(
number
)
The ending block's height.
- Source:
Example
{ blocks:
[
{ block_header: [Object], txs: [Array] },
{ block_header: [Object], txs: [Array] }
],
status: 'OK',
untrusted: false
}
(async, inner) .getBlockTemplate(opts) → {Promise.<object>}
Get a block template on which mining a new block.
Parameters:
opts
(
Object
)
Properties
wallet_address
(
string
)
Address of wallet to receive coinbase transactions if block is successfully mined.
reserve_size
(
number
)
Reserve size.
- Source:
Example
{
blockhashing_blob: '0b0bdc83ffe405686cd8e06fea333582a7d521c6899a00266f107e9212ebe7b7626258893c9a
9000000000cc172232b1465580877b898f8f6021ad264705fb44d4ce4116576c951865dc6e02',
blocktemplate_blob: '0b0bdc83ffe405686cd8e06fea333582a7d521c6899a00266f107e9212ebe7b7626258893c9a
900000000002b3e70801ffa1e70801919ef5bc46027fecb474827691e150863765eeb11c7fda
e88e9cf413468b3f46a6fd1416174f2101958d80e5dd64b962d539a18e2fab89cd6abf1ddd2d
f4b6c2b890c1fad31acd310001eae8de4b74bf117c059ba9b68c9e81a2465997319dd5805a90
dfae8290b33ab9',
difficulty: 58700182,
expected_reward: 18918231825,
height: 144289,
prev_hash: '686cd8e06fea333582a7d521c6899a00266f107e9212ebe7b7626258893c9a90',
reserved_offset: 127,
status: 'OK',
untrusted: false
}
(async, inner) .getCoinbaseTxSum(opts) → {Promise.<object>}
Get the coinbase amount and the fees ammount for n last blocks starting at particular height.
Parameters:
opts
(
Object
)
Properties
height
(
number
)
unsigned int; Block height from which getting the amounts.
count
(
number
)
unsigned int; number of blocks to include in the sum
- Source:
(async, inner) .getConnections() → {Promise.<object>}
Retrieve information about incoming and outgoing connections to your node.
- Source:
Example
{
connections:
[
{
address: '192.154.226.212:19993',
avg_download: 1,
avg_upload: 0,
connection_id: 'cb8f0270c5b740fa9eb7aa1aedddb5cb',
current_download: 2,
current_upload: 0,
height: 145745,
host: '192.154.226.212',
incoming: false,
ip: '192.154.226.212',
live_time: 20,
local_ip: false,
localhost: false,
peer_id: 'c7f323892fb18784',
port: '19993',
pruning_seed: 0,
recv_count: 22852,
recv_idle_time: 13,
send_count: 568,
send_idle_time: 13,
state: 'normal',
support_flags: 1
}, ...
]
}
(async, inner) .getFeeEstimate(optsopt)
Gives an estimation on fees per kB.
Parameters:
opts
(
Object
)
<optional>Properties
grace_blocks
(
number
)
<optional>unsigned int.
- Source:
(async, inner) .getHardForkInfo() → {Promise.<object>}
Look up information regarding hard fork voting and readiness.
- Source:
Example
{
earliest_height: 131650,
enabled: true,
state: 2,
status: 'OK',
threshold: 0,
untrusted: false,
version: 11,
votes: 10080,
voting: 11,
window: 10080
}
(async, inner) .getInfo() → {Promise.<object>}
Retrieve general information about the state of your node and the network.
- Source:
Example
{
alt_blocks_count: 0,
block_size_limit: 600000,
block_size_median: 147,
bootstrap_daemon_address: '',
cumulative_difficulty: 20431347989483,
database_size: 0,
difficulty: 75600102,
free_space: 243485646848,
grey_peerlist_size: 62,
height: 145746,
height_without_bootstrap: 145746,
incoming_connections_count: 7,
mainnet: true,
nettype: 'mainnet',
offline: false,
outgoing_connections_count: 8,
rpc_connections_count: 2,
stagenet: false,
start_time: 1554144733,
status: 'OK',
target: 120,
target_height: 145732,
testnet: false,
top_block_hash: '9df96b39bb2ca8953cbf8f2fffc8f9896a74f430cbe29dc0ad356986ef93024c',
tx_count: 179362,
tx_pool_size: 10,
untrusted: false,
was_bootstrap_ever_used: false,
white_peerlist_size: 38
}
(async, inner) .getLastBlockHeader() → {Promise.<object>}
Block header information for the most recent block is easily retrieved with this method.
- Source:
Example
{
block_header:
{
block_size: 147,
cumulative_difficulty: 20379479802883,
depth: 0,
difficulty: 61400097,
hash: 'c99c2f9a53e4bab5d08f9820ee555d62059e0e9bf799fbe07a6137aac607f4e8',
height: 145009,
major_version: 11,
minor_version: 11,
nonce: 3441194797,
num_txes: 0,
orphan_status: false,
pow_hash: '',
prev_hash: '53d6437ac32fc49e0ee8b24f63046c6e1e6e0491f6d1b6797b025b66ad1b4a40',
reward: 18911700042,
timestamp: 1554058920 },
status: 'OK',
untrusted: false
}
count: 144188,
status: 'OK'
}
(async, inner) .getOutputDistribution(opts)
Get Ouput Distribution.
Parameters:
opts
(
Object
)
Properties
amounts
(
Array.<number>
)
list of amounts to look for.
cumulative
(
boolean
)
<optional>(default is false) States if the result should be cumulative (true or false).
from_height
(
number
)
<optional>(default is 0) - unsigned int.
to_height
(
number
)
<optional>(default is 0) - unsigned int.
- Source:
(async, inner) .getOutputHistogram(optsopt, unlockedopt, recent_cutoffopt) → {Promise.<object>}
Get a histogram of output amounts.
Parameters:
opts
(
Object
)
<optional>Properties
amounts
(
Array.<number>
)
<optional>list of unsigned int.
min_count
(
number
)
<optional>unsigned int.
max_count
(
number
)
<optional>unsigned int.
unlocked
(
boolean
)
<optional>boolean.
recent_cutoff
(
number
)
<optional>unsigned int.
- Source:
Example
{
histogram:
[
{
amount: 10000000,
recent_instances: 0,
total_instances: 1481,
unlocked_instances: 0
}
],
status: 'OK',
untrusted: false
}
(async, inner) .getVersion() → {Promise.<object>}
Give the node current version.
- Source:
(async, inner) .otherGetAltBlocksHashes() → {Promise.<object>}
Get the known blocks hashes which are not on the main chain.
- Source:
(async, inner) .otherGetHeight()
Get the node's current height.
- Source:
(async, inner) .otherGetLimit() → {Promise.<object>}
Get daemon bandwidth limits.
- Source:
(async, inner) .otherGetPeerList() → {Promise.<object>}
Get the known peers list.
- Source:
Example
{
gray_list:
[
{ host: '135790251',
id: 17703185689409910000,
ip: 135790251,
last_seen: 1551473999,
port: 19993,
pruning_seed: 0 }, ...
]
status: 'OK',
white_list:
[
{ host: '35263064',
id: 3764929947382960000,
ip: 35263064,
last_seen: 1554553579,
port: 19993,
pruning_seed: 0 }, ...
]
}
(async, inner) .otherGetTransactionPool() → {Promise.<object>}
Show information about valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the txpool in the node's memory.
- Source:
Example
{
spent_key_images:
[
{ id_hash: '12f6051aea57b598e7aefe436545ab55f449b11d392fffd76e33eef53ad9b962',
txs_hashes: [Array] },
...
],
status: 'OK',
transactions:
[
{ blob_size: 4384,
do_not_relay: false,
double_spend_seen: false,
fee: 37750,
id_hash:
'3fa2745621696d4e87d997e32409469cc3d734fda186f37878b8db2972a99a41',
kept_by_block: false,
last_failed_height: 0,
last_failed_id_hash:
'0000000000000000000000000000000000000000000000000000000000000000',
last_relayed_time: 1554589504,
max_used_block_height: 149373,
max_used_block_id_hash:
'3ed0b7d1c294def73dda48c6b3f43d724525fcbc08672782ec3a1e4c5a1b2f01',
receive_time: 1554589504,
relayed: true,
tx_blob: ... ,
tx_json: ... ,
}
],
untrusted: false
}
(async, inner) .otherGetTransactionPoolStats() → {Promise.<object>}
Get the transaction pool statistics.
- Source:
Example
{
pool_stats:
{
bytes_max: 2785,
bytes_med: 2785,
bytes_min: 2785,
bytes_total: 2785,
fee_total: 22650,
histo_98pc: 0,
num_10m: 0,
num_double_spends: 0,
num_failing: 0,
num_not_relayed: 0,
oldest: 1554589922,
txs_total: 1
},
status: 'OK',
untrusted: false
}
(async, inner) .otherGetTransactions(opts) → {Promise.<object>}
Full block information can be retrieved by either block height or hash.
Parameters:
opts
(
Object
)
Properties
tx_hashes
(
Array.<string>
)
List of transaction hashes to look up.
decode_as_json
(
boolean
)
<optional>(false by default). If set true, the returned transaction information will be decoded rather than binary.
prune
(
boolean
)
<optional>(false by default).
- Source:
Example
{
status: 'OK',
txs:
[
{
as_hex: '02000202 ... 0f',
as_json: '',
block_height: 140732,
block_timestamp: 1553537372,
double_spend_seen: false,
in_pool: false,
output_indices: [Array],
prunable_as_hex: '',
prunable_hash:
'79f87397ef265f27b32a659e0f3f73496527e2cb97228ee4a82f31ec972bd65b',
pruned_as_hex: '',
tx_hash: 'a43c51e3a216bb702e6be2746c02a366c8e3a05b08b50da5ada8e9481418e350'
}
],
txs_as_hex: [ '02000202 ... 0f' ],
untrusted: false
}
(async, inner) .otherInPeers(opts) → {Promise.<object>}
Limit number of incoming peers.
Parameters:
opts
(
Object
)
Properties
in_peers
(
number
)
Max number of incoming peers.
- Source:
(async, inner) .otherIsKeyImageSpent(opts) → {Promise.<object>}
Check if outputs have been spent using the key image associated with the output.
Parameters:
opts
(
Object
)
Properties
key_images
(
Array.<string>
)
list of block blobs which have been mined.
- Source:
(async, inner) .otherMiningStatus() → {Promise.<object>}
Get the mining status of the daemon.
- Source:
Example
{
active: true,
address: 'ar4bfzwH4726kamvTg2wRNLkw16MR6DbbZMyuShYgKs58SknoAF8q7PBQ1XXAsGgH9feTWKKmYZNjaWphc7Wce1u33iKe2cL9',
is_background_mining_enabled: true,
speed: 2,
status: 'OK',
threads_count: 1
}
(async, inner) .otherOutPeers(opts) → {Promise.<object>}
Limit number of outgoing peers.
Parameters:
opts
(
Object
)
Properties
out_peers
(
number
)
Max number of outgoing peers.
- Source:
(async, inner) .otherSaveBc() → {Promise.<object>}
Save the blockchain. The blockchain does not need saving and is always saved when modified, however it does a sync to flush the filesystem cache onto the disk for safety purposes against Operating System or Hardware crashes.
- Source:
(async, inner) .otherSendRawTransaction(opts) → {Promise.<object>}
Broadcast a raw transaction to the network.
Parameters:
opts
(
Object
)
Properties
tx_as_hex
(
string
)
Full transaction information as hexidecimal string.
do_not_relay
(
boolean
)
<optional>(false by default). Stop relaying transaction to other nodes.
- Source:
Example
{
double_spend: false,
fee_too_low: false,
invalid_input: false,
invalid_output: false,
low_mixin: false,
not_rct: false,
not_relayed: true,
overspend: false,
reason: 'Not relayed',
status: 'OK',
too_big: false,
untrusted: false
}
(async, inner) .otherSetLimit(opts) → {Promise.<object>}
Set daemon bandwidth limits.
Parameters:
opts
(
Object
)
Properties
limit_down
(
number
)
<optional>Download limit in kBytes per second (-1 reset to default, 0 don't change the current limit).
limit_up
(
number
)
<optional>Upload limit in kBytes per second (-1 reset to default, 0 don't change the current limit).
- Source:
(async, inner) .otherSetLogCategories(opts) → {Promise.<object>}
Set the daemon log categories.
Categories are represented as a comma separated list of <Category>:<level> (similarly to syslog standard <Facility>:<Severity-level>), where:
-
Category is one of the following:
- \* - All facilities
- default
- net
- net.http
- net.p2p
- logging
- net.throttle
- blockchain.db
- blockchain.db.lmdb
- bcutil
- checkpoints
- net.dns
- net.dl
- i18n
- perf
- stacktrace
- updates
- account
- cn
- difficulty
- hardfork
- miner
- blockchain
- txpool
- cn.block_queue
- net.cn
- daemon
- debugtools.deserialize
- debugtools.objectsizes
- device.ledger
- wallet.gen_multisig
- multisig
- bulletproofs
- ringct
- daemon.rpc
- wallet.simplewallet
- WalletAPI
- wallet.ringdb
- wallet.wallet2
- wallet.rpc
- tests.core
-
Level is one of the following:
- FATAL - higher level
- ERROR
- WARNING
- INFO
- DEBUG
- TRACE - lower level A level automatically includes higher level.
Setting the categories to "" prevent any logs to be outputed.
Parameters:
opts
(
Object
)
Properties
categories
(
string
)
<optional>Daemon log categories to enable.
- Source:
(async, inner) .otherSetLogHashrate(opts) → {Promise.<object>}
Set the log hash rate display mode.
Parameters:
opts
(
Object
)
Properties
visible
(
boolean
)
States if hash rate logs should be visible (true) or hidden (false)
- Source:
Examples
{ "status": "OK" }
Error: NOT MINING
at _request.then (C:\myDev\arqma-rpc-js\src\rpcDaemon.js:1418:27)
at process._tickCallback (internal/process/next_tick.js:68:7)
(async, inner) .otherSetLogLevel(opts) → {Promise.<object>}
Set the daemon log level. By default, log level is set to 0.
Parameters:
opts
(
Object
)
Properties
level
(
number
)
Daemon log level to set from 0 (less verbose) to 4 (most verbose).
- Source:
(async, inner) .otherStartMining(opts) → {Promise.<object>}
Start mining on the daemon.
Parameters:
opts
(
Object
)
Properties
do_background_mining
(
boolean
)
States if the mining should run in background (true) or foreground (false).
ignore_battery
(
boolean
)
States if batery state (on laptop) should be ignored (true) or not (false).
miner_address
(
string
)
Account address to mine to.
threads_count
(
number
)
Number of mining thread to run.
- Source:
(async, inner) .otherStopDaemon() → {Promise.<object>}
Send a command to the daemon to safely disconnect and shut down.
- Source:
(async, inner) .otherStopMining() → {Promise.<object>}
Stop mining on the daemon.
- Source:
(async, inner) .relayTx(opts) → {Promise}
Relay a list of transaction IDs.
Parameters:
opts
(
Object
)
Properties
txids
(
Array.<string>
)
list of transaction IDs to relay.
- Source:
(inner) .resetNonces()
Convenience Digest function to reset nc to '00000001' and generate a new cnonce
- Source:
(async, inner) .setBans(opts) → {Promise.<object>}
Ban another node by IP.
Parameters:
opts
(
Object
)
Properties
bans
(
Array
)
Properties
host
(
string
)
<optional>Host to ban.
ip
(
number
)
<optional>IP address to ban, in Int format.
ban
(
boolean
)
Set true to ban.
seconds
(
number
)
Number of seconds to ban node.
- Source:
(inner) .sslRejectUnauthorized()
If not false, the server certificate is verified against the list of supplied CAs.
- Source:
(async, inner) .submitBlock(opts) → {Promise.<object>}
Look up a block's hash by its height.
Parameters:
opts
(
Object
)
Properties
blobs
(
Array.<string>
)
list of block blobs which have been mined.
- Source:
Example
{ Error: Block not accepted
at _request.then (C:\myDev\arqma-rpc-js\src\rpcDaemon.js:761:25)
at process._tickCallback (internal/process/next_tick.js:68:7) code: -7 }
(async, inner) .syncInfo() → {Promise.<object>}
Get synchronisation informations.
- Source:
Example
{
height: 149027,
next_needed_pruning_seed: 0,
overview: '[]',
peers:
[
{ info: [Object] },
{ info: [Object] },
... ,
{ info: [Object] }
],
status: 'OK',
target_height: 149009
}
Type Definitions
.rpcDaemon :Object
- Source: