On this page

latest contributor to this doc

Last Edit:

@smk762

enable_bch_with_tokens

The Komodo DeFi Framework supports Bitcoin Cash SLP tokens. Using this method, you can enable BCH/tBCH along with multiple SLP tokens in a single command.

This activation method is deprecated, and no longer in use. BCH activation should be done via task::enable_bch::init

ParameterTypeDescription
tickerstringTicker of the platform protocol coin. Options: BCH or tBCH
bchd_urlsarray of stringsA 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/.
modeobjectA standard ActivationMode object.
tx_historybooleanIf true, spawns a background loop to store the local cache of address(es) transactions. Defaults to false.
slp_tokens_requestsarray of objectsA list of standard TokensRequest objects.
address_formatobjectOptional. Overwrites the address format from coins file, if set. A standard AddressFormat object.
allow_slp_unsafe_confbooleanOptional, defaults to false. 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_balancesbooleanOptional, defaults to true. If false, coin and token balances will not be returned in the response, and the response will be returned more quickly.
required_confirmationsintegerOptional, defaults to value in the coins file, or 3 if not set. Confirmations to wait for steps in swap.
requires_notarizationbooleanOptional, defaults to true. Has no effect on BCH.
tx_historybooleanOptional, defaults to true. 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
utxo_merge_paramsobjectA standard UtxoMergeParams object. Used to reduce a wallet's UTXO count in cases where it is causing significantly slower RPC responses.

ParameterTypeDescription
current_blockintegerBlock height of the coin being activated
bch_addresses_infosobjectA standard AddressInfo object. Note: the structure may vary based on the value of the get_balances parameter.
slp_addresses_infosobjectA standard AddressInfo object. Note: the structure may vary based on the value of the get_balances parameter.

POST
enable_bch_with_tokens
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "enable_bch_with_tokens",
  "mmrpc": "2.0",
  "params": {
    "ticker": "BCH",
    "allow_slp_unsafe_conf": false,
    "bchd_urls": [
      "https://bchd.dragonhound.info"
    ],
    "mode": {
      "rpc": "Electrum",
      "rpc_data": {
        "servers": [
          {
            "url": "bch.imaginary.cash:50002",
            "protocol": "SSL"
          },
          {
            "url": "cashnode.bch.ninja:50002",
            "protocol": "SSL"
          },
          {
            "url": "electrum3.cipig.net:20055",
            "protocol": "SSL"
          }
        ]
      }
    },
    "tx_history": true,
    "slp_tokens_requests": [
      {
        "ticker": "ASLP-SLP",
        "required_confirmations": 4
      }
    ],
    "required_confirmations": 5,
    "requires_notarization": false,
    "address_format": {
      "format": "cashaddress",
      "network": "bitcoincash"
    },
    "utxo_merge_params": {
      "merge_at": 50,
      "check_every": 10,
      "max_merge_at_once": 25
    }
  }
}

{
	"mmrpc": "2.0",
	"result": {
		"current_block": 1480481,
		"bch_addresses_infos": {
			"bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": {
				"derivation_method": {
					"type": "Iguana"
				},
				"pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c",
				"balances": {
					"spendable": "0.11398301",
					"unspendable": "0.00001"
				}
			}
		},
		"slp_addresses_infos": {
			"simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v": {
				"derivation_method": {
					"type": "Iguana"
				},
				"pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c",
				"balances": {
					"ASLP": {
						"spendable": "5.2974",
						"unspendable": "0"
					}
				}
			}
		}
	},
	"id": null
}

POST
enable_bch_with_tokens
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "enable_bch_with_tokens",
  "mmrpc": "2.0",
  "params": {
    "ticker": "BCH",
    "allow_slp_unsafe_conf": false,
    "bchd_urls": [
      "https://bchd.dragonhound.info"
    ],
    "mode": {
      "rpc": "Electrum",
      "rpc_data": {
        "servers": [
          {
            "url": "bch.imaginary.cash:50002",
            "protocol": "SSL"
          },
          {
            "url": "cashnode.bch.ninja:50002",
            "protocol": "SSL"
          },
          {
            "url": "electrum3.cipig.net:20055",
            "protocol": "SSL"
          }
        ]
      }
    },
    "tx_history": true,
    "get_balances": false,
    "slp_tokens_requests": [
      {
        "ticker": "ASLP-SLP",
        "required_confirmations": 4
      }
    ]
  }
}

{
	"mmrpc": "2.0",
	"result": {
		"current_block": 791267,
		"bch_addresses_infos": {
			"bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": {
				"derivation_method": {
					"type": "Iguana"
				},
				"pubkey": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2"
			}
		},
		"slp_addresses_infos": {
			"simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v": {
				"derivation_method": {
					"type": "Iguana"
				},
				"pubkey": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2",
				"tickers": ["ASLP-SLP"]
			}
		}
	},
	"id": null
}

