Util
The following RPC calls interact with the komodod
software, and are made available through the komodo-cli
software.
createmultisig nrequired [ "key", ... ]
The createmultisig
method creates a multi-signature address with n
signature(s) of m
key(s) required. The method returns a json object with the address and redeemScript.
Name | Type | Description |
---|---|---|
number_required | (numeric, required) | the number of required signatures out of the n key(s) or address(es) |
"keys" | (string, required) | a json array of keys which are addresses or hex-encoded public keys |
"key" | (string) | an address or hex-encoded public key |
Name | Type | Description |
---|---|---|
"address" | (string) | the value of the new multisig address |
"redeemScript" | (string) | the string value of the hex-encoded redemption script |
Command:
./komodo-cli createmultisig 2 "[\"RJnVEQgucK1iwiRjfTZmreXkF49KgTErDn\",\"RCVyjn9MQ8Tw6YRJnDcsx67kfsmfUgLdfw\"]"
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": "createmultisig", "params": [2, ["RJnVEQgucK1iwiRjfTZmreXkF49KgTErDn","RCVyjn9MQ8Tw6YRJnDcsx67kfsmfUgLdfw"]] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
decodeccopret scriptPubKey
The decodeccopret
method decodes the OP RETURN data from a CC transaction to output the EVALCODE
and function id
of the method that produced the transaction.
The OP RETURN data from a CC transaction can be found by following these steps:
- Decode a transaction produced by a CC module using the method getrawtransaction's verbose option.
- Look for the
vout
key; it is an array of jsons - Find the json that contains the
scriptPubkey
, and which has thetype:nulldata
key pair - Copy the
hex
value from thatscriptPubkey
json - This is the hex-string that is expected as the argument for the above method.
- You can verify that the transaction was produced by a CC module by checking if one of the
vout
json'sscriptPubkey
json has thetype:cryptocondition
key pair
Name | Type | Description |
---|---|---|
scriptPubKey | (string) | the hex-string format scriptPubKey of the type : nulldata in the vout of a transaction produced by a CC module |
Name | Type | Description |
---|---|---|
result | (string) | whether the call succeeded |
OpRets | (json) | a json containing the keys EVALCODE and function id |
eval_code | (hexadecimal number) | the EVALCODE of the method that produced the transaction |
function | (string) | the function id of the method that produced the transaction |
Command:
./komodo-cli decodeccopret 6a2412782103d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a
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": "decodeccopret", "params": ["6a2412782103d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
estimatefee nblocks
The estimatefee
method estimates the approximate fee per kilobyte. The method is needed for a transaction to begin confirmation within nblocks
blocks.
The value -1.0
is returned if not enough transactions and blocks have been observed to make an estimate.
Name | Type | Description |
---|---|---|
nblocks | (numeric) | the number of blocks within which the fee should be tested |
Name | Type | Description |
---|---|---|
n | (numeric) | the estimated fee |
Command:
./komodo-cli estimatefee 6
estimatepriority nblocks
The estimatepriority
method estimates the approximate priority of a zero-fee transaction, when it needs to begin confirmation within nblocks
blocks.
The value -1.0
is returned if not enough transactions and blocks have been observed to make an estimate.
Name | Type | Description |
---|---|---|
nblocks | (numeric) | a statement indicating within how many blocks the transaction should be confirmed |
Name | Type | Description |
---|---|---|
n | (numeric) | the estimated priority |
Command:
./komodo-cli estimatepriority 6
invalidateblock "hash"
The invalidateblock
method permanently marks a block as invalid, as if it violated a consensus rule.
Name | Type | Description |
---|---|---|
hash | (string, required) | the hash of the block to mark as invalid |
Name | Type | Description |
---|---|---|
(none) |
Command:
./komodo-cli invalidateblock "02f51fb2793b0728050c5e983ffed669594e0a2dda01dcb7a68d129fd87436e0"
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": "invalidateblock", "params": ["02f51fb2793b0728050c5e983ffed669594e0a2dda01dcb7a68d129fd87436e0"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
reconsiderblock "hash"
The reconsiderblock
method removes invalidity status of a block and its descendants, reconsidering them for activation. This can be used to undo the effects of the invalidateblock
method.
Name | Type | Description |
---|---|---|
hash | (string, required) | the hash of the block to reconsider |
Name | Type | Description |
---|---|---|
(none) |
Command:
./komodo-cli reconsiderblock "02f51fb2793b0728050c5e983ffed669594e0a2dda01dcb7a68d129fd87436e0"
txnotarizedconfirmed txid
The txnotarizedconfirmed
method returns information about a transaction's state of confirmation.
If the transaction is on a chain that has Komodo's dPoW security service, the method returns true
if the transaction is notarized.
If the chain does not have dPoW, the method returned true
if the confirmation number is greater than 60
.
Name | Type | Description |
---|---|---|
"txid" | (string, required) | the transaction id |
Name | Type | Description |
---|---|---|
"result" | (boolean) | whether the transaction is confirmed, for dPoW-based chains; for non-dPoW chains, the value indicates whether the transaction has 60 or more confirmations |
Command:
./komodo-cli txnotarizedconfirmed ce1e3df1fb24ab3301b4032c3a0af466ca03b9365f8c649511bdd72f5519fecb
validateaddress "komodoaddress"
The validateaddress
method returns information about the given address.
Name | Type | Description |
---|---|---|
"address" | (string, required) | the address to validate |
Name | Type | Description |
---|---|---|
"isvalid" | (boolean) | indicates whether the address is valid. If it is not, this is the only property returned. |
"address" | (string) | the address validated |
"scriptPubKey" | (string) | the hex encoded scriptPubKey generated by the address |
"ismine" | (boolean) | indicates whether the address is yours |
"isscript" | (boolean) | whether the key is a script |
"pubkey" | (string) | the hex value of the raw public key |
"iscompressed" | (boolean) | whether the address is compressed |
"account" | (string) | DEPRECATED the account associated with the address; "" is the default account |
Command:
./komodo-cli validateaddress "RDNC9mLrN48pVGDQ5jSoPb2nRsUPJ5t2R7"
verifymessage "address" "signature" "message"
The verifymessage
method verifies a signed message.
See also signmessage.
Name | Type | Description |
---|---|---|
"address" | (string, required) | the address to use for the signature |
"signature" | (string, required) | the signature provided by the signer in base 64 encoding |
"message" | (string, required) | the message that was signed |
Name | Type | Description |
---|---|---|
true/false | (boolean) | indicates whether the signature is verified |
Create the signature:
Command:
./komodo-cli signmessage "RBtNBJjWKVKPFG4To5Yce9TWWmc2AenzfZ" "my message"
Verify the signature:
Command:
./komodo-cli verifymessage "RBtNBJjWKVKPFG4To5Yce9TWWmc2AenzfZ" "H1y0mn/wRv56r1bcfkbQtzjG6XeWSelAsyayBuCwEL9XGXs7ieU55dryt/cFWM9gnRFI7gS01AByuSqRs+o/AZs=" "my message"
z_validateaddress "zaddr"
The z_validateaddress
method returns information about the given z address.
Name | Type | Description |
---|---|---|
"zaddr" | (string, required) | the z address to validate |
Name | Type | Description |
---|---|---|
"isvalid" | (boolean) | indicates whether the address is valid; if not, this is the only property returned |
"address" | (string) | the z address validated |
"ismine" | (boolean) | indicates if the address is yours or not |
"payingkey" | (string) | the hex value of the paying key, a_pk |
"transmissionkey" | (string) | the hex value of the transmission key, pk_enc |
Command:
./komodo-cli z_validateaddress "zcWsmqT4X2V4jgxbgiCzyrAfRT1vi1F4sn7M5Pkh66izzw8Uk7LBGAH3DtcSMJeUb2pi3W4SQF8LMKkU2cUuVP68yAGcomL"