On this page

latest contributor to this doc

Last Edit:

@smk762

Withdraw Coins

API-v2withdraw

The withdraw method generates, signs, and returns a transaction that transfers the amount of coin to the address indicated in the to argument.

This method generates a raw transaction which should then be broadcast using send_raw_transaction.

ParameterTypeRequiredDefaultDescription
coinstring-The name of the coin the user desires to withdraw.
tostring-Coins are withdrawn to this address.
amountstring (numeric)-The amount the user desires to withdraw, ignored when max=true.
feeobject-A standard FeeInfo object.
fromobject-HD wallets only. A standard WithdrawFromInfo object.
ibc_source_channelinteger-Tendermint IBC transfers only. The source channel for the IBC transaction.
maxboolfalseWithdraw the maximum available amount.
memostring-Adds a transaction memo for compatible coins (e.g., Tendermint ecosystem).
broadcastboolfalseOptional, defaults to false. When false, signed transaction hex must be broadcast manually with send_raw_transaction. Must be set to true for Metamask managed transactions.

ParameterTypeDescription
coinstringThe name of the coin the user wants to withdraw.
fee_detailsobjectThe fee details of the generated transaction; this value differs for UTXO and ETH/ERC20 coins. Check the examples for more details.
fromarray of stringsCoins are withdrawn from this address; the array contains a single element, but transactions may be sent from several addresses (UTXO coins).
kmd_rewardsobject (optional)An object containing information about accrued rewards; always exists if the coin is KMD.
kmd_rewards.amountstring (numeric, optional)The amount of accrued rewards.
kmd_rewards.claimed_by_mebool (optional)Whether the rewards have been claimed by me.
my_balance_changestring (numeric)The expected balance change in my_address after the transaction broadcasts.
received_by_mestring (numeric)The amount of coins received by my_address after the transaction broadcasts; the value may be above zero when the transaction requires that the Komodo DeFi Framework API send change to my_address.
spent_by_mestring (numeric)The amount of coins spent by my_address; this value may differ from the request amount, as the transaction fee is added here.
toarray of stringsCoins are withdrawn to this address; this may contain the my_address address, where change from UTXO coins is sent.
total_amountstring (numeric)The total amount of coins transferred.
tx_hashstringThe hash of the generated transaction.
tx_hexstringTransaction bytes in hexadecimal format; use this value as input for send_raw_transaction. Not used for Sia protocol coins.
tx_jsonobjectFor Sia protocol coins only. The transaction details in JSON format. Use this value as input for send_raw_transaction.

Withdraw

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

Withdraw

POST
withdraw
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "withdraw",
  "params": {
    "coin": "MCL",
    "to": "RNBA756iaFCx2Uhya3pvCufbeyovAaknJL",
    "amount": 1.025,
    "from": {
      "derivation_path": "m/44'/141'/0'/0/0"
    }
  },
  "id": 0
}

Withdraw

POST
withdraw
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "withdraw",
  "params": {
    "coin": "VRSC",
    "to": "RNBA756iaFCx2Uhya3pvCufbeyovAaknJL",
    "amount": 1.025,
    "from": {
      "account_id": 0,
      "chain": "External",
      "address_id": 2
    }
  },
  "id": 0
}

Withdraw

POST
withdraw
{
  "mmrpc": "2.0",
  "userpass": "RPC_UserP@SSW0RD",
  "method": "withdraw",
  "params": {
    "coin": "DOC",
    "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW",
    "amount": "1.0",
    "fee": {
      "type": "UtxoFixed",
      "amount": "0.1"
    }
  },
  "id": 0
}

Withdraw

POST
withdraw
{
  "mmrpc": "2.0",
  "userpass": "RPC_UserP@SSW0RD",
  "method": "withdraw",
  "params": {
    "coin": "DOC",
    "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW",
    "amount": "1.0",
    "fee": {
      "type": "UtxoPerKbyte",
      "amount": "1"
    }
  },
  "id": 0
}

Withdraw

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

Withdraw

POST
withdraw
{
  "mmrpc": "2.0",
  "userpass": "RPC_UserP@SSW0RD",
  "method": "withdraw",
  "params": {
    "coin": "COIN_NAME",
    "to": "RECIPIENT_ADDRESS",
    "amount": "AMOUNT",
    "fee": {
      "type": "EthGas",
      "gas_price": "3.5",
      "gas": 55000
    }
  },
  "id": 0
}

Withdraw

POST
withdraw
{
  "mmrpc": "2.0",
  "userpass": "RPC_UserP@SSW0RD",
  "method": "withdraw",
  "params": {
    "coin": "ETH",
    "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28",
    "max": true
  },
  "id": 0
}

Withdraw

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

Withdraw

POST
withdraw
{
  "mmrpc": "2.0",
  "userpass": "RPC_UserP@SSW0RD",
  "method": "withdraw",
  "params": {
    "coin": "QRC20",
    "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs",
    "amount": 10,
    "fee": {
      "type": "Qrc20Gas",
      "gas_limit": 250000,
      "gas_price": 40
    }
  },
  "id": 0
}

Metamask doesn't allow eth_signTransaction for security reasons, so we can only use eth_sendTransaction for processing withdrawals. As a result, when submitting a withdrawal via metamask it will be rejected unless "broadcast": true.

Withdraw

POST
withdraw
{
  "mmrpc": "2.0",
  "userpass": "RPC_UserP@SSW0RD",
  "method": "withdraw",
  "params": {
    "coin": "MATIC",
    "to": "0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29",
    "amount": 0.1,
    "broadcast": true
  },
  "id": 0
}

Withdraw

POST
withdraw
{
  "mmrpc": "2.0",
  "userpass": "RPC_UserP@SSW0RD",
  "method": "withdraw",
  "params": {
    "coin": "IRIS",
    "to": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k",
    "amount": 13,
    "memo": "It was a bright cold day in April, and the clocks were striking thirteen.",
    "fee": {
      "type": "CosmosGas",
      "gas_price": 0.05,
      "gas_limit": 150000
    }
  },
  "id": 0
}

Using the Cosmos Ecosystem IBC protocol, you can withdraw coins from one chain to another. This example shows a withdrawal from Cosmos to Osmosis.

Withdraw

POST
withdraw
{
  "mmrpc": "2.0",
  "userpass": "RPC_UserP@SSW0RD",
  "method": "withdraw",
  "params": {
    "coin": "ATOM",
    "to": "osmo16drqvl3u8sukfsu4lm3qsk28jr3fahjac4rdw4",
    "amount": 0.1,
    "memo": "In the blackest of your moments, wait with no fear.",
    "ibc_source_channel": 141,
    "fee": {
      "type": "CosmosGas",
      "gas_price": 0.05,
      "gas_limit": 150000
    }
  },
  "id": 0
}

The ibc_source_channel value above is for demonstration only. For more information regarding how to set a valid value, see our guide to finding the right IBC channel.

ParameterTypeDescription
InvalidAmountstringThe specified amount is invalid or exceeds available balance
InvalidAddressstringThe specified address is invalid
NoSuchCoinstringCoin does not exist or has not been activated
TransactionErrorstringError occurred during transaction creation or signing