Regular token transfers
This document details how to transfer ICP using the Rosetta Construction API. See Construction API Overview for a high-level overview of the transaction flow.
Transfer operations
A transaction that transfers amount T from address A to address B must contain three operations:
An operation of type
TRANSACTIONapplied to addressAwith the amount of-T.An operation of type
TRANSACTIONapplied to addressBwith the amount ofT.An operation of type
FEEapplied to addressAwith the amount suggested by the/construction/metadataendpoint (seesuggested_feefield of the ConstructionMetadataResponse type).
The order of operations within a transaction is irrelevant.
Multiple transfers within a single transaction are not allowed. The outcome of such a transaction is unspecified.
Preconditions:
Address
Aholds at leastT+suggested_feeICP.Address
Ais a subaccount of the principal derived from the public key that you use to sign the transaction.The amount specified in the
FEEoperation is equal in absolute value tosuggested_fee.
Optional metadata fields
Rosetta node recognizes the following optional metadata fields in ConstructionPayloadRequest:
memois an arbitrary 64-bit unsigned integer associated with the transaction. You can use it to associate your data with the transaction. For example, you can set the memo to a row key in a database. Valid values for thememofield range from0to264 - 1(18446744073709551615).ingress_start,ingress_end, andcreated_at_timeare 64-bit unsigned integers representing the number of nanoseconds passed from UNIX epoch in UTC timezone. You can use these fields to construct and sign a transaction in advance and submit the signed transaction later. You can submit a signed transaction within 24 hours starting fromcreated_at_time(by default equal to the time when you invoke the/construction/payloadsendpoint).
Example
Below is an example of a transaction that transfers 1 ICP from address bdc4ee05d42cd0669786899f256c8fd7217fa71177bd1fa7b9534f568680a938 to address b64ec6f964d8597afa06d4209dbce2b2df9fe722e86aeda2351bd95500cf15f8.
{
  "network_identifier": {
    "blockchain": "Internet Computer",
    "network": "00000000000000020101"
  },
  "operations": [
    {
      "operation_identifier": {
        "index": 0
      },
      "type": "TRANSACTION",
      "account": {
        "address": "bdc4ee05d42cd0669786899f256c8fd7217fa71177bd1fa7b9534f568680a938"
      },
      "amount": {
        "value": "-100000000",
        "currency": {
          "symbol": "ICP",
          "decimals": 8
        }
      }
    },
    {
      "operation_identifier": {
        "index": 1
      },
      "type": "TRANSACTION",
      "account": {
        "address": "b64ec6f964d8597afa06d4209dbce2b2df9fe722e86aeda2351bd95500cf15f8"
      },
      "amount": {
        "value": "100000000",
        "currency": {
          "symbol": "ICP",
          "decimals": 8
        }
      }
    },
    {
      "operation_identifier": {
        "index": 2
      },
      "type": "FEE",
      "account": {
        "address": "bdc4ee05d42cd0669786899f256c8fd7217fa71177bd1fa7b9534f568680a938"
      },
      "amount": {
        "value": "-10000",
        "currency": {
          "symbol": "ICP",
          "decimals": 8
        }
      }
    }
  ],
  "public_keys": [
    {
      "hex_bytes": "97d0b490ec4097b3653878274b1d9dd00bb1316ea3df0bfdf98327ef68fade63",
      "curve_type": "edwards25519"
    }
  ]
}
Response
{
  "transaction_identifier": {
    "hash": "97f4a8289f96ef46d8c8fa911f13cc402e4f69b36f4dd1ddc2579bb54dba5557"
  },
  "block_index": 1043
}