On this page

latest contributor to this doc

Last Edit:

@gcharang

Sign Raw Transaction

This method allows users to:

  • Create a signed UTXO raw transaction given unsigned hex, and optionally a set of prior transaction inputs.
  • Create a signed EVM raw transaction, given the destination address, amount and gas limit.

The transaction can then be broadcasted to the network using the send_raw_transaction to complete the process.

This method is used to sign a raw transaction that has already been created. For UTXO coins, the unsigned hex is required to sign the transaction. If prev_txns is not provided, it will be sourced via electrums.

StructureTypeDescription
coinstringThe coin to sign the raw transaction with
typestringThe operation type. Accepted values: UTXO ( for utxo coins), ETH (for emv coins)
txobjectA standard RawTxInfo object

StructureTypeDescription
tx_hexstringThe signed transaction hex, ready for broadcast

POST
sign_raw_transaction
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "sign_raw_transaction",
  "params": {
    "coin": "KMD",
    "type": "UTXO",
    "tx": {
      "tx_hex": "0400008085202f8901c8d6d8764e51bbadc0592b99f37b3b7d8c9719686d5a9bf63652a0802a1cd0360200000000feffffff0100dd96d8080000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac46366665000000000000000000000000000000"
    }
  },
  "id": 0
}

POST
sign_raw_transaction
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "id": 0,
  "method": "sign_raw_transaction",
  "params": {
    "coin": "KMD",
    "type": "UTXO",
    "tx": {
      "tx_hex": "0400008085202f8901c8d6d8764e51bbadc0592b99f37b3b7d8c9719686d5a9bf63652a0802a1cd0360200000000feffffff0100dd96d8080000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac46366665000000000000000000000000000000",
      "prev_txns": [
        {
          "tx_hash": "36d01c2a80a05236f69b5a6d6819978c7d3b7bf3992b59c0adbb514e76d8d6c8",
          "index": 2,
          "script_pub_key": "76a914d346067e3c3c3964c395fee208594790e29ede5d88ac",
          "amount": 0.00001
        }
      ]
    }
  }
}

POST
sign_raw_transaction
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "id": 0,
  "method": "sign_raw_transaction",
  "params": {
    "coin": "MATIC",
    "type": "ETH",
    "tx": {
      "to": "0x927DaFDDa16F1742BeFcBEAE6798090354B294A9",
      "value": "1.4",
      "gas_limit": "21000"
    }
  }
}

  {
    "mmrpc": "2.0",
    "result": {
      "tx_hex": "f86680847735940083021000947bc1bbdd6a0a722fc9bffc49c921b685ecb84b948210008025a06c0ecbccf92caf5ac620b118f09a84a18c73d7b209e75696bb10e3c24c2dba64a055af3638f92daec1eb3057fb6a9ccf418325bb1aa6121a3314c3885100a5e63a"
    },
    "id": 0
  }

Once you have signed the raw transaction, dont forget to broadcast it to the network using the send_raw_transaction method.