latest contributor to this doc

Last Edit: @smk762 ,

Generating

The following RPC calls interact with the komodod software, and are made available through the komodo-cli software.

generate numblocks

This function can only be used in the regtest mode (for testing purposes).

The generate method instructs the coin daemon to immediately mine the indicated number of blocks.

NameTypeDescription
numblocks(numeric)the desired number of blocks to generate

NameTypeDescription
blockhashes(array)hashes of blocks generated

Command:

./komodo-cli generate 2

getgenerate

The getgenerate method returns a boolean value indicating the server's mining status.

The default value is false.

See also gen.

NameTypeDescription
(none)(none)

NameTypeDescription
true/false(boolean)indicates whether the server is set to generate coins

Command:

./komodo-cli getgenerate

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": "getgenerate", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

setgenerate generate ( genproclimit )

The setgenerate method allows the user to set the generate property in the coin daemon to true or false, thus turning generation (mining/staking) on or off.

Generation is limited to genproclimit processors. Set genproclimit to -1 to use maximum available processors.

See also the getgenerate method to query the current setting, and genproclimit for setting the default number of processors the daemon uses through the .conf file.

NameTypeDescription
generate(boolean, required)set to true to turn on generation; set to off to turn off generation
genproclimit(numeric, optional)set the processor limit for when generation is on; use value "-1" for unlimited

NameTypeDescription
(none)(none)

Command:

./komodo-cli setgenerate true -1

Command:

./komodo-cli setgenerate true 0

Command:

./komodo-cli setgenerate true 4

Command:

./komodo-cli getgenerate

Command:

./komodo-cli setgenerate false

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "setgenerate", "params": [true, 1] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/