# Set Script Transaction Binary Format
Learn more about Set Script transaction.
# Version 2
Binary format of version 2 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 2 is enabled by feature #15 “Ride V4, VRF, Protobuf, Failed transactions”.
message SetScriptTransactionData {
bytes script = 1;
};
Field | Size | Description |
---|---|---|
script | Up to 163,840 bytes (before activation of feature #17 it was up to 32,768 bytes | Account script or dApp script |
# Version 1
# | 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 13 |
3 | Transaction version | version | Byte | 1 | Value must be 1 |
4 | Chain ID | chainId | Byte | 1 | 87 — for Mainnet 84 — for Testnet 83 — for Stagenet |
5 | Public key of the transaction sender | senderPublicKey | Array[Byte] | 32 | |
6.1 | Script existence flag | Boolean | 1 | If the value is 0, then the token does not have a script. If the value is 1, then the token has a script | |
6.2 | Script length | Short | S | S = 0 if the value of the "Script existence flag" field is 0.S = 2 if the value of the "Script existence flag" field is 1 | |
6.3 | Script | script | String | S | S = 0 if the value of the "Script existence flag" field is 0.0 < S ≤ 32,768 (after activation of feature #17: S ≤ 163,840 bytes), if the value of the "Script existence flag" field is 1 |
7 | Transaction fee | fee | Long | 8 | |
8 | Transaction timestamp | timestamp | Long | 8 | |
9 | 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.