StructureTypeDescription
CoinProtocolParseErrorstringParsing the protocol of the platform coin you are trying to activate failed
InternalErrorstringThe request was failed due to an Komodo DeFi Framework API internal error
PlatformCoinCreationErrorstringThere was an error when trying to activate the platform coin
PlatformConfigIsNotFoundstringConfig of the platform coin you are trying to activate is not found
PlatformIsAlreadyActivatedstringThe platform coin you are trying to activate is already activated
PrivKeyNotAllowedstringThe privkey is not allowed
TokenConfigIsNotFoundstringConfig of the token you are trying to activate is not found
TokenProtocolParseErrorstringParsing the protocol of the token you are trying to activate failed
TransportstringThe request was failed due to a network error
UnexpectedDerivationMethodstringThe derivation method used is unexpected
UnexpectedPlatformProtocolstringUnexpected platform protocol found for the platform coin you are trying to activate
UnexpectedTokenProtocolstringUnexpected protocol is found in the config of the token you are trying to activate

In this case, you need to disable BCH and try again.

{
    "mmrpc": "2.0",
    "error": "BCH",
    "error_path": "platform_coin_with_tokens",
    "error_trace": "platform_coin_with_tokens:281]",
    "error_type": "PlatformIsAlreadyActivated",
    "error_data": "BCH",
    "id": null
}

{
    "mmrpc": "2.0",
    "error": "Platform BCH-wrong config is not found",
    "error_path": "platform_coin_with_tokens.prelude",
    "error_trace": "platform_coin_with_tokens:286] prelude:56]",
    "error_type": "PlatformConfigIsNotFound",
    "error_data": "BCH-wrong",
    "id": null
}

{
    "mmrpc": "2.0",
    "error": "Unexpected platform protocol UTXO for BTC",
    "error_path": "platform_coin_with_tokens.prelude.bch_with_tokens_activation",
    "error_trace": "platform_coin_with_tokens:286] prelude:67] bch_with_tokens_activation:127]",
    "error_type": "UnexpectedPlatformProtocol",
    "error_data": {
        "ticker": "BTC",
        "protocol": {
            "type": "UTXO"
        }
    },
    "id": null
}

{
    "mmrpc": "2.0",
    "error": "Unexpected token protocol ERC20 { platform: \"ETH\", contract_address: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\" } for USDT-ERC20",
    "error_path": "platform_coin_with_tokens.prelude.slp_token_activation",
    "error_trace": "platform_coin_with_tokens:301] platform_coin_with_tokens:114] prelude:67] slp_token_activation:47]",
    "error_type": "UnexpectedTokenProtocol",
    "error_data": {
        "ticker": "USDT-ERC20",
        "protocol": {
            "type": "ERC20",
            "protocol_data": {
                "platform": "ETH",
                "contract_address": "0xdAC17F958D2ee523a2206206994597C13D831ec7"
            }
        }
    },
    "id": null
}

{
    "mmrpc": "2.0",
    "error": "Error Using empty bchd_urls is unsafe for SLP users! on platform coin BCH creation",
    "error_path": "platform_coin_with_tokens.bch_with_tokens_activation",
    "error_trace": "platform_coin_with_tokens:290] bch_with_tokens_activation:212]",
    "error_type": "PlatformCoinCreationError",
    "error_data": {
        "ticker": "BCH",
        "error": "Using empty bchd_urls is unsafe for SLP users!"
    },
    "id": null
}

{
    "mmrpc": "2.0",
    "error": "Error bch:633] utxo:1704] utxo:995] Error parsing the native wallet configuration '/home/user/.Bitcoin Cash Testnet/Bitcoin Cash Testnet.conf': No such file or directory (os error 2) on platform coin tBCH creation",
    "error_path": "platform_coin_with_tokens.bch_with_tokens_activation",
    "error_trace": "platform_coin_with_tokens:290] bch_with_tokens_activation:212]",
    "error_type": "PlatformCoinCreationError",
    "error_data": {
        "ticker": "tBCH",
        "error": "bch:633] utxo:1704] utxo:995] Error parsing the native wallet configuration '/home/user/.Bitcoin Cash Testnet/Bitcoin Cash Testnet.conf': No such file or directory (os error 2)"
    },
    "id": null
}

{
    "mmrpc": "2.0",
    "error": "Error bch:633] utxo:1667] Failed to connect to at least 1 of [ElectrumRpcRequest { url: \"bch0.kister.net:5100\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"testnet.imaginary.cash:5000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"blackie.c3-soft.com:6000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"tbch.loping.net:6000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"electroncash.de:5000\", protocol: TCP, disable_cert_verification: false }] in 5 seconds. on platform coin tBCH creation",
    "error_path": "platform_coin_with_tokens.bch_with_tokens_activation",
    "error_trace": "platform_coin_with_tokens:290] bch_with_tokens_activation:212]",
    "error_type": "PlatformCoinCreationError",
    "error_data": {
        "ticker": "tBCH",
        "error": "bch:633] utxo:1667] Failed to connect to at least 1 of [ElectrumRpcRequest { url: \"bch0.kister.net:5100\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"testnet.imaginary.cash:5000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"blackie.c3-soft.com:6000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"tbch.loping.net:6000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"electroncash.de:5000\", protocol: TCP, disable_cert_verification: false }] in 5 seconds."
    },
    "id": null
}