On this page

latest contributor to this doc

Last Edit:

@smk762

Task: UTXO Activation

API-v2task::enable_utxo::init

Use this method for task managed activation of UTXO coins like KMD, LTC, BTC & DOGE. Refer to the task managed activation overview for activation of other coin types.

ParameterTypeDescription
tickerstringThe ticker of the coin you want to enable.
activation_paramsobjectAn object containing the actvation parameters below.
.priv_key_policyobjectOptional. A standard PrivKeyPolicy object. Defaults to {"type": "ContextPrivKey"}.
.min_addresses_numberintegerHow many additional addreesses to generate at a minimum.
.scan_policystringWhether or not to scan for new addresses. Select from do_not_scan, scan_if_new_wallet or scan. Note that scan will result in multple requests to the Komodo DeFi Framework.
.gap_limitintegerThe max number of empty addresses in a row. If transactions were sent to an address outside the gap_limit, they will not be identified when scanning.
.modeobjectAn object containing RPC type and data parameters as below.
..rpcstringUTXO RPC mode. Options: { "rpc":"Native" } if running a native blockchain node, or "rpc":"Electrum" to use electrum RPCs. If using electrum, a list of electrum servers is required under rpc_data.servers
..rpc_dataobjectAn object containing electrum server information.
...serverslistA list of electrum server URLs (https://github.com/KomodoPlatform/coins/tree/master/electrums)
....urlobjectThe url and port of a coins electrum server
....ws_urlobjectOptional. Used to define electrum server url/port for websocket connections.
....protocolobjectDefines electrum server protocol as TCP or SSL. Defaults to TCP
....disable_cert_verificationbooleanOptional. For SSL electrum connections, this will allow expired certificates.

ParameterTypeDescription
task_idintegerAn identifying number which is used to query task status.

task::enable_utxo::init

POST
task::enable_utxo::init
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "task::enable_utxo::init",
  "params": {
    "ticker": "KMD",
    "activation_params": {
      "mode": {
        "rpc": "Electrum",
        "rpc_data": {
          "servers": [
            {
              "url": "electrum2.cipig.net:10001"
            },
            {
              "url": "electrum3.cipig.net:20001",
              "ws_url": "electrum3.cipig.net:30001",
              "protocol": "SSL"
            }
          ]
        }
      },
      "scan_policy": "scan_if_new_wallet",
      "priv_key_policy": {
        "type": "Trezor"
      },
      "min_addresses_number": 3,
      "gap_limit": 20
    }
  }
}
API-v2task::enable_utxo::status

After running the task::enable_utxo::init method, we can query the status of activation to check its progress. The response will return the following:

  • Result of the task (success or error)
  • Progress status (what state the task is in)
  • Required user action (what user should do before the task can continue)

ParameterTypeDescription
task_idintegerThe identifying number returned when initiating the initialisation process.
forget_if_finishedbooleanIf false, will return final response for completed tasks. Optional, defaults to true.

task::enable_utxo::status

POST
task::enable_utxo::status
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "task::enable_utxo::status",
  "params": {
    "task_id": 1,
    "forget_if_finished": false
  }
}
ParameterTypeDescription
statusstringA short indication of how the enabling is progressing.
detailsobjectDepending on the state of enabling progress, this will contain different information as shown in the responses below.

Possible status values while activation is in progress:

  • ActivatingCoin: The first step of activation. It does not require any action from the user.
  • RequestingWalletBalance: The first step of activation, while initial balances info is being requested. It does not require any action from the user.
  • Finishing: Activation process completed
  • WaitingForTrezorToConnect: Waiting for the user to plugin a Trezor device
  • FollowHwDeviceInstructions: Waiting for the user to follow the instructions on the device

Once complete, status will be Ok, and the details object will have the following structure:

ParameterTypeDescription
current_blockintegerBlock height of the coin being activated
tickerstringTicker of the coin being activated.
wallet_balanceobjectA standard WalletBalanceInfo object. Note: the structure may vary based on the get_balances parameter value in the activation request.

ParameterTypeDescription
statusstringA short indication of how the requested process is progressing.
details.resultobjectDepending on the state of process progress, this will contain different information as detailed in the items below.
.errorstringThe ticker of the coin being activated
.error_pathstringUsed for debugging. A reference to the function in code base which returned the error
.error_tracestringUsed for debugging. A trace of lines of code which led to the returned error
.error_typestringAn enumerated error identifier to indicate the category of error
.error_datastringAdditonal context for the error type

Possible Error Cases:

  • TaskTimedOut - Timed out waiting for coin activation, connecting to the device trezor or for user to confirm pubkey)
  • CoinCreationError - Error during activation. E.g. incorrect or inactive electrum servers.
  • HwError - This is the most important error type. Unlike other error types, HwError requires the GUI / User to check the details in error_data field to know which action is required. View the HwError error type details for more info.
API-v2task::enable_utxo::user_action

If the task::enable_utxo::status returns UserActionRequired, we need to use the task::enable_utxo::user_action method to enter our PIN

ParameterTypeDescription
task_idintegerThe identifying number returned when initiating the initialisation process.
user_actionobjectObject containing the params below
user_action.action_typestringWill be TrezorPin for this method
user_action.pinstring (number)When the Trezor device is displaying a grid of numbers for PIN entry, this param will contain your Trezor pin, as mapped through your keyboard numpad. See the image below for more information.
Trezor Pin

ParameterTypeDescription
resultstringThe outcome of the request.

task::enable_utxo::user_action

POST
task::enable_utxo::user_action
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "task::enable_utxo::user_action",
  "params": {
    "task_id": 1,
    "user_action": {
      "action_type": "TrezorPin",
      "pin": "862743"
    }
  }
}
API-v2task::enable_utxo::cancel

If you want to cancel the enabling process before it has completed, you can use this method.

StructureTypeDescription
task_idintegerThe identifying number returned when initiating the enabling process.

StructureTypeDescription
resultstringIndicates task cancellation was succesful.
errorstringAn error message to explain what went wrong.
error_pathstringAn indicator of the class or function which reurned the error.
error_tracestringAn indicator of where in the source code the error was thrown.
error_typestringAn enumerated value for the returned error.
error_datastringThe input task ID which resulted in the error.

task::enable_utxo::cancel

POST
task::enable_utxo::cancel
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "task::enable_utxo::cancel",
  "mmrpc": "2.0",
  "params": {
    "task_id": 1
  }
}