# ZHTLC Coin Methods
ZHTLC coins, like Pirate (ARRR) and the test coin ZOMBIE take a little longer to enable, and use a new two step method to enable. Activation can take a little while the first time, as we need to download some block cache data, and build a wallet database. Subsequent enabling will be faster, but still take a bit longer than other coins. The second step for activation is optional, but allows us to check the status of the activation process.
To withdraw ZHTLC coins, you need to use the task::withdraw methods:
- Generate a transaction with
task::withdraw::init
- Query its status with
task::withdraw::status
- Cancel generating the transaction with
task::withdraw::cancel
# task_enable_z_coin_init
TIP
To enable Z coins you also need to install some Zcash Params (opens new window)
# Arguments
Structure | Type | Description |
---|---|---|
ticker | string | Ticker of coin to activate |
activation_params | object | Contains details required for activation as explained below |
activation_params.required_confirmations | integer | Block confirmations to wait for transactions when doing a swap. Optional, defaults to 3 . Overrides value if set in coins file. |
activation_params.requires_notarization | boolean | For dPoW (opens new window) protected coins, a true value will wait for transactions to be notarised when doing swaps. Optional, defaults to false . Overrides value if set in coins file. |
activation_params.mode.rpc | string | Set as Light to use external electrum & lightwallet_d servers or Native to use local block chain data. If native, the rpc_data fields below are not required. |
activation_params.mode.rpc_data | list of objects | Contains details about servers to be used for Light mode operation. |
..rpc_data.light_wallet_d_servers | list of strings | Urls which are hosting lightwallet_d servers |
..rpc_data.electrum_servers | list of objects | Contains additional details about a coins electrum servers. |
...electrum_servers.protocol | string | Transport protocol used by Komodo DeFi Framework to connect to the electrum server (TCP or SSL ). Optional, defaults to TCP |
...electrum_servers.url | string | The URL and port of an electrum server. |
...electrum_servers.disable_cert_verification | boolean | If true , this disables server SSL/TLS certificate verification (e.g. to use self-signed certificate). Optional, defaults to false Use at your own risk! |
activation_params.zcash_params_path | string | Path to folder containing Zcash parameters (opens new window). Optional, defaults to standard location as defined in this guide (opens new window) |
activation_params.scan_blocks_per_iteration | integer | Sets the number of scanned blocks per iteration during BuildingWalletDb state. Optional, default value is 1000. |
activation_params.scan_interval_ms | integer | Sets the interval in milliseconds between iterations of BuildingWalletDb state. Optional, default value is 0. |
TIP
Using a smaller scan_blocks_per_iteration
and larger scan_interval_ms
, will reduce the average CPU load during Z coin activation (at the cost of a longer activation time). These optional fields are recommended when developing for iOS, where a high CPU load may kill the activation process. Android & desktop operating systems do not appear to have any problems with high CPU load during Z coin activation.
# Response
Structure | Type | Description |
---|---|---|
task_id | integer | An identifying number which is used to query task status. |
# 📌 Examples
# Command
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "
{
\"userpass\": \"$userpass\",
\"method\": \"task::enable_z_coin::init\",
\"mmrpc\": \"2.0\",
\"params\": {
\"ticker\": \"ZOMBIE\",
\"activation_params\": {
\"mode\": {
\"rpc\": \"Light\",
\"rpc_data\": {
\"electrum_servers\": [{\"url\":\"zombie.sirseven.me:10033\"}, {\"url\":\"zombie.dragonhound.info:10033\"}],
\"light_wallet_d_servers\": [\"http://zombie.sirseven.me:443\", \"http://zombie.dragonhound.info:443\"]
}
},
\"zcash_params_path\": \"/home/username/path_to/.zcash-params\",
\"scan_blocks_per_iteration\": 100,
\"scan_interval_ms\": 200
}
}
}"
echo
# task_enable_z_coin_status
After initiating z coin enabling, you can use the task_id
to check progress.
# Arguments
Parameter | Type | Description |
---|---|---|
task_id | integer | The identifying number returned when initiating the initialisation process. |
forget_if_finished | boolean | If false , will return final response for completed tasks. Optional, defaults to true |
# Response
Structure | Type | Description |
---|---|---|
status | string | A short indication of how the enabling is progressing. |
details | object | Depending on the state of enabling progress, this will contain different information as shown in the responses below. |
# 📌 Examples
# Command
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "
{
\"userpass\": \"${userpass}\",
\"method\": \"task::enable_z_coin::status\",
\"mmrpc\": \"2.0\",
\"params\": {
\"task_id\": TASK_ID,
\"forget_if_finished\": false
}
}"
echo
# task_enable_z_coin_cancel
If you want to cancel the enabling process before it has completed, you can use this method.
# Arguments
Structure | Type | Description |
---|---|---|
task_id | integer | The identifying number returned when initiating the enabling process. |
# Response
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. |
# 📌 Examples
# Command
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "
{
\"userpass\": \"${userpass}\",
\"method\": \"task::enable_z_coin::cancel\",
\"mmrpc\": \"2.0\",
\"params\": {
\"task_id\": TASK_ID
}
}"
echo
# z_coin_tx_history
To get the transaction history for ZHTLC coins, you need to use this special method - the v2 my_tx_history and legacy my_tx_history methods are not compatible with ZHTLC coins. Currently trasaction memos will not be displayed in output, though they can be added to outgoing transactions with the task::withdraw methods.
# Arguments
Structure | Type | Description |
---|---|---|
coin | string | Ticker of the coin to get history for. |
limit | integer | Optional. Limits the number of returned transactions. Defaults to 10 . Ignored if max = true . |
paging_options.FromId | string | Optional. Komodo DeFi Framework will skip records until it reaches this ID, skipping the from_id as well; track the internal_id of the last displayed transaction to find the value of this field for the next page |
paging_options.PageNumber | integer | Optional. Komodo DeFi Framework will return limit swaps from the selected page. Ignored if FromId . |
# Response
Structure | Type | Description |
---|---|---|
transactions | array of objects | transactions data |
from_id | string | the from_id specified in the request; this value is null if from_id was not set |
skipped | number | the number of skipped records (i.e. the position of from_id in the list + 1); this value is 0 if from_id was not set |
limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) |
total | number | the total number of transactions available |
page_number | number | the page_number that was set in the request |
total_pages | number | total pages available with the selected limit |
current_block | number | the number of the latest block of coin blockchain |
sync_status | object | provides the information that helps to track the progress of transaction history preloading at background |
sync_status.state | string | current state of sync; possible values: NotEnabled , NotStarted , InProgress , Error , Finished |
sync_status.additional_info | object | additional info that helps to track the progress; present for InProgress and Error states only |
sync_status.additional_info.blocks_left | number | present for ETH/ERC20 coins only; displays the number of blocks left to be processed for InProgress state |
sync_status.additional_info.transactions_left | number | present for UTXO coins only; displays the number of transactions left to be processed for InProgress state |
sync_status.additional_info.code | number | displays the error code for Error state |
sync_status.additional_info.message | number | displays the error message for Error state |
# 📌 Examples
# Command
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{
\"userpass\": \"$userpass\",
\"method\": \"z_coin_tx_history\",
\"mmrpc\": \"2.0\",
\"params\": {
\"coin\": \"ARRR\",
\"limit\": 2,
\"paging_options\": {
\"PageNumber\": 2
}
}
}"
echo ""