# Blockchain
The following RPC calls interact with the Tokel blockchain daemon, and are made available through the tokel-cli
software.
The Tokel blockchain inherits all Komodo smartchain RPC's, but not all RPC's are enabled. For simplicity, our documentation only shows those commands that are enabled and available for use.
# coinsupply
coinsupply height
The coinsupply
method returns the coin supply information for the indicated block height
. If no height is given, the method defaults to the blockchain's current height.
TIP
To use this method for large block heights, first execute the method for a small block height, such as 1000
. Then execute the method for an incrementally higher block height, such as 10000
. Continue increasing the height until reaching the desired height.
# Arguments
Name | Type | Description |
---|---|---|
"height" | (integer, optional) | the desired block height |
# Response
Name | Type | Description |
---|---|---|
"result" | (string) | whether the request was successful |
"coin" | (string) | the ticker symbol of the coin for Smart Chains, otherwise KMD |
"height" | (integer) | the height of this coin supply data |
"supply" | (float) | the transparent coin supply |
"zfunds" | (float) | the shielded coin supply (in z addrs) |
"sprout" | (float) | the sprout coin supply (in zc addrs) |
"total" | (float) | the total coin supply, i.e. sum of supply + zfunds |
# 📌 Examples
Command:
./tokel-cli coinsupply 80000
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "coinsupply", "params": ["80000"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getbestblockhash
getbestblockhash
The getbestblockhash
method returns the hash of the best (tip) block in the longest block chain.
# Arguments
Name | Type | Description |
---|---|---|
(none) |
# Response
Name | Type | Description |
---|---|---|
"hex" | (string) | the block hash, hex encoded |
# 📌 Examples
Command:
./tokel-cli getbestblockhash
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbestblockhash", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getblock
getblock hash|height ( verbose )
The getblock
method returns the block's relevant state information.
The verbose input is optional. The default value is true, and it will return a json object with information about the indicated block. If verbose is false
, the command returns a string that is serialized hex-encoded data for the indicated block.
# Arguments
Name | Type | Description |
---|---|---|
hash OR height | string OR number, respectively | the block hash OR the block height |
verbose | (boolean, optional, default=true) | true returns a json object, false returns hex-encoded data |
# Response (verbose = true)
Name | Type | Description |
---|---|---|
"hash" | (string) | the block hash (same as provided hash) |
"confirmations" | (numeric) | a confirmation number that is aware of the dPoW security service |
"rawconfirmations" | (numeric) | the raw confirmations (number of blocks on top of this block); the returned value is -1 if the block is not on the main chain |
"size" | (numeric) | the block size |
"height" | (numeric) | the block height or index (same as provided height) |
"version" | (numeric) | the block version |
"merkleroot" | (string) | the merkle root |
"tx" : [ "transaction_id" ,...] | (array of strings) | |
"time" | (numeric) | the block time in seconds since epoch (Jan 1 1970 GMT) |
"nonce" | (numeric) | the nonce |
"bits" | (string) | the bits |
"difficulty" | (numeric) | the difficulty |
"previousblockhash" | (string) | the hash of the previous block |
"nextblockhash" | (string) | the hash of the next block |
# Response
Name | Type | Description |
---|---|---|
"data" | (string) | a string that is serialized, hex-encoded data for the indicated block |
# 📌 Examples
Command:
./tokel-cli getblock "0d060c88dd55c48a0e1ae663ca400d2edba709c8484ef84a727cabfbb950c320"
Command:
./tokel-cli getblock "0d060c88dd55c48a0e1ae663ca400d2edba709c8484ef84a727cabfbb950c320" false
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["0d060c88dd55c48a0e1ae663ca400d2edba709c8484ef84a727cabfbb950c320"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["0d060c88dd55c48a0e1ae663ca400d2edba709c8484ef84a727cabfbb950c320", false] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
Command:
./tokel-cli getblock 120
Command:
./tokel-cli getblock 120 false
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["120"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["120", false] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getblockchaininfo
getblockchaininfo
The getblockchaininfo
method returns a json object containing state information about blockchain processing.
TIP
When the chain tip is at the last block before a network upgrade activation, the consensus.chaintip value is not equal to the consensus.nextblock value.
The getblockchaininfo
method now returns a new size_on_disk key, which is the size of the blockchain, on disk, in bytes.
# Arguments
Name | Type | Description |
---|---|---|
(none) |
# Response
Name | Type | Description |
---|---|---|
"chain" | (string) | the current network name, as defined in BIP70 (main, test, regtest) |
"blocks" | (numeric) | the current number of blocks processed in the server |
"headers" | (numeric) | the current number of headers we have validated |
"bestblockhash" | (string) | the hash of the currently best block |
"difficulty" | (numeric) | the current difficulty |
"verificationprogress" | (numeric) | an estimate of verification progress [0..1] |
"chainwork" | (string) | the total amount of work in the active chain, in hexadecimal |
"pruned" | (bool) | whether the current state is in pruning mode; if true, the blockchain will not keep all transaction and block information, to preserve disk space |
"size_on_disk" | (numeric) | the size of the blockchain on disk, measured in bytes |
"commitments" | (numeric) | the current number of note commitments in the commitment tree |
"softforks": { ..... } | (array) | the status of softforks in progress |
"id" | (string) | the name of the softfork |
"version" | (numeric) | the block version |
"enforce": { ... } | (object) | the progress toward enforcing the softfork rules for blocks of the new version |
"status" | (boolean) | true if threshold reached |
"found" | (numeric) | the number of blocks with the new version found |
"required" | (numeric) | the number of blocks required to trigger |
"window" | (numeric) | the maximum size of the examined window of recent blocks |
"reject": { ... } | (object) | the progress toward rejecting pre-softfork blocks (same fields as "enforce") |
"upgrades": | (object) | the status of network upgrades |
"xxxxxxxxx_string": | (string) | the branch ID of the upgrade |
"name" | (string) | the name of upgrade |
"activationheight" | (numeric) | the block height of activation |
"status" | (string) | the status of the upgrade |
"info" | (string) | additional information about the upgrade |
"consensus": { ..... } | (object) | branch IDs of the current and upcoming consensus rules |
"chaintip" | (string) | branch ID used to validate the current chain tip |
"nextblock" | (string) | branch ID under which the next block will be validated |
# 📌 Examples
Command:
./tokel-cli getblockchaininfo
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getblockcount
getblockcount
The getblockcount
method returns the number of blocks in the best valid block chain.
# Arguments
Name | Type | Description |
---|---|---|
(none) |
# Response
Name | Type | Description |
---|---|---|
data | (numeric) | the current block count |
# 📌 Examples
Command:
./tokel-cli getblockcount
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getblockhash
getblockhash index
The getblockhash
method returns the hash of the indicated block index, according to the best blockchain at the time provided.
# Arguments
Name | Type | Description |
---|---|---|
index | (numeric, required) | the block index |
# Response
Name | Type | Description |
---|---|---|
"hash" | (string) | the block hash |
# 📌 Examples
Command:
./tokel-cli getblockhash 100
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockhash", "params": [1000] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getblockhashes
getblockhashes high low '{"noOrphans": bool, "logicalTimes": bool}'
The getblockhashes
method returns an array of hashes of blocks within the timestamp range provided.
The method requires timestampindex to be enabled.
# Arguments
Name | Type | Description |
---|---|---|
high | (numeric, required) | the newer block timestamp |
low | (numeric, required) | the older block timestamp |
options | (string, required) | a json object |
"noOrphans" | (boolean) | a value of true implies that the method will only include blocks on the main chain |
"logicalTimes" | (boolean) | a value of true implies that the method will only include logical timestamps with hashes |
# Response
Name | Type | Description |
---|---|---|
"hash" | (string) | the block hash |
"blockhash" | (string) | the block hash |
"logicalts" | (numeric) | the logical timestamp |
# 📌 Examples
Command:
./tokel-cli getblockhashes 1531614698 1531614498
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockhashes", "params": [1531614698, 1531614498] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
Command:
./tokel-cli getblockhashes 1531614698 1531614498 '{"noOrphans":false, "logicalTimes":true}'
# getblockheader
getblockheader "hash" ( verbose )
The getblockheader
method returns information about the indicated block.
The verbose input is optional. If verbose is false, the method returns a string that is serialized, hex-encoded data for the indicated blockheader. If verbose is true, the method returns a json object with information about the indicated blockheader.
# Arguments
Name | Type | Description |
---|---|---|
"hash" | (string, required) | the block hash |
verbose | (boolean, optional, default=true) | true returns a json object, false returns hex-encoded data |
# Response (verbose = true
)
Name | Type | Description |
---|---|---|
"hash" | (string) | the block hash (same as provided) |
"confirmations" | (numeric) | a confirmation number that is aware of the dPoW security service |
"rawconfirmations" | (numeric) | the raw confirmations (number of blocks on top of this block); if the block is not on the main chain, a value of -1 is returned |
"height" | (numeric) | the block height or index |
"version" | (numeric) | the block version |
"merkleroot" | (string) | the merkle root |
"time" | (numeric) | the block time in seconds since epoch (Jan 1 1970 GMT) |
"nonce" | (numeric) | the nonce |
"bits" | (string) | the bits |
"difficulty" | (numeric) | the difficulty |
"previousblockhash" | (string) | the hash of the previous block |
"nextblockhash" | (string) | the hash of the next block |
# Response (verbose = false
)
Name | Type | Description |
---|---|---|
"data" | (string) | a string that is serialized hex-encoded data for the indicated block |
# 📌 Examples
Command:
./tokel-cli getblockheader "0d060c88dd55c48a0e1ae663ca400d2edba709c8484ef84a727cabfbb950c320"
Command:
./tokel-cli getblockheader "0d060c88dd55c48a0e1ae663ca400d2edba709c8484ef84a727cabfbb950c320" false
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockheader", "params": ["0d060c88dd55c48a0e1ae663ca400d2edba709c8484ef84a727cabfbb950c320"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getchaintips
getchaintips
The getchaintips
method returns information about all known tips in the block tree, including the main chain and any orphaned branches.
# Arguments
Name | Type | Description |
---|---|---|
(none) |
# Response
Name | Type | Description |
---|---|---|
"height" | (numeric) | the height of the chain tip |
"hash" | (string) | the block hash of the tip |
"branchlen" | (numeric) | 0 for main chain |
"status" | (string) | "active" for the main chain |
"height" | (numeric) | the height of the branch tip |
"hash" | (string) | the blockhash of the branch tip |
"branchlen" | (numeric) | the length of the branch connecting the tip to the main chain |
"status" | (string) | the status of the chain |
# Possible values for the returned status property
Status | Description |
---|---|
"invalid" | this branch contains at least one invalid block |
"headers-only" | not all blocks for this branch are available, but the headers are valid |
"valid-headers" | all blocks are available for this branch, but they were never fully validated |
"valid-fork" | this branch is not part of the active chain, but is fully validated |
"active" | this is the tip of the active main chain, which is certainly valid |
# 📌 Examples
Command:
./tokel-cli getchaintips
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getchaintips", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getchaintxstats
getchaintxstats nblocks blockhash
The method getchaintxstats
returns statistics about the total number and rate of transactions in the chain.
# Arguments
Name | Type | Description |
---|---|---|
nblocks | (numeric, optional) | the number of blocks in the averaging window. |
blockhash | (string, optional) | the hash of the block which ends the window |
# Response
Name | Type | Description |
---|---|---|
"time" | (numeric) | the timestamp for the final block in the window in UNIX format |
"txcount" | (numeric) | the total number of transactions in the chain up to this point |
"window_final_block_hash" | (string) | the hash of the final block in the window |
"window_block_count" | (numeric) | the size of the window in the number of blocks |
"window_tx_count" | (numeric) | the number of transactions in the window; this value is only returned if window_block_count is > 0. |
"window_interval" | (numeric) | the elapsed time in the window in seconds; this value is only returned if window_block_count is > 0. |
"txrate" | (numeric) | the average rate of transactions per second in the window; this value is only returned if window_interval is > 0. |
# 📌 Examples
Command:
./tokel-cli getchaintxstats
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getchaintxstats", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getdifficulty
getdifficulty
The getdifficulty
method returns the proof-of-work difficulty as a multiple of the minimum difficulty.
# Arguments
Name | Type | Description |
---|---|---|
(none) |
# Response
Name | Type | Description |
---|---|---|
number | (numeric) | the proof-of-work difficulty as a multiple of the minimum difficulty |
# 📌 Examples
Command:
./tokel-cli getdifficulty
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getdifficulty", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getlastsegidstakes
getlastsegidstakes depth
The getlastsegidstakes
method returns an object containing the number of blocks staked by each segid in the last X
number of blocks, where the value of X
is equal to the indicated depth
.
Note
Only applies to -ac_staked
Smart Chains
# Arguments
Name | Type | Description |
---|---|---|
depth | (numeric, required) | the number of blocks to scan, starting from the current height and working backwards |
# Response
Name | Type | Description |
---|---|---|
"NotSet" | (numeric) | the number of blocks that have no SegId set |
"PoW" | (numeric) | the number of blocks created through PoW |
"PoSPerc" | (numeric) | the percentage of blocks created through PoS |
"SegIds" | (json object) | the json containing the data of number of blocks in each SegId |
"n" | (numeric) | the number of blocks staked from SegId n in the last X blocks, where X is equal to the indicated depth |
# 📌 Examples
Command:
./tokel-cli getlastsegidstakes 1000
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getlastsegidstakes", "params": [1000] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getmempoolinfo
getmempoolinfo
The getmempoolinfo
method returns details on the active state of the transaction memory pool.
# Arguments
Name | Type | Description |
---|---|---|
(none) |
# Response
Name | Type | Description |
---|---|---|
"size" | (numeric) | the current transaction count |
"bytes" | (numeric) | the sum of all transaction sizes |
"usage" | (numeric) | the total memory usage for the mempool |
# 📌 Examples
Command:
./tokel-cli getmempoolinfo
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmempoolinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getrawmempool
getrawmempool ( verbose )
The getrawmempool
method returns all transaction ids in the memory pool as a json array of transaction ids.
The verbose input is optional and is false by default. When it is true, the method instead returns a json object with various related data.
# Arguments
Name | Type | Description |
---|---|---|
verbose | (boolean, optional, default=false) | true for a json object, false for a json array of transaction ids |
# Response (verbose = false
)
Name | Type | Description |
---|---|---|
"transaction_id" | (string) | the transaction id |
# Response (verbose = true
)
Name | Type | Description |
---|---|---|
"transaction_id": { .... } | (json object) | |
"size" | (numeric) | the transaction size in bytes |
"fee" | (numeric) | the transaction fee |
"time" | (numeric) | the local time transaction entered pool in seconds since 1 Jan 1970 GMT |
"height" | (numeric) | the block height wherein the transaction entered the mempool |
"startingpriority" | (numeric) | the priority when the transaction entered the mempool |
"currentpriority" | (numeric) | the transaction priority at the current height |
"depends": { ... } | (array) | unconfirmed transactions used as inputs for this transaction |
"transaction_id" | (string) | the parent transaction id |
# 📌 Examples
Command:
./tokel-cli getrawmempool true
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrawmempool", "params": [true] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getspentinfo
getspentinfo '{"txid": "txid_string", "index"}'
The getspentinfo
method returns the transaction id and index where the given output is spent.
The method requires spentindex to be enabled.
# Arguments
Name | Type | Description |
---|---|---|
"txid" | (string) | the hex string of the transaction id |
"index" | (number) | the output's index |
# Response
Name | Type | Description |
---|---|---|
"txid" | (string) | the transaction id |
"index" | (number) | the spending input index |
# 📌 Examples
Command:
./tokel-cli getspentinfo '{"txid": "4479f2c05ba22adf2333db724f247a09effcc9edea8c079da0da05d3a0451064", "index": 0}'
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getspentinfo", "params": [{"txid": "4479f2c05ba22adf2333db724f247a09effcc9edea8c079da0da05d3a0451064", "index": 0}] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# gettxout
gettxout "txid_string" vout_number ( includemempool_bool )
The gettxout
method returns details about an unspent transaction output.
# Arguments
Name | Type | Description |
---|---|---|
"txid" | (string, required) | the transaction id |
vout | (numeric, required) | the vout value |
includemempool | (boolean, optional) | whether to include the mempool |
# Response
Name | Type | Description |
---|---|---|
"bestblock" | (string) | the block hash |
"confirmations" | (numeric) | a confirmation number that is aware of the dPoW security service aware |
"rawconfirmations" | (numeric) | the raw confirmations (number of blocks on top of this block with this transaction) |
"value" | (numeric) | the transaction value |
"scriptPubKey": | (json object) | |
"asm" | (string) | scriptPubKey in assembly format |
"hex" | (string) | scriptPubKey in hex format |
"reqSigs" | (numeric) | the number of required signatures |
"type" | (string) | the type, e.g. pubkeyhash |
"addresses" | (array of strings) | an array of Tokel addresses |
"address" | (string) | the blockchain address |
"version" | (numeric) | the version |
"coinbase" | (boolean) | whether this is a coinbase transaction |
# 📌 Examples
Command:
./tokel-cli gettxout "d7f9b34ad3e86f48fce55dbec1f2925b8dcbd15199977fd75d224254db9ae80d" 1
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "gettxout", "params": ["d7f9b34ad3e86f48fce55dbec1f2925b8dcbd15199977fd75d224254db9ae80d", 1] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# gettxoutproof
gettxoutproof '["transaction_id", ... ]' ( "blockhash_string" )
The gettxoutproof
method returns a hex-encoded proof showing that the indicated transaction was included in a block.
TIP
The gettxoutproof method relies on the txindex runtime parameter. This parameter is enabled by default on all KMD-based blockchains, and should never be disabled.
# Arguments
Name | Type | Description |
---|---|---|
"txid" | (string) | a transaction hash |
"blockhash" | (string, optional) | if specified, the method looks for the relevant transaction id in this block hash |
# Response
Name | Type | Description |
---|---|---|
"data" | (string) | a string that is a serialized, hex-encoded data for the proof |
# 📌 Examples
Command:
./tokel-cli gettxoutproof '["c71f4a2ebf87bdd588e3aa168917933ee4be1661245ebf52d5708a8339cf9d7a"]' "0a28e2fb630b282138bf23bb79f597b11acff6f57c8d9c1c10fa54770035c813"
# gettxoutsetinfo
gettxoutsetinfo
The gettxoutsetinfo
method returns statistics about the unspent transaction output set.
TIP
Note this call may take a long time to complete, depending on the state of your blockchain.
# Arguments
Name | Type | Description |
---|---|---|
(none) |
# Response
Name | Type | Description |
---|---|---|
"height" | (numeric) | the current block height (index) |
"bestblock" | (string) | the best block hash hex |
"transactions" | (numeric) | the number of transactions |
"txouts" | (numeric) | the number of output transactions |
"bytes_serialized" | (numeric) | the serialized size |
"hash_serialized" | (string) | the serialized hash |
"total_amount" | (numeric) | the total amount |
# 📌 Examples
Command:
./tokel-cli gettxoutsetinfo
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "gettxoutsetinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# kvsearch
kvsearch "key_string"
The kvsearch
method searches for a key stored via the kvupdate command.
TIP
This feature is only available for Smart Chains.
# Arguments
Name | Type | Description |
---|---|---|
key | (string, required) | the key for which the user desires to search the chain |
# Response
Name | Type | Description |
---|---|---|
"coin" | (string) | the chain on which the key is stored |
"currentheight" | (numeric) | the current height of the chain |
"key" | (string) | the key |
"keylen" | (string) | the length of the key |
"owner" | (string) | a hex string representing the owner of the key |
"height" | (numeric) | the height at which the key was stored |
"expiration" | (numeric) | the height at which the key will expire |
"flags" | (numeric) | 1 if the key was created with a password; 0 otherwise |
"value" | (string) | the stored value |
"valuesize" | (string) | the amount of characters stored |
# 📌 Examples
Command:
./tokel-cli kvsearch examplekey
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "kvsearch", "params": ["examplekey"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# kvupdate
kvupdate "key_string" "value_string" days "passphrase_string"
The kvupdate
method stores a key/value pair via OP_RETURN.
TIP
This feature is available only for Smart Chains. The maximum value memory size is 8kB.
# Arguments
Name | Type | Description |
---|---|---|
"key" | (string, required) | key (should be unique) |
"value" | (string, required) | value |
"days" | (numeric, required) | amount of days before the key expires (1440 blocks/day); minimum 1 day |
"passphrase" | (string, optional) | passphrase required to update this key |
# Response
Name | Type | Description |
---|---|---|
"coin" | (string) | the chain on which the key is stored |
"height" | (numeric) | the height at which the key was stored |
"expiration" | (numeric) | the height at which the key will expire |
"flags" | (string) | the amount of days the key will be stored |
"key" | (numeric) | the stored key |
"keylen" | (numeric) | the length of the key |
"value" | (numeric) | the stored value |
"valuesize" | (string) | the length of the stored value |
"fee" | (string) | the transaction fee paid to store the key |
"txid" | (string) | the transaction id |
# 📌 Examples
Command:
./tokel-cli kvupdate "examplekey" "examplevalue" 2 "examplepassphrase"
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "kvupdate", "params": ["examplekey", "examplevalue", "2", "examplepassphrase"] }' -H 'content-type: text/plain;' http://127.0.0.1:9801
# minerids
minerids height
The minerids
method returns information about the notary nodes and external miners at a specific block height. The response will calculate results according to the 2000 blocks proceeding the indicated "height" block.
# Arguments
Name | Type | Description |
---|---|---|
heights | (number) | the block height for the query |
# Response
Name | Type | Description |
---|---|---|
"mined": | ||
"notaryid" | (number) | the id of the specific notary node |
"kmdaddress" | (string) | the KMD address of the notary node |
"pubkey" | (string) | the public signing key of the notary node |
"blocks" | (number) |
# 📌 Examples
Command:
./tokel-cli minerids 1000000
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "minerids", "params": ["1000000"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# notaries
notaries height timestamp
notaries height
notaries timestamp
The notaries
method returns the public key, BTC address, and KMD address for each Komodo notary node.
Either or both of the height and timestamp parameters will suffice.
# Arguments
Name | Type | Description |
---|---|---|
height | (number) | the block height desired for the query |
timestamp | (number) | the timestamp of the block desired for the query |
# Response
Name | Type | Description |
---|---|---|
"notaries": [ ... ] | (array) | |
"pubkey" | (string) | the public signing key of the indicated notary node, used on the KMD network to create notary-node authorized transactions |
"BTCaddress" | (string) | the public BTC address the notary node uses on the BTC blockchain to create notarizations |
"KMDaddress" | (string) | the public KMD address the notary node uses on the KMD blockchain to create notarizations |
"numnotaries" | (number) | the number of notary nodes; typically this value is 64, but the value may vary on rare circumstances, such as during election seasons |
"height" | (number) | the block height number at which the notary-node information applies |
"timestamp" | (number) | the timestamp at which the notary-node information applies |
# 📌 Examples
Command:
./tokel-cli notaries 1536365515
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "notaries", "params": ["1000000"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# verifychain
verifychain ( checklevel numblocks )
The verifychain
method verifies the coin daemon's blockchain database.
TIP
Depending on the state of your blockchain database and daemon, this call can take a prolonged period of time to complete.
# Arguments
Name | Type | Description |
---|---|---|
checklevel | (numeric, optional, 0-4, default=3) | indicates the thoroughness of block verification |
numblocks | (numeric, optional, default=288, 0=all) | indicates the number of blocks to verify |
# Response
Name | Type | Description |
---|---|---|
true/false | (boolean) | whether the verification was successful |
# 📌 Examples
Command:
./tokel-cli verifychain
You can find the rpcuser
, rpcpassword
, and rpcport
in the coin's .conf
file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "verifychain", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# verifytxoutproof
verifytxoutproof "proof_string"
The verifytxoutproof
method verifies that a proof points to a transaction in a block. It returns the transaction to which the proof is committed, or it will throw an RPC error if the block is not in the current best chain.
# Arguments
Name | Type | Description |
---|---|---|
"proof_string" | (string, required) | the hex-encoded proof generated by gettxoutproof |
# Response
Name | Type | Description |
---|---|---|
"txid" | (string) | the transaction ids to which the proof commits; the array is empty if the proof is invalid |
# 📌 Examples
Command:
./tokel-cli verifytxoutproof "040000004cd8bd98c66020496d0b34a5f5412400146ba10d6c7ab4286f84f7008d8d390e9ca9575183f60906e293e9766997396bec59f1c0b966085de3d17f8ac3c9d5280000000000000000000000000000000000000000000000000000000000000000da05975bf50e0f202d004b81fcc388cfd411d8c7c59a548e070b5affe938ce8ce830f10b298b00002402939a9a31df1305b40d26d9748283b102c708258717248d0d63f01d2957d8e3dcf56f6e03000000022e4babc29707fbdd8da2e4277b7c8b8b09e837f409eb047c936904d75fc8e6267a9dcf39838a70d552bf5e246116bee43e93178916aae388d5bd87bf2e4a1fc7010d"
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "verifytxoutproof", "params": ["040000004cd8bd98c66020496d0b34a5f5412400146ba10d6c7ab4286f84f7008d8d390e9ca9575183f60906e293e9766997396bec59f1c0b966085de3d17f8ac3c9d5280000000000000000000000000000000000000000000000000000000000000000da05975bf50e0f202d004b81fcc388cfd411d8c7c59a548e070b5affe938ce8ce830f10b298b00002402939a9a31df1305b40d26d9748283b102c708258717248d0d63f01d2957d8e3dcf56f6e03000000022e4babc29707fbdd8da2e4277b7c8b8b09e837f409eb047c936904d75fc8e6267a9dcf39838a70d552bf5e246116bee43e93178916aae388d5bd87bf2e4a1fc7010d"] }' -H 'content-type: text/plain;' http://127.0.0.1:9801