# Transfer Transaction Binary Format
Learn more about Transfer transaction.
# Version 3
Binary format of version 3 is defined in transaction.proto protobuf scheme. The fields that are common to all types of transactions are described in the Transaction Binary Format article.
Version 3 is enabled by feature #15 “Ride V4, VRF, Protobuf, Failed transactions”.
message TransferTransactionData {
Recipient recipient = 1;
Amount amount = 2;
bytes attachment = 3;
};
message Recipient {
oneof recipient {
bytes public_key_hash = 1;
string alias = 2;
};
message Amount {
bytes asset_id = 1;
int64 amount = 2;
};
Field | Size | Description |
---|---|---|
recipient.public_key_hash | 20 bytes | Recipient's account public key hash (a component of an address, see the Address binary format article) |
recipient.alias | From 4 to 30 bytes | Recipient's alias |
amount.asset_id | 32 bytes | ID of token to transfer |
amount.amount | 8 bytes | Amount of token to transfer, specified in the minimum fraction (“cents”) |
attachment | Up to 140 bytes | Arbitrary data (typically a comment to transfer) |
# Version 2
# | Field | JSON field name | Field type | Field size in bytes | Comment |
---|---|---|---|---|---|
1 | Version flag | Byte | 1 | Indicates the transaction version is 2 or higher. Value must be 0 | |
2 | Transaction type ID | type | Byte | 1 | Value must be 4 |
3 | Transaction version | version | Byte | 1 | Value must be 2 |
4 | Public key of the transaction sender | senderPublicKey | Array[Byte] | 32 | |
5.1 | Transferring token type flag | Byte | 1 | Value is 0 for transferring WAVES. Value is 1 for transferring other token | |
5.2 | Transferring token ID | assetId | Array[Byte] | S | S = 0 if the value of the flag 5.1 is 0.S = 32 if the value of the flag 5.1 is 1 |
6.1 | Fee token type flag | Byte | 1 | Value is 0 for fee in WAVES. Value is 1 for fee in other token | |
6.2 | Fee token ID | feeAssetId | Array[Byte] | S | Token to pay the feeS = 0 if the value of the flag 6.1 is 0.S = 32 if the value of the flag 6.1 field is 1 |
7 | Transaction timestamp | timestamp | Long | 8 | |
8 | Amount of token in the transfer | amount | Long | 8 | |
9 | Transaction fee | fee | Long | 8 | |
10 | Address or alias | recipient | See Address Binary Format, Alias Binary Format | S | If the first byte of the field is 1, then it is followed by address. S in this case equals 26If the first byte of the field is 2, then it is followed by alias. In this case 8 <= S <= 34 |
11.1 | Attachment length | Short | 2 | ||
11.2 | Attachment | attachment | Array[Byte] | Up to 140 bytes | Arbitrary data attached to the transaction |
12 | Transaction proofs | proofs | See Transaction Proofs Binary Format | S | If the array is empty, then S = 3. If the array is not empty, then S = 3 + 2 × N + 64 × N , where N is the number of proofs in the array.The maximum number of proofs in the array is 8. The size of each proof is 64 bytes |
The fields numbered in bold are the transaction body bytes.
# JSON Representation of Transaction
See the example in Node API. In the JSON representation, values of feeAsset
and feeAssetId
fields are identical.
# Version 1
# | Field | Field type | Field size in bytes | Comment |
---|---|---|---|---|
1 | Transaction type ID | Byte | 1 | Value must be 4 |
2 | Transaction signature | Array[Byte] | 64 | |
3 | Transaction type ID | Byte | 1 | This field duplicates field 1 |
4 | Public key of the transaction sender | Array[Byte] | 32 | |
5.1 | Transferring token type flag | Byte | 1 | Value is 0 for transferring WAVES. Value is 1 for transferring other token |
5.2 | Transferring token ID | Array[Byte] | S | S = 0 if the value of the flag 5.1 is 0.S = 32 if the value of the flag 5.1 is 1 |
6.1 | Fee token type flag | Byte | 1 | Value is 0 for fee in WAVES. Value is 1 for fee in other token |
6.2 | Fee token ID | Array[Byte] | S | Token to pay the feeS = 0 if the value of the flag 6.1 is 0.S = 32 if the value of the flag 6.1 field is 1 |
7 | Transaction timestamp | Long | 8 | |
8 | Amount of token in the transfer | amount | Long | 8 |
9 | Transaction fee | fee | Long | 8 |
10 | Address or alias | recipient | See Address Binary Format, Alias Binary Format | S |
11.1 | Attachment length | Short | 2 | |
11.2 | Attachment | attachment | Array[Byte] | Up to 140 bytes |
The fields numbered in bold are the transaction body bytes.