On this page

latest contributor to this doc

Last Edit:

@smk762

Komodo DeFi SDK RPC Protocol v2.0

Starting with version beta-2.1.3434, the Komodo DeFi SDK supports the standardized protocol format called mmrpc 2.0.

It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the mmrpc 2.0 protocol.

StructureTypeDescription
mmrpcstringthe string specifying the version of the Komodo DeFi SDK RPC protocol. Must be exactly "2.0"
userpassstring (optional)your password for protected RPC methods. Skip this field if the specified method is public
methodstringthe name of the method to be invoked
paramsobject (optional)a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments
idnumber (optional)the identifier is established by the client. Komodo DeFi SDK will reply with the same value in the Response object if the id field is included and not NULL

StructureTypeDescription
mmrpcstringthe string specifying the version of the Komodo DeFi SDK RPC protocol
resultobjectthe value of this field is determined by the method invoked on Komodo DeFi SDK
idnumber (optional)the identifier established by the client. The same value as in the Request if it was passed

StructureTypeDescription
mmrpcstringthe string specifying the version of the Komodo DeFi API RPC protocol
errorstringthe common error description
error_pathstringthe error path consisting of file names separated by a dot similar to JSON path notation
error_tracestringthe error path consisting of file and line number pairs separated by ']'
error_typestringthe string error identifier used to determine the cause of the error
error_dataobjectan object containing the error data of the corresponding error_type
idnumber (optional)the identifier established by the client. The same value as in the Request if it was passed

POST
withdraw
{
  "mmrpc": "2.0",
  "userpass": "RPC_UserP@SSW0RD",
  "method": "withdraw",
  "params": {
    "coin": "KMD",
    "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh",
    "amount": "10"
  },
  "id": 0
}

The folowing objects are used in the request or response of multiple Komodo DeFi SDK methods.

The available balance is not sufficient to transfer the specified amount.

StructureTypeDescription
coinstringthe name of the coin which balance is not sufficient. This coin name may differ from the requested coin. For example, ERC20 fees are paid by ETH (gas)
availablestring (numeric)the balance available for transfer
requiredstring (numeric)the amount required to transfer the specified amount. This amount is necessary but may not be sufficient

{
  "mmrpc": "2.0",
  "error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001",
  "error_path": "utxo_common",
  "error_trace": "utxo_common:1379] utxo_common:449]",
  "error_type": "NotSufficientBalance",
  "error_data": {
    "coin": "DOC",
    "available": "69.75066225",
    "required": "1000.00001"
  },
  "id": 0
}

The available balance is zero.

StructureTypeDescription
(none)

The specified amount is too low. Required at least threshold.

StructureTypeDescription
amountstring (numeric)the amount the user was willing to transfer
thresholdstring (numeric)the amount has not to be less than the threshold

The specified to address is not valid.

StructureTypeDescription
(none)stringthe error description

The specified fee is not valid.

StructureTypeDescription
(none)stringthe error description

{
  "mmrpc": "2.0",
  "error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas",
  "error_path": "utxo_common",
  "error_trace": "utxo_common:1371]",
  "error_type": "InvalidFeePolicy",
  "error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas",
  "id": 0
}

{
  "mmrpc": "2.0",
  "error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed",
  "error_path": "eth",
  "error_trace": "eth:535]",
  "error_type": "InvalidFeePolicy",
  "error_data": "Expected 'EthGas' fee type, found UtxoFixed",
  "id": 0
}

The specified coin was not found or is not activated yet.

StructureTypeDescription
coinstringthe not found coin specified in the Request

The request was failed due to a network error.

StructureTypeDescription
(none)stringthe transport error description

The request was failed due to an Komodo DeFi API internal error.

StructureTypeDescription
(none)stringthe internal error description

{
  "mmrpc": "2.0",
  "error": "TTT-SLP",
  "error_path": "my_tx_history_v2.lp_coins",
  "error_trace": "my_tx_history_v2:389] lp_coins:2847]",
  "error_type": "CoinIsNotActive",
  "error_data": "TTT-SLP",
  "id": null
}

{
  "mmrpc": "2.0",
  "error": "TTT-SLP",
  "error_path": "my_tx_history_v2",
  "error_trace": "my_tx_history_v2:336]",
  "error_type": "NotSupportedFor",
  "error_data": "TTT-SLP",
  "id": null
}

{
  "mmrpc": "2.0",
  "error": "Storage is not initialized for TTT-SLP",
  "error_path": "my_tx_history_v2",
  "error_trace": "my_tx_history_v2:343]",
  "error_type": "StorageIsNotInitialized",
  "error_data": "Storage is not initialized for TTT-SLP",
  "id": null
}

{
  "mmrpc": "2.0",
  "error": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))",
  "error_path": "my_tx_history_v2.sql_tx_history_storage",
  "error_trace": "my_tx_history_v2:351] sql_tx_history_storage:472]",
  "error_type": "StorageError",
  "error_data": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))",
  "id": null
}