Set Script
Transaction to create a smart account
Smart accounts have a custom script that defines how transactions should be validated. The script needs to be compiled by the node before it's broadcasted as a transaction.
Scripts are written in the Ride programming language.
Examples
Restrict account
The "Restrict Account" script disables transfers from the account, it also disables modifying the script. This means that any funds on the account can only be used for staking/leasing and paying transaction fees.
Binary schema
The binary data structure of the unsigned transaction.
# | Field Name | Type | Length |
---|---|---|---|
1 | Transaction type | Byte (constant, value=4) | 1 |
2 | Version | Byte (constant, value=3) | 1 |
3 | Network id | Byte | 1 |
4 | Timestamp | Long | 8 |
5 | Sender's key type | KeyType (Byte) | 1 |
6 | Sender's public key | PublicKey (Array[Byte]) | 32 | 33 |
7 | Fee | Long | 8 |
8 | Script length (N) | Short | 2 |
9 | Script | Array[Byte] | N |
Script is the (binary) compiled script (without "base64:" prefix).
Network id can be obtained by taking the 2nd byte from the sender address.
Each key type has a numeric id in addition to the reference from the JSON.
Integers (short, int, long) have a big endian byte order.
Last updated