Task: BCH/SLP Activation
This activation method is deprecated, and no longer in use. BCH activation should be done via task::enable_bch::init
Use this method for task managed activation of BCH and SLP tokens. Refer to the task managed activation overview for activation of other coin types.
Parameter* = required | Type | Description |
---|---|---|
bchd_urls* | array of strings | A list of BCHD gRPC API server URLs, used for validation of SLP token transactions. It's recommended to add as many servers as possible. The URLs list can be found at https://bchd.fountainhead.cash/. |
mode* | object | A standard ActivationMode object. |
slp_tokens_requests* | array of objects | A list of standard TokensRequest objects. |
ticker* | string | Ticker of the platform protocol coin. Options: BCH or tBCH |
utxo_merge_params* | object | A standard UtxoMergeParams object. Used to reduce a wallet's UTXO count in cases where it is causing significantly slower RPC responses. |
address_format | object | Optional. Overwrites the address format from coins file, if set. A standard AddressFormat object. |
allow_slp_unsafe_conf | boolean default: `false` | Optional. If true , allows bchd_urls to be empty. **Warning:** it is highly unsafe to do so as it may lead to invalid SLP transactions generation and tokens burning. |
get_balances | boolean default: `true` | Optional. If false , coin and token balances will not be returned in the response, and the response will be returned more quickly. |
required_confirmations | integer default: value in the coins file, or `3` if not set | Optional. Confirmations to wait for steps in swap. |
requires_notarization | boolean default: `true` | Optional. Has no effect on BCH. |
tx_history | boolean default: `false` | Optional. If true , spawns a background loop to store the local cache of address(es) transactions. |
tx_history | boolean default: `true` | Optional. If true the Komodo DeFi Framework API will preload transaction history as a background process. Must be set to true to use the my_tx_history method |
Parameter* = required | Type | Description |
---|---|---|
task_id* | integer | An identifying number which is used to query task status. |
task::enable_bch::init
{
"method": "task::enable_bch::init",
"mmrpc": "2.0",
"params": {
"activation_params": {
"address_format": {
"format": "cashaddress",
"network": "bitcoincash"
},
"bchd_urls": [
"https://bchd.dragonhound.info"
],
"mode": {
"rpc": "Electrum",
"rpc_data": {
"servers": [
{
"protocol": "SSL",
"url": "bch.electrum3.cipig.net:20055"
},
{
"protocol": "TCP",
"url": "bch.electrum3.cipig.net:10055"
},
{
"protocol": "WSS",
"url": "bch.electrum3.cipig.net:30055"
}
]
}
},
"required_confirmations": 5,
"requires_notarization": false,
"slp_tokens_requests": [
{
"required_confirmations": 3,
"ticker": "ASLP-SLP"
},
{
"ticker": "USDF"
}
],
"tx_history": true,
"utxo_merge_params": {
"check_every": 10,
"max_merge_at_once": 25,
"merge_at": 50
}
},
"ticker": "BCH"
},
"userpass": "RPC_UserP@SSW0RD"
}
{
"mmrpc": "2.0",
"result": {
"task_id": 1
},
"id": null
}
After running the task::enable_bch::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)
Parameter* = required | Type | Description |
---|---|---|
task_id* | integer | The identifying number returned when initiating the initialisation process. |
forget_if_finished | boolean default: `true` | Optional. If false , will return final response for completed tasks. |
task::enable_bch::status
{
"method": "task::enable_bch::status",
"mmrpc": "2.0",
"params": {
"forget_if_finished": false,
"task_id": 0
},
"userpass": "RPC_UserP@SSW0RD"
}
Parameter* = required | Type | Description |
---|---|---|
details* | object | Depending on the state of enabling progress, this will contain different information as shown in the responses below. |
status* | string | A short indication of how the enabling is progressing. |
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 completedWaitingForTrezorToConnect
: Waiting for the user to plugin a Trezor deviceFollowHwDeviceInstructions
: 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:
Parameter | Type | Description |
---|---|---|
current_block | integer | Block height of the coin being activated |
ticker | string | Ticker of the coin being activated. |
wallet_balance | object | A standard WalletBalanceInfo object. Note: the structure may vary based on the get_balances parameter value in the activation request. |
{
"mmrpc": "2.0",
"result": {
"status": "Ok",
"details": {
"ticker": "BCH",
"current_block": 895348,
"wallet_balance": {
"wallet_type": "HD",
"accounts": [
{
"account_index": 0,
"derivation_path": "m/44'/145'/0'",
"total_balance": {
"BCH": {
"spendable": "0",
"unspendable": "0"
}
},
"addresses": [
{
"address": "bitcoincash:qq6qvc33strtjwnfktdqswwvxuhrhs2ussavvhv3a0",
"derivation_path": "m/44'/145'/0'/0/0",
"chain": "External",
"balance": {
"BCH": {
"spendable": "0",
"unspendable": "0"
}
}
}
]
}
]
}
}
},
"id": null
}
Parameter | Type | Description |
---|---|---|
current_block | integer | Block height of the coin being activated |
ticker | string | Ticker of the coin being activated. |
wallet_balance | object | A standard WalletBalanceInfo object. Note: the structure may vary based on the get_balances parameter value in the activation request. |
{
"mmrpc": "2.0",
"result": {
"status": "InProgress",
"details": "RequestingWalletBalance"
},
"id": null
}
Parameter | Type | Description |
---|---|---|
status | string | A short indication of how the requested process is progressing. |
details.result | object | Depending on the state of process progress, this will contain different information as detailed in the items below. |
.error | string | The ticker of the coin being activated |
.error_path | string | Used for debugging. A reference to the function in code base which returned the error |
.error_trace | string | Used for debugging. A trace of lines of code which led to the returned error |
.error_type | string | An enumerated error identifier to indicate the category of error |
.error_data | string | Additonal 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 inerror_data
field to know which action is required. View the HwError error type details for more info.
If the task::enable_bch::status
returns UserActionRequired
, we need to use the task::enable_bch::user_action
method to enter our PIN
Parameter | Type | Description |
---|---|---|
task_id | integer | The identifying number returned when initiating the initialisation process. |
user_action | object | Object containing the params below |
user_action.action_type | string | Will be TrezorPin for this method |
user_action.pin | string (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. |
Parameter | Type | Description |
---|---|---|
result | string | The outcome of the request. |
task::enable_bch::user_action
{
"method": "task::enable_bch::user_action",
"mmrpc": "2.0",
"params": {
"task_id": 0,
"user_action": {
"action_type": "TrezorPin",
"pin": "862743"
}
},
"userpass": "RPC_UserP@SSW0RD"
}
{
"mmrpc": "2.0",
"result": "success",
"id": null
}
If you want to cancel the enabling process before it has completed, you can use this method.
Structure | Type | Description |
---|---|---|
task_id | integer | The identifying number returned when initiating the enabling process. |
Structure | Type | Description |
---|---|---|
result | string | Indicates task cancellation was succesful. |
error | string | An error message to explain what went wrong. |
error_path | string | An indicator of the class or function which reurned the error. |
error_trace | string | An indicator of where in the source code the error was thrown. |
error_type | string | An enumerated value for the returned error. |
error_data | string | The input task ID which resulted in the error. |
task::enable_bch::cancel
{
"method": "task::enable_bch::cancel",
"mmrpc": "2.0",
"params": {
"task_id": 3
},
"userpass": "RPC_UserP@SSW0RD"
}
{
"mmrpc": "2.0",
"result": "success",
"id": null
}
{
"mmrpc": "2.0",
"error": "Task is finished already",
"error_path": "init_standalone_coin.manager",
"error_trace": "init_standalone_coin:144] manager:101]",
"error_type": "TaskFinished",
"error_data": 0,
"id": null
}
{
"mmrpc": "2.0",
"error": "No such task '1'",
"error_path": "init_standalone_coin",
"error_trace": "init_standalone_coin:119]",
"error_type": "NoSuchTask",
"error_data": 1,
"id": null
}