# Mining
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.
# getblocksubsidy
getblocksubsidy height_number
The getblocksubsidy
method returns the block-subsidy reward. The resulting calculation takes into account the mining slow start. This method can be used in conjunction with custom mining rewards designed by the developers of a KMD-based Smart Chain.
# Arguments
Name | Type | Description |
---|---|---|
height | (numeric, optional) | the block height; if the block height is not provided, the method defaults to the current height of the chain |
# Response
Name | Type | Description |
---|---|---|
"miner" | (numeric) | the mining reward amount |
# 📌 Examples
Command:
./tokel-cli getblocksubsidy 100
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": "getblocksubsidy", "params": [1000] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getblocktemplate
getblocktemplate ( "jsonrequestobject" )
TIP
See the Bitcoin wiki for the full specification.
The getblocktemplate
method returns data that is necessary to construct a block.
If the request parameters include a mode
key, it is used to explicitly select between the default 'template' request, a 'proposal' or 'disablecb'.
# A Note on Unique Mining Circumstances
There are many features in the Komodo Ecosystem that can make a Smart Chain's daemon produce non-standard coinbase transactions. Examples include a Smart Chain parameter that creates new coins for a specific pubkey in every block or a CC module that adds outputs to the coinbase transaction.
This can be dealt using a mode called disablecb
Usage:
./tokel-cli getblocktemplate '{"mode":"disablecb"}'
The block template produced using this mode doesn't have the "coinbasetxn": { ... }
json object but adds the coinbase transaction to the "transactions":[ ... ]
array, just like a regular transaction.
Now the pool software can use the "transactions":[ ... ]
array to create a block and take fees in the payment processor.
Team member, Blackjok3r
, developed a coinbase-override method for this purpose. Please see this repo (opens new window) for details.
# Arguments
Name | Type | Description |
---|---|---|
"jsonrequestobject" : { ... } | (string, optional) | a json object in the following spec |
"mode" | (string, optional) | this must be set to "template" or omitted |
"capabilities": [ ... ] | (array, optional) | a list of strings |
"support" | (string) | client side supported features: "longpoll", "coinbasetxn", "coinbasevalue", "proposal", "serverlist", "workid" |
# Response
Name | Type | Description |
---|---|---|
"version" | (numeric) | the block version |
"previousblockhash" | (string) | the hash of current highest block |
"finalsaplingroothash" | (string) | the hash of the final sapling root |
"transactions":[ ... ] | (array) | the contents of non-coinbase transactions that should be included in the next block |
"data" | (string) | transaction data encoded in hexadecimal (byte-for-byte) |
"hash" | (string) | the hash/id encoded in little-endian hexadecimal |
"depends" : [ ... ] | (array) | an array of numbers |
number | (numeric) | the indexes of transactions that must be present in the final block if this transaction is present in the final block; the index of the array of transactions starts with "1" |
"fee" | (numeric) | the difference in value between transaction inputs and outputs in satoshis; for coinbase transactions, this is the negative number of the total collected block fees, not including the block subsidy; if a key is not present, the fee is unknown and clients MUST NOT assume it is not present |
"sigops" | (numeric) | the total number of sigops, as counted for the purposes of block limits; if a key is not present, the sigop count is unknown and clients MUST NOT assume they are not present. |
"required" | (boolean) | if provided and true, this transaction must be in the final block |
"coinbasetxn": { ... } | (json object) | information for the coinbase transaction |
"longpollid" | (string) | the last seen longpollid when this response was sent by the server |
"data" | (string) | transaction data encoded in hexadecimal (byte-for-byte) |
"hash" | (string) | the hash/id encoded in little-endian hexadecimal |
"depends" : [ ... ] | (array) | an array of numbers |
"fee" | (numeric) | the difference in value between transaction inputs and outputs in satoshis; for coinbase transactions, this is the negative number of the total collected block fees, not including the block subsidy; if a key is not present, the fee is unknown and clients MUST NOT assume it is not present |
"sigops" | (numeric) | the total number of sigops, as counted for the purposes of block limits; if a key is not present, the sigop count is unknown and clients MUST NOT assume they are not present. |
"foundersreward" | (numeric) | the founder's reward that should be paid out in this block; this key is present only in the blocks that payout the founder's reward; present only in chains with ac_founders enabled |
"coinbasevalue" | (numeric) | the value of the coinbase transaction (in satoshis) |
"required" | (boolean) | if provided and true, this transaction must be in the final block |
"target" | (string) | the hash target |
"mintime" | (numeric) | the minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT) |
"mutable": [ ... ] | (array of strings) | a list of ways the block template may be changed |
"value" | (string) | a way the block template may be changed, e.g. "time", "transactions", "prevblock" |
"noncerange" | (string) | a range of valid nonces |
"sigoplimit" | (numeric) | the limit of sigops in blocks |
"sizelimit" | (numeric) | the limit of block size |
"curtime" | (numeric) | current timestamp in seconds since epoch (Jan 1 1970 GMT) |
"bits" | (string) | the compressed target of the next block |
"height" | (numeric) | the height of the next block |
# 📌 Examples
Command:
./tokel-cli getblocktemplate '{"mode":"template","capabilities":["workid"]}'
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": "getblocktemplate", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getlocalsolps
getlocalsolps
The getlocalsolps
method returns the average local solutions per second since this node was started.
TIP
This is the same information shown on the metrics screen (if enabled).
# Arguments
Name | Type | Description |
---|---|---|
(none) |
# Response
Name | Type | Description |
---|---|---|
"data" | (numeric) | the solutions-per-second average |
# 📌 Examples
Command:
./tokel-cli getlocalsolps
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": "getlocalsolps", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getmininginfo
getmininginfo
The getmininginfo
method returns a json object containing mining-related information.
# Arguments
Name | Type | Description |
---|---|---|
(none) | (none) |
# Response
Name | Type | Description |
---|---|---|
"blocks" | (numeric) | the current block |
"currentblocksize" | (numeric) | the last block size |
"currentblocktx" | (numeric) | the last block transaction |
"difficulty" | (numeric) | the current difficulty |
"errors": | ||
"generate" | (boolean) | if the generation is on or off (see getgenerate or setgenerate calls) |
"genproclimit" | (numeric) | the processor limit for generation; -1 if no generation (see getgenerate or setgenerate calls) |
"localsolps" | (numeric) | the average local solution rate (solutions per second) since this node was started |
"networksolps" | (numeric) | the estimated network solution rate (solutions per second) |
"pooledtx": | ||
"testnet" | (boolean) | if using testnet or not |
"chain" | (string) | the current network name as defined in BIP70 (main, test, regtest) |
# 📌 Examples
Command:
./tokel-cli getmininginfo
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": "getmininginfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# getnetworksolps
getnetworksolps ( blocks height )
The getnetworksolps
method returns the estimated network solutions per second based on the last n
blocks.
Pass in blocks
to override the default number of blocks. Use -1 to calculate according to the relevant difficulty averaging window.
Pass in height
to estimate the network speed at the time when a certain block was found.
# Arguments
Name | Type | Description |
---|---|---|
blocks | (numeric, optional, default=120) | the number of blocks; use -1 to calculate according to the relevant difficulty averaging window |
height | (numeric, optional, default=-1) | the block height that corresponds to the requested data |
# Response
Name | Type | Description |
---|---|---|
data | (numeric) | solutions per second, estimated |
# 📌 Examples
Command:
./tokel-cli getnetworksolps
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": "getnetworksolps", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# prioritisetransaction
prioritisetransaction "transaction_id" priority_delta fee_delta
The prioritisetransaction
method instructs the daemon to accept the indicated transaction into mined blocks at a higher (or lower) priority. The transaction selection algorithm considers the transaction as it would have a higher priority.
TIP
This method is inherited from the original Bitcoin protocol, of which KMD is a fork (via Zcash) and such Komodo smartchains such as Tokel. For more examples regarding this method, please see the linked documentation.
# Arguments
Name | Type | Description |
---|---|---|
"transaction_id" | (string, required) | the transaction id |
priority_delta | (numeric, required) | the priority to add or subtract (if negative). The transaction selection algorithm assigns the tx a higher or lower priority. The transaction priority calculation: coinage * value_in_satoshis / txsize |
fee_delta | (numeric, required) | the fee value in satoshis to add or subtract (if negative); the fee is not actually paid, only the algorithm for selecting transactions into a block considers the transaction as if it paid a higher (or lower) fee. |
# Response
Name | Type | Description |
---|---|---|
true | (boolean) | returns true |
# 📌 Examples
Command:
./tokel-cli prioritisetransaction "7dc902b280da27cf2dabe41ed6f4d04c828714f289435db193a49341005607eb" 0.0 10000
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": "prioritisetransaction", "params": ["7dc902b280da27cf2dabe41ed6f4d04c828714f289435db193a49341005607eb", 0.0, 10000] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
# submitblock
submitblock "hexdata" ( "jsonparametersobject" )
The submitblock
method instructs the daemon to propose a new block to the network.
TIP
The jsonparametersobject parameter is currently ignored. See the linked documentation for full specification details.
TIP
Note: for more information on submitblock parameters and results, see the linked documentation.
# Arguments
Name | Type | Description |
---|---|---|
"hexdata" | (string, required) | the hex-encoded block data to submit |
"jsonparametersobject" : { ... } | (string, optional) | object of optional parameters |
"workid" | (string, sometimes optional) | if the server provides a workid, it MUST be included with submissions |
# Response
Name | Type | Description |
---|---|---|
"duplicate" | the node already has a valid copy of the block | |
"duplicate-invalid" | the node already has the block, but it is invalid | |
"duplicate-inconclusive" | the node already has the block but has not validated it | |
"inconclusive" | the node has not validated the block, it may not be on the node's current best chain | |
"rejected" | the block was rejected as invalid |
# 📌 Examples
Command:
./tokel-cli submitblock "0400000029865a4962f43d6f95fdf9ccc89f82377a23d1fdc41eaf943c7881a5ca55c5018973d81f5ce7ab99f027b15c86ca88ec5e4b6f35ad4018bfc2058568bbe7f526000000000000000000000000000000000000000000000000000000000000000097954a5b9e830c1d1600ac305580abea34bda62eb503b02fc4b7872428cfa60bf5824a9b78fc0000fd400500c80d4a8c84cec781a5740d8d3fb18587a850b6380f073cd861c4ce7c4290460c533e0d4dd3b89fe0f0052ccdf9d450a1dfcd7263a39422000378da3eeb621078af689447a5ed0a7265a857463a36d72cdd35910d14de9816a25d631aeb0249ede829aca77f9cce1a2e4a84b75e4bd515845043d52f718638fb41e92d8b18bfe1f49e1c0d23223a285b2850e8469dfbb9782b20c8bebf2a61d7b7d8eea310c7c8d5bfa612bf94fd05562ec8876eacafa0c334a651ef70c941459161b60c20511087d63223878052d4fd1a92298789d7c57609fe3a247489674592e8e34a1728b28e2c2b3165f01d5fefa22e6384f7fe4e566de1741e264f057a0feb1b35d51694647ba52afd71c3bd375b924da95e2b413dbea256a2de9ccddcab88bd2e69cc3acc8a778b4d1db78b41df9fea6d69b071f570f628ad47537d081740a4f2c4fa6666dbb862a6d02ff07b5ae0a9fa24b003fa0355dbde0425d6c14452f0d357f2cfd97960c343ba73789a2d7ba580ea8834ef656a9e79c49fc0f61aa9452a644c8bc06afe31dce2a7ca5d6995adc8ce1f77165a075399e1d006e2bb57c09ffd6e21fcff440645faef599264a3b8c005cf60683371ba1af8847d1992c64e512f13d9d2d364969759233a27c65e1f2f1113cdb665e3e8f7baa2c398c4a2ee85a6ad1bdb095962fafaa01c3d85bc820653544b89b6e75a584d8d04bc77e5284a9ebbcd46c1a6732b841e46c876976805d932a90ac215bcc37801900d49cfb87fe5c809b30ebd8ece38669153c1f1a2438253a56a6507d556cc16b2990f0bd290fea59462d25eebdbfcb78eb403c8080e0c68e8e2ef8f67145121bce83b94dc8f9d0a742752323c5a4b42409ffcc37053c58596deff7981a20e3f412c07c839a341fdc177d5e28f7909696f90c90efff14048f440e7ea3181378f66d35b0697dc02c60154778f438cdd3dba5dc4c2763319498bbb3b8fae17508b073d07d83f5f1dc71bf2dc205f06245872620dfa341dbcdf9c574598c121120e91dd687dfd08451369ab29a11dc73f69d0722992a1c70cf1498ec9b9143fcb0abfd7b1e39189125e8567cb2cc3d71fcdb541a0776a5a665161f98385633153fc9702f079269a1dac0d2c708f5d94e346159858cfd50624ff5a0505358739b5f41adbe739bf75852eebb06eeccd79e030019a5227cd9a19e77b6821ba0794fe09cb074f40ce0b92c081c31cda2d4711d53889fc6f0579839fa74309768ef0a796fa1fa660e150d3ea5c0a369e1297d11177fc284524d6d5e40eb7ee4b400f6dfd6a10402904394e1694de300ddd565622e7ca7ed62970ff5add0b36a513b5d90d2194cf414ecc97e5dcc88698e06405dea09f49503c81cc61518f8aee882da6eeae09b4127a7fcc0c0829fca8fda3502ebf13ece0a90a8dfd05d8e514452247f79472c20683e2b1fde5ec14a2453bf00f9f1cd5a088d229a7fdfdfdc24f176fb9a8a409af70d894998957394d30a46668d71cd16907aa800ee9d96c2b9fc7fb5a7944a9b8d4f76609fc186e3c0a4d80fb9c8c236f76eb00bc24dd9abddef7d653740ece7141ac6175f7e9cab1cb0216e85adde43907b60c0581336b50ccd7682f28f00f7efd663df4d31701141657da989d236d16052c4b59fc46fb41657a26d7074fbc9dee602f7d03b86179e4c12bc0df253f815319dff12353a478d95febd5f902e363734e6e5ef4bf1865eb70750b9238be3382a51ded182569d112f37870d43465615ca9174d41f7f3b9eb780a28c7dba674075bbe04538ad669eef7716d1b7b252d49da3b00993f0c829860a1efafdcdc865d46f2f8aec9893b5bc607db33272e5b9f7cf134595e1ad5e8f34b1b7f93ca181c513afc4d8a531c36929e95cfbb4d268a9d94f80201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0603860f0e0101ffffffff0188b6e1110000000023210383d0b37f59f4ee5e3e98a47e461c861d49d0d90c80e9e16f7e63686a2dc071f3ac67954a5b01000000010b1561554a46ec535c4972a3a16652b270ee4af847ec3bbfcf6ba663ebcfefcb1a00000049483045022100b9cd7c1c56d69d9b05d695f9ac86c1233427ec26860774a0eb4e6052fe11ca8502207eca5a4eda1ccf92ccdb501ab7d61cf084d0f4431f059e27ee13ce11f9aa159b01ffffffff0188130000000000002321020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9ac00000000"
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": "submitblock", "params": ["0400000029865a4962f43d6f95fdf9ccc89f82377a23d1fdc41eaf943c7881a5ca55c5018973d81f5ce7ab99f027b15c86ca88ec5e4b6f35ad4018bfc2058568bbe7f526000000000000000000000000000000000000000000000000000000000000000097954a5b9e830c1d1600ac305580abea34bda62eb503b02fc4b7872428cfa60bf5824a9b78fc0000fd400500c80d4a8c84cec781a5740d8d3fb18587a850b6380f073cd861c4ce7c4290460c533e0d4dd3b89fe0f0052ccdf9d450a1dfcd7263a39422000378da3eeb621078af689447a5ed0a7265a857463a36d72cdd35910d14de9816a25d631aeb0249ede829aca77f9cce1a2e4a84b75e4bd515845043d52f718638fb41e92d8b18bfe1f49e1c0d23223a285b2850e8469dfbb9782b20c8bebf2a61d7b7d8eea310c7c8d5bfa612bf94fd05562ec8876eacafa0c334a651ef70c941459161b60c20511087d63223878052d4fd1a92298789d7c57609fe3a247489674592e8e34a1728b28e2c2b3165f01d5fefa22e6384f7fe4e566de1741e264f057a0feb1b35d51694647ba52afd71c3bd375b924da95e2b413dbea256a2de9ccddcab88bd2e69cc3acc8a778b4d1db78b41df9fea6d69b071f570f628ad47537d081740a4f2c4fa6666dbb862a6d02ff07b5ae0a9fa24b003fa0355dbde0425d6c14452f0d357f2cfd97960c343ba73789a2d7ba580ea8834ef656a9e79c49fc0f61aa9452a644c8bc06afe31dce2a7ca5d6995adc8ce1f77165a075399e1d006e2bb57c09ffd6e21fcff440645faef599264a3b8c005cf60683371ba1af8847d1992c64e512f13d9d2d364969759233a27c65e1f2f1113cdb665e3e8f7baa2c398c4a2ee85a6ad1bdb095962fafaa01c3d85bc820653544b89b6e75a584d8d04bc77e5284a9ebbcd46c1a6732b841e46c876976805d932a90ac215bcc37801900d49cfb87fe5c809b30ebd8ece38669153c1f1a2438253a56a6507d556cc16b2990f0bd290fea59462d25eebdbfcb78eb403c8080e0c68e8e2ef8f67145121bce83b94dc8f9d0a742752323c5a4b42409ffcc37053c58596deff7981a20e3f412c07c839a341fdc177d5e28f7909696f90c90efff14048f440e7ea3181378f66d35b0697dc02c60154778f438cdd3dba5dc4c2763319498bbb3b8fae17508b073d07d83f5f1dc71bf2dc205f06245872620dfa341dbcdf9c574598c121120e91dd687dfd08451369ab29a11dc73f69d0722992a1c70cf1498ec9b9143fcb0abfd7b1e39189125e8567cb2cc3d71fcdb541a0776a5a665161f98385633153fc9702f079269a1dac0d2c708f5d94e346159858cfd50624ff5a0505358739b5f41adbe739bf75852eebb06eeccd79e030019a5227cd9a19e77b6821ba0794fe09cb074f40ce0b92c081c31cda2d4711d53889fc6f0579839fa74309768ef0a796fa1fa660e150d3ea5c0a369e1297d11177fc284524d6d5e40eb7ee4b400f6dfd6a10402904394e1694de300ddd565622e7ca7ed62970ff5add0b36a513b5d90d2194cf414ecc97e5dcc88698e06405dea09f49503c81cc61518f8aee882da6eeae09b4127a7fcc0c0829fca8fda3502ebf13ece0a90a8dfd05d8e514452247f79472c20683e2b1fde5ec14a2453bf00f9f1cd5a088d229a7fdfdfdc24f176fb9a8a409af70d894998957394d30a46668d71cd16907aa800ee9d96c2b9fc7fb5a7944a9b8d4f76609fc186e3c0a4d80fb9c8c236f76eb00bc24dd9abddef7d653740ece7141ac6175f7e9cab1cb0216e85adde43907b60c0581336b50ccd7682f28f00f7efd663df4d31701141657da989d236d16052c4b59fc46fb41657a26d7074fbc9dee602f7d03b86179e4c12bc0df253f815319dff12353a478d95febd5f902e363734e6e5ef4bf1865eb70750b9238be3382a51ded182569d112f37870d43465615ca9174d41f7f3b9eb780a28c7dba674075bbe04538ad669eef7716d1b7b252d49da3b00993f0c829860a1efafdcdc865d46f2f8aec9893b5bc607db33272e5b9f7cf134595e1ad5e8f34b1b7f93ca181c513afc4d8a531c36929e95cfbb4d268a9d94f80201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0603860f0e0101ffffffff0188b6e1110000000023210383d0b37f59f4ee5e3e98a47e461c861d49d0d90c80e9e16f7e63686a2dc071f3ac67954a5b01000000010b1561554a46ec535c4972a3a16652b270ee4af847ec3bbfcf6ba663ebcfefcb1a00000049483045022100b9cd7c1c56d69d9b05d695f9ac86c1233427ec26860774a0eb4e6052fe11ca8502207eca5a4eda1ccf92ccdb501ab7d61cf084d0f4431f059e27ee13ce11f9aa159b01ffffffff0188130000000000002321020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9ac00000000"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/