Platform Transaction Format
This file is meant to be the single source of truth for how we serialize transactions in Avalanche’s Platform Virtual Machine, aka the Platform Chain or P-Chain. This document uses the primitive serialization format for packing and secp256k1 for cryptographic user identification.

Codec ID

Some data is prepended with a codec ID (unt16) that denotes how the data should be deserialized. Right now, the only valid codec ID is 0 (0x00 0x00).

Transferable Output

Transferable outputs wrap an output with an asset ID.

What Transferable Output Contains

A transferable output contains an AssetID and an Output.
    AssetID is a 32-byte array that defines which asset this output references. The only valid AssetID is the AVAX AssetID.
    Output is an output, as defined below. For example, this can be a SECP256K1 transfer output.

Gantt Transferable Output Specification

1
+----------+----------+-------------------------+
2
| asset_id : [32]byte | 32 bytes |
3
+----------+----------+-------------------------+
4
| output : Output | size(output) bytes |
5
+----------+----------+-------------------------+
6
| 32 + size(output) bytes |
7
+-------------------------+
Copied!

Proto Transferable Output Specification

1
message TransferableOutput {
2
bytes asset_id = 1; // 32 bytes
3
Output output = 2; // size(output)
4
}
Copied!

Transferable Output Example

Let’s make a transferable output:
    AssetID: 0x6870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a
    Output: "Example SECP256K1 Transfer Output from below"
1
[
2
AssetID <- 0x6870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a,
3
Output <- 0x0000000700000000ee5be5c000000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715c,
4
]
5
=
6
[
7
// assetID:
8
0x68, 0x70, 0xb7, 0xd6, 0x6a, 0xc3, 0x25, 0x40,
9
0x31, 0x13, 0x79, 0xe5, 0xb5, 0xdb, 0xad, 0x28,
10
0xec, 0x7e, 0xb8, 0xdd, 0xbf, 0xc8, 0xf4, 0xd6,
11
0x72, 0x99, 0xeb, 0xb4, 0x84, 0x75, 0x90, 0x7a,
12
// output:
13
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
14
0xee, 0x5b, 0xe5, 0xc0, 0x00, 0x00, 0x00, 0x00,
15
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
16
0x00, 0x00, 0x00, 0x01, 0xda, 0x2b, 0xee, 0x01,
17
0xbe, 0x82, 0xec, 0xc0, 0x0c, 0x34, 0xf3, 0x61,
18
0xed, 0xa8, 0xeb, 0x30, 0xfb, 0x5a, 0x71, 0x5c,
19
]
Copied!

Transferable Input

Transferable inputs describe a specific UTXO with a provided transfer input.

What Transferable Input Contains

A transferable input contains a TxID, UTXOIndex AssetID and an Input.
    TxID is a 32-byte array that defines which transaction this input is consuming an output from.
    UTXOIndex is an int that defines which utxo this input is consuming the specified transaction.
    AssetID is a 32-byte array that defines which asset this input references. The only valid AssetID is the AVAX AssetID.
    Input is a transferable input object.

Gantt Transferable Input Specification

1
+------------+----------+------------------------+
2
| tx_id : [32]byte | 32 bytes |
3
+------------+----------+------------------------+
4
| utxo_index : int | 04 bytes |
5
+------------+----------+------------------------+
6
| asset_id : [32]byte | 32 bytes |
7
+------------+----------+------------------------+
8
| input : Input | size(input) bytes |
9
+------------+----------+------------------------+
10
| 68 + size(input) bytes |
11
+------------------------+
Copied!

Proto Transferable Input Specification

1
message TransferableInput {
2
bytes tx_id = 1; // 32 bytes
3
uint32 utxo_index = 2; // 04 bytes
4
bytes asset_id = 3; // 32 bytes
5
Input input = 4; // size(input)
6
}
Copied!

Transferable Input Example

Let’s make a transferable input:
    TxID: 0x0dfafbdf5c81f635c9257824ff21c8e3e6f7b632ac306e11446ee540d34711a15
    UTXOIndex: 0
    AssetID: 0x6870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a
    Input: "Example SECP256K1 Transfer Input from below"
1
[
2
TxID <- 0x0dfafbdf5c81f635c9257824ff21c8e3e6f7b632ac306e11446ee540d34711a15
3
UTXOIndex <- 0x00000001
4
AssetID <- 0x6870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a
5
Input <- 0x0000000500000000ee6b28000000000100000000
6
]
7
=
8
[
9
// txID:
10
0xdf, 0xaf, 0xbd, 0xf5, 0xc8, 0x1f, 0x63, 0x5c,
11
0x92, 0x57, 0x82, 0x4f, 0xf2, 0x1c, 0x8e, 0x3e,
12
0x6f, 0x7b, 0x63, 0x2a, 0xc3, 0x06, 0xe1, 0x14,
13
0x46, 0xee, 0x54, 0x0d, 0x34, 0x71, 0x1a, 0x15,
14
// utxoIndex:
15
0x00, 0x00, 0x00, 0x01,
16
// assetID:
17
0x68, 0x70, 0xb7, 0xd6, 0x6a, 0xc3, 0x25, 0x40,
18
0x31, 0x13, 0x79, 0xe5, 0xb5, 0xdb, 0xad, 0x28,
19
0xec, 0x7e, 0xb8, 0xdd, 0xbf, 0xc8, 0xf4, 0xd6,
20
0x72, 0x99, 0xeb, 0xb4, 0x84, 0x75, 0x90, 0x7a,
21
// input:
22
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
23
0xee, 0x6b, 0x28, 0x00, 0x00, 0x00, 0x00, 0x01,
24
0x00, 0x00, 0x00, 0x00
25
]
Copied!

Outputs

Outputs have two possible type: SECP256K1TransferOutput, SECP256K1OutputOwners.

SECP256K1 Transfer Output

A secp256k1 transfer output allows for sending a quantity of an asset to a collection of addresses after a specified unix time. The only valid asset is AVAX.

What SECP256K1 Transfer Output Contains

A secp256k1 transfer output contains a TypeID, Amount, Locktime, Threshold, and Addresses.
    TypeID is the ID for this output type. It is 0x00000007.
    Amount is a long that specifies the quantity of the asset that this output owns. Must be positive.
    Locktime is a long that contains the unix timestamp that this output can be spent after. The unix timestamp is specific to the second.
    Threshold is an int that names the number of unique signatures required to spend the output. Must be less than or equal to the length of Addresses. If Addresses is empty, must be 0.
    Addresses is a list of unique addresses that correspond to the private keys that can be used to spend this output. Addresses must be sorted lexicographically.

Gantt SECP256K1 Transfer Output Specification

1
+-----------+------------+--------------------------------+
2
| type_id : int | 4 bytes |
3
+-----------+------------+--------------------------------+
4
| amount : long | 8 bytes |
5
+-----------+------------+--------------------------------+
6
| locktime : long | 8 bytes |
7
+-----------+------------+--------------------------------+
8
| threshold : int | 4 bytes |
9
+-----------+------------+--------------------------------+
10
| addresses : [][20]byte | 4 + 20 * len(addresses) bytes |
11
+-----------+------------+--------------------------------+
12
| 28 + 20 * len(addresses) bytes |
13
+--------------------------------+
Copied!

Proto SECP256K1 Transfer Output Specification

1
message SECP256K1TransferOutput {
2
uint32 type_id = 1; // 04 bytes
3
uint64 amount = 2; // 08 bytes
4
uint64 locktime = 3; // 08 bytes
5
uint32 threshold = 4; // 04 bytes
6
repeated bytes addresses = 5; // 04 bytes + 20 bytes * len(addresses)
7
}
Copied!

SECP256K1 Transfer Output Example

Let’s make a secp256k1 transfer output with:
    TypeID: 7
    Amount: 3999000000
    Locktime: 0
    Threshold: 1
    Addresses:
      0xda2bee01be82ecc00c34f361eda8eb30fb5a715c
1
[
2
TypeID <- 0x00000007
3
Amount <- 0x00000000ee5be5c0
4
Locktime <- 0x0000000000000000
5
Threshold <- 0x00000001
6
Addresses <- [
7
0xda2bee01be82ecc00c34f361eda8eb30fb5a715c,
8
]
9
]
10
=
11
[
12
// type_id:
13
0x00, 0x00, 0x00, 0x07,
14
// amount:
15
0x00, 0x00, 0x00, 0x00, 0xee, 0x5b, 0xe5, 0xc0,
16
// locktime:
17
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18
// threshold:
19
0x00, 0x00, 0x00, 0x01,
20
// number of addresses:
21
0x00, 0x00, 0x00, 0x01,
22
// addrs[0]:
23
0xda, 0x2b, 0xee, 0x01, 0xbe, 0x82, 0xec, 0xc0,
24
0x0c, 0x34, 0xf3, 0x61, 0xed, 0xa8, 0xeb, 0x30,
25
0xfb, 0x5a, 0x71, 0x5c,
26
]
Copied!

SECP256K1 Output Owners Output

A secp256k1 output owners output will recieve the staking rewards when the lock up period ends.

What SECP256K1 Output Owners Output Contains

A secp256k1 output owners output contains a TypeID, Locktime, Threshold, and Addresses.
    TypeID is the ID for this output type. It is 0x0000000b.
    Locktime is a long that contains the unix timestamp that this output can be spent after. The unix timestamp is specific to the second.
    Threshold is an int that names the number of unique signatures required to spend the output. Must be less than or equal to the length of Addresses. If Addresses is empty, must be 0.
    Addresses is a list of unique addresses that correspond to the private keys that can be used to spend this output. Addresses must be sorted lexicographically.

Gantt SECP256K1 Output Owners Output Specification

1
+-----------+------------+--------------------------------+
2
| type_id : int | 4 bytes |
3
+-----------+------------+--------------------------------+
4
| locktime : long | 8 bytes |
5
+-----------+------------+--------------------------------+
6
| threshold : int | 4 bytes |
7
+-----------+------------+--------------------------------+
8
| addresses : [][20]byte | 4 + 20 * len(addresses) bytes |
9
+-----------+------------+--------------------------------+
10
| 20 + 20 * len(addresses) bytes |
11
+--------------------------------+
Copied!

Proto SECP256K1 Output Owners Output Specification

1
message SECP256K1OutputOwnersOutput {
2
uint32 type_id = 1; // 04 bytes
3
uint64 locktime = 2; // 08 bytes
4
uint32 threshold = 3; // 04 bytes
5
repeated bytes addresses = 4; // 04 bytes + 20 bytes * len(addresses)
6
}
Copied!

SECP256K1 Output Owners Output Example

Let’s make a secp256k1 output owners output with:
    TypeID: 11
    Locktime: 0
    Threshold: 1
    Addresses:
      0xda2bee01be82ecc00c34f361eda8eb30fb5a715c
1
[
2
TypeID <- 0x0000000b
3
Locktime <- 0x0000000000000000
4
Threshold <- 0x00000001
5
Addresses <- [
6
0xda2bee01be82ecc00c34f361eda8eb30fb5a715c,
7
]
8
]
9
=
10
[
11
// type_id:
12
0x00, 0x00, 0x00, 0x0b,
13
// locktime:
14
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15
// threshold:
16
0x00, 0x00, 0x00, 0x01,
17
// number of addresses:
18
0x00, 0x00, 0x00, 0x01,
19
// addrs[0]:
20
0xda, 0x2b, 0xee, 0x01, 0xbe, 0x82, 0xec, 0xc0,
21
0x0c, 0x34, 0xf3, 0x61, 0xed, 0xa8, 0xeb, 0x30,
22
0xfb, 0x5a, 0x71, 0x5c,
23
]
Copied!

Inputs

Inputs have one possible type: SECP256K1TransferInput.

SECP256K1 Transfer Input

A secp256k1 transfer input allows for spending an unspent secp256k1 transfer output.

What SECP256K1 Transfer Input Contains

A secp256k1 transfer input contains an Amount and AddressIndices.
    TypeID is the ID for this output type. It is 0x00000005.
    Amount is a long that specifies the quantity that this input should be consuming from the UTXO. Must be positive. Must be equal to the amount specified in the UTXO.
    AddressIndices is a list of unique ints that define the private keys are being used to spend the UTXO. Each UTXO has an array of addresses that can spend the UTXO. Each int represents the index in this address array that will sign this transaction. The array must be sorted low to high.

Gantt SECP256K1 Transfer Input Specification

1
+-------------------------+-------------------------------------+
2
| type_id : int | 4 bytes |
3
+-----------------+-------+-------------------------------------+
4
| amount : long | 8 bytes |
5
+-----------------+-------+-------------------------------------+
6
| address_indices : []int | 4 + 4 * len(address_indices) bytes |
7
+-----------------+-------+-------------------------------------+
8
| 16 + 4 * len(address_indices) bytes |
9
+-------------------------------------+
Copied!
Proto SECP256K1 Transfer Input Specification
1
message SECP256K1TransferInput {
2
uint32 type_id = 1; // 04 bytes
3
uint64 amount = 2; // 08 bytes
4
repeated uint32 address_indices = 3; // 04 bytes + 4 bytes * len(address_indices)
5
}
Copied!

SECP256K1 Transfer Input Example

Let’s make a payment input with:
    TypeID: 5
    Amount: 4000000000
    AddressIndices: [0]
1
[
2
TypeID <- 0x00000005
3
Amount <- 0x00000000ee6b2800,
4
AddressIndices <- [0x00000000]
5
]
6
=
7
[
8
// type_id:
9
0x00, 0x00, 0x00, 0x05,
10
// amount:
11
0x00, 0x00, 0x00, 0x00, 0xee, 0x6b, 0x28, 0x00,
12
// length:
13
0x00, 0x00, 0x00, 0x01,
14
// address_indices[0]
15
0x00, 0x00, 0x00, 0x00
16
]
Copied!

Unsigned Transactions

Unsigned transactions contain the full content of a transaction with only the signatures missing. Unsigned transactions have six possible types: AddValidatorTx, AddSubnetValidatorTx, AddDelegatorTx, CreateSubnetTx, ImportTx, and ExportTx. They embed BaseTx, which contains common fields and operations.

Unsigned BaseTx

What Base Tx Contains

A base tx contains a TypeID, NetworkID, BlockchainID, Outputs, Inputs, and Memo.
    TypeID is the ID for this type. It is 0x00000000.
    NetworkID is an int that defines which network this transaction is meant to be issued to. This value is meant to support transaction routing and is not designed for replay attack prevention.
    BlockchainID is a 32-byte array that defines which blockchain this transaction was issued to. This is used for replay attack prevention for transactions that could potentially be valid across network or blockchain.
    Outputs is an array of transferable output objects. Outputs must be sorted lexicographically by their serialized representation. The total quantity of the assets created in these outputs must be less than or equal to the total quantity of each asset consumed in the inputs minus the transaction fee.
    Inputs is an array of transferable input objects. Inputs must be sorted and unique. Inputs are sorted first lexicographically by their TxID and then by the UTXOIndex from low to high. If there are inputs that have the same TxID and UTXOIndex, then the transaction is invalid as this would result in a double spend.
    Memo Memo field contains arbitrary bytes, up to 256 bytes.

Gantt Base Tx Specification

1
+---------------+----------------------+-----------------------------------------+
2
| type_id : int | 4 bytes |
3
+---------------+----------------------+-----------------------------------------+
4
| network_id : int | 4 bytes |
5
+---------------+----------------------+-----------------------------------------+
6
| blockchain_id : [32]byte | 32 bytes |
7
+---------------+----------------------+-----------------------------------------+
8
| outputs : []TransferableOutput | 4 + size(outputs) bytes |
9
+---------------+----------------------+-----------------------------------------+
10
| inputs : []TransferableInput | 4 + size(inputs) bytes |
11
+---------------+----------------------+-----------------------------------------+
12
| memo : [256]byte | 4 + size(memo) bytes |
13
+---------------+----------------------+-----------------------------------------+
14
| 52 + size(outputs) + size(inputs) + size(memo) bytes |
15
+------------------------------------------------------+
Copied!

Proto Base Tx Specification

1
message BaseTx {
2
uint32 type_id = 1; // 04 bytes
3
uint32 network_id = 2; // 04 bytes
4
bytes blockchain_id = 3; // 32 bytes
5
repeated Output outputs = 4; // 04 bytes + size(outs)
6
repeated Input inputs = 5; // 04 bytes + size(ins)
7
bytes memo = 6; // 04 bytes + size(memo)
8
}
Copied!

Base Tx Example

Let’s make a base tx that uses the inputs and outputs from the previous examples:
    TypeID: 0
    NetworkID: 12345
    BlockchainID: 0x000000000000000000000000000000000000000000000000000000000000000
    Outputs:
      "Example Transferable Output as defined above"
    Inputs:
      "Example Transferable Input as defined above"
1
[
2
TypeID <- 0x00000000
3
NetworkID <- 0x00003039
4
BlockchainID <- 0x000000000000000000000000000000000000000000000000000000000000000
5
Outputs <- [
6
0x6870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a0000000700000000ee5be5c000000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715c
7
]
8
Inputs <- [
9
0xdfafbdf5c81f635c9257824ff21c8e3e6f7b632ac306e11446ee540d34711a15000000016870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a0000000500000000ee6b28000000000100000000
10
]
11
]
12
=
13
[
14
// type_id:
15
0x00, 0x00, 0x00, 0x00,
16
// networkID:
17
0x00, 0x00, 0x30, 0x39,
18
// blockchainID:
19
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
20
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
22
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
23
// number of outputs:
24
0x00, 0x00, 0x00, 0x01,
25
// transferable output:
26
0x68, 0x70, 0xb7, 0xd6, 0x6a, 0xc3, 0x25, 0x40,
27
0x31, 0x13, 0x79, 0xe5, 0xb5, 0xdb, 0xad, 0x28,
28
0xec, 0x7e, 0xb8, 0xdd, 0xbf, 0xc8, 0xf4, 0xd6,
29
0x72, 0x99, 0xeb, 0xb4, 0x84, 0x75, 0x90, 0x7a,
30
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
31
0xee, 0x5b, 0xe5, 0xc0, 0x00, 0x00, 0x00, 0x00,
32
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
33
0x00, 0x00, 0x00, 0x01, 0xda, 0x2b, 0xee, 0x01,
34
0xbe, 0x82, 0xec, 0xc0, 0x0c, 0x34, 0xf3, 0x61,
35
0xed, 0xa8, 0xeb, 0x30, 0xfb, 0x5a, 0x71, 0x5c,
36
// number of inputs:
37
0x00, 0x00, 0x00, 0x01,
38
// transferable input:
39
0xdf, 0xaf, 0xbd, 0xf5, 0xc8, 0x1f, 0x63, 0x5c,
40
0x92, 0x57, 0x82, 0x4f, 0xf2, 0x1c, 0x8e, 0x3e,
41
0x6f, 0x7b, 0x63, 0x2a, 0xc3, 0x06, 0xe1, 0x14,
42
0x46, 0xee, 0x54, 0x0d, 0x34, 0x71, 0x1a, 0x15,
43
0x00, 0x00, 0x00, 0x01,
44
0x68, 0x70, 0xb7, 0xd6, 0x6a, 0xc3, 0x25, 0x40,
45
0x31, 0x13, 0x79, 0xe5, 0xb5, 0xdb, 0xad, 0x28,
46
0xec, 0x7e, 0xb8, 0xdd, 0xbf, 0xc8, 0xf4, 0xd6,
47
0x72, 0x99, 0xeb, 0xb4, 0x84, 0x75, 0x90, 0x7a,
48
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
49
0xee, 0x6b, 0x28, 0x00, 0x00, 0x00, 0x00, 0x01,
50
0x00, 0x00, 0x00, 0x00,
51
// Memo length:
52
0x00, 0x00, 0x00, 0x00,
53
]
Copied!

Unsigned Add Validator Tx

What Unsigned Add Validator Tx Contains

An unsigned add validator tx contains a BaseTx, Validator, Stake, RewardsOwner, and Shares. The TypeID for this type is 0x0000000c.
    BaseTx
    Validator Validator has a NodeID, StartTime, EndTime, and Weight
      NodeID is 20 bytes which is the node ID of the validator.
      StartTime is a long which is the Unix time when the validator starts validating.
      EndTime is a long which is the Unix time when the validator stops validating.
      Weight is a long which is the amount the validator stakes
    Stake Stake has LockedOuts
      LockedOuts An array of Transferable Outputs that are locked for the duration of the staking period. At the end of the staking period, these outputs are refunded to their respective addresses.
    RewardsOwner A SECP256K1OutputOwners
    Shares 10,000 times percentage of reward taken from delegators

Gantt Unsigned Add Validator Tx Specification

1
+---------------+-----------------------+-----------------------------------------+
2
| base_tx : BaseTx | size(base_tx) bytes |
3
+---------------+-----------------------+-----------------------------------------+
4
| validator : Validator | 44 bytes |
5
+---------------+-----------------------+-----------------------------------------+
6
| stake : Stake | size(LockedOuts) bytes |
7
+---------------+-----------------------+-----------------------------------------+
8
| rewards_owner : SECP256K1OutputOwners | size(rewards_owner) bytes |
9
+---------------+-----------------------+-----------------------------------------+
10
| shares : Shares | 4 bytes |
11
+---------------+-----------------------+-----------------------------------------+
12
| 48 + size(stake) + size(rewards_owner) + size(base_tx) bytes |
13
+--------------------------------------------------------------+
Copied!

Proto Unsigned Add Validator Tx Specification

1
message AddValidatorTx {
2
BaseTx base_tx = 1; // size(base_tx)
3
Validator validator = 2; // 44 bytes
4
Stake stake = 3; // size(LockedOuts)
5
SECP256K1OutputOwners rewards_owner = 4; // size(rewards_owner)
6
uint32 shares = 5; // 04 bytes
7
}
Copied!

Unsigned Add Validator Tx Example

Let’s make an unsigned add validator tx that uses the inputs and outputs from the previous examples:
    BaseTx: "Example BaseTx as defined above with ID set to 0c"
    Validator Validator has a NodeID, StartTime, EndTime, and Weight
      NodeID is 20 bytes which is the node ID of the validator.
      StartTime is a long which is the Unix time when the validator starts validating.
      EndTime is a long which is the Unix time when the validator stops validating.
      Weight is a long which is the amount the validator stakes
    Stake: 0x0000000139c33a499ce4c33a3b09cdd2cfa01ae70dbf2d18b2d7d168524440e55d55008800000007000001d1a94a2000000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c
    RewardsOwner: 0x0000000b00000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715c
    Shares: 0x00000064
    0x0000000b00000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715c
1
[
2
BaseTx <- 0x0000000c000030390000000000000000000000000000000000000000000000000000000000000006870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a0000000700000000ee5be5c000000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715cdfafbdf5c81f635c9257824ff21c8e3e6f7b632ac306e11446ee540d34711a15000000016870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a0000000500000000ee6b28000000000100000000
3
NodeID <- 0xe9094f73698002fd52c90819b457b9fbc866ab80
4
StarTime <- 0x000000005f21f31d
5
EndTime <- 0x000000005f497dc6
6
Weight <- 0x000000000000d431
7
Stake <- 0x0000000139c33a499ce4c33a3b09cdd2cfa01ae70dbf2d18b2d7d168524440e55d55008800000007000001d1a94a2000000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c
8
RewardsOwner <- 0x0000000b00000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715c
9
Shares <- 0x00000064
10
]
11
=
12
[
13
// base tx:
14
0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x30, 0x39,
15
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
19
0x00, 0x00, 0x00, 0x01, 0x68, 0x70, 0xb7, 0xd6,
20
0x6a, 0xc3, 0x25, 0x40, 0x31, 0x13, 0x79, 0xe5,
21
0xb5, 0xdb, 0xad, 0x28, 0xec, 0x7e, 0xb8, 0xdd,
22
0xbf, 0xc8, 0xf4, 0xd6,
23
0x72, 0x99, 0xeb, 0xb4, 0x84, 0x75, 0x90, 0x7a,
24
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
25
0xee, 0x5b, 0xe5, 0xc0, 0x00, 0x00, 0x00, 0x00,
26
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
27
0x00, 0x00, 0x00, 0x01, 0xda, 0x2b, 0xee, 0x01,
28
0xbe, 0x82, 0xec, 0xc0, 0x0c, 0x34, 0xf3, 0x61,
29
0xed, 0xa8, 0xeb, 0x30, 0xfb, 0x5a, 0x71, 0x5c,
30
0x00, 0x00, 0x00, 0x01,
31
0xdf, 0xaf, 0xbd, 0xf5, 0xc8, 0x1f, 0x63, 0x5c,
32
0x92, 0x57, 0x82, 0x4f, 0xf2, 0x1c, 0x8e, 0x3e,
33
0x6f, 0x7b, 0x63, 0x2a, 0xc3, 0x06, 0xe1, 0x14,
34
0x46, 0xee, 0x54, 0x0d, 0x34, 0x71, 0x1a, 0x15,
35
0x00, 0x00, 0x00, 0x01,
36
0x68, 0x70, 0xb7, 0xd6, 0x6a, 0xc3, 0x25, 0x40,
37
0x31, 0x13, 0x79, 0xe5, 0xb5, 0xdb, 0xad, 0x28,
38
0xec, 0x7e, 0xb8, 0xdd, 0xbf, 0xc8, 0xf4, 0xd6,
39
0x72, 0x99, 0xeb, 0xb4, 0x84, 0x75, 0x90, 0x7a,
40
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
41
0xee, 0x6b, 0x28, 0x00, 0x00, 0x00, 0x00, 0x01,
42
0x00, 0x00, 0x00, 0x00,
43
0x00, 0x00, 0x00, 0x00,
44
// Node ID
45
0xe9, 0x09, 0x4f, 0x73, 0x69, 0x80, 0x02, 0xfd,
46
0x52, 0xc9, 0x08, 0x19, 0xb4, 0x57, 0xb9, 0xfb,
47
0xc8, 0x66, 0xab, 0x80,
48
// StartTime
49
0x00, 0x00, 0x00, 0x00, 0x5f, 0x21, 0xf3, 0x1d,
50
// EndTime
51
0x00, 0x00, 0x00, 0x00, 0x5f, 0x49, 0x7d, 0xc6,
52
// Weight
53
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x31,
54
// Stake
55
0x00, 0x00, 0x00, 0x01, 0x39, 0xc3, 0x3a, 0x49,
56
0x9c, 0xe4, 0xc3, 0x3a, 0x3b, 0x09, 0xcd, 0xd2,
57
0xcf, 0xa0, 0x1a, 0xe7, 0x0d, 0xbf, 0x2d, 0x18,
58
0xb2, 0xd7, 0xd1, 0x68, 0x52, 0x44, 0x40, 0xe5,
59
0x5d, 0x55, 0x00, 0x88, 0x00, 0x00, 0x00, 0x07,
60
0x00, 0x00, 0x01, 0xd1, 0xa9, 0x4a, 0x20, 0x00,
61
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
63
0x3c, 0xb7, 0xd3, 0x84, 0x2e, 0x8c, 0xee, 0x6a,
64
0x0e, 0xbd, 0x09, 0xf1, 0xfe, 0x88, 0x4f, 0x68,
65
0x61, 0xe1, 0xb2, 0x9c,
66
// RewardsOwner
67
0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00,
68
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
69
0x00, 0x00, 0x00, 0x01, 0xda, 0x2b, 0xee, 0x01,
70
0xbe, 0x82, 0xec, 0xc0, 0x0c, 0x34, 0xf3, 0x61,
71
0xed, 0xa8, 0xeb, 0x30, 0xfb, 0x5a, 0x71, 0x5c,
72
// Shares
73
0x00, 0x00, 0x00, 0x64,
74
]
Copied!

Unsigned Add Subnet Validator Tx

What Unsigned Add Subnet Validator Tx Contains

An unsigned add subnet validator tx contains a BaseTx, Validator, SubnetID, and SubnetAuth. The TypeID for this type is 0x0000000d.
    BaseTx
    Validator Validator has a NodeID, StartTime, EndTime, and Weight
      NodeID is 20 bytes which is the node ID of the validator.
      StartTime is a long which is the Unix time when the validator starts validating.
      EndTime is a long which is the Unix time when the validator stops validating.
      Weight is a long which is the amount the validator stakes
    SubnetID a 32 byte subnet id
    SubnetAuth contains SigIndices and has a type id of 0x0000000a. SigIndices is a list of unique ints that define the addresses signing the control signature to add a validator to a subnet. The array must be sorted low to high.

Gantt Unsigned Add Subnet Validator Tx Specification

1
+---------------+----------------------+-----------------------------------------+
2
| base_tx : BaseTx | size(base_tx) bytes |
3
+---------------+----------------------+-----------------------------------------+
4
| validator : Validator | 44 bytes |
5
+---------------+----------------------+-----------------------------------------+
6
| subnet_id : [32]byte | 32 bytes |
7
+---------------+----------------------+-----------------------------------------+
8
| subnet_auth : SubnetAuth | 4 bytes + len(sig_indices) bytes |
9
+---------------+----------------------+-----------------------------------------+
10
| 80 + len(sig_indices) + size(base_tx) bytes |
11
+---------------------------------------------+
Copied!

Proto Unsigned Add Subnet Validator Tx Specification

1
message AddSubnetValidatorTx {
2
BaseTx base_tx = 1; // size(base_tx)
3
Validator validator = 2; // size(validator)
4
SubnetID subnet_id = 3; // 32 bytes
5
SubnetAuth subnet_auth = 4; // 04 bytes + len(sig_indices)
6
}
Copied!

Unsigned Add Subnet Validator Tx Example

Let’s make an unsigned add subnet validator tx that uses the inputs and outputs from the previous examples:
    BaseTx: "Example BaseTx as defined above with ID set to 0d"
    NodeID: 0xe9094f73698002fd52c90819b457b9fbc866ab80
    StarTime: 0x000000005f21f31d
    EndTime: 0x000000005f497dc6
    Weight: 0x000000000000d431
    SubnetID: 0x58b1092871db85bc752742054e2e8be0adf8166ec1f0f0769f4779f14c71d7eb
    SubnetAuth:
      TypeID: 0x0000000a
      SigIndices: 0x00000000
1
[
2
BaseTx <- 0x0000000d000030390000000000000000000000000000000000000000000000000000000000000006870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a0000000700000000ee5be5c000000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715cdfafbdf5c81f635c9257824ff21c8e3e6f7b632ac306e11446ee540d34711a15000000016870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a0000000500000000ee6b28000000000100000000
3
NodeID <- 0xe9094f73698002fd52c90819b457b9fbc866ab80
4
StarTime <- 0x000000005f21f31d
5
EndTime <- 0x000000005f497dc6
6
Weight <- 0x000000000000d431
7
SubnetID <- 0x58b1092871db85bc752742054e2e8be0adf8166ec1f0f0769f4779f14c71d7eb
8
SubnetAuth TypeID <- 0x0000000a
9
SubnetAuth <- 0x00000000
10
]
11
=
12
[
13
// base tx:
14
0x00, 0x00, 0x00, 0x0d,
15
0x00, 0x00, 0x30, 0x39,
16
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
19
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
20
0x00, 0x00, 0x00, 0x01,
21
0x68, 0x70, 0xb7, 0xd6, 0x6a, 0xc3, 0x25, 0x40,
22
0x31, 0x13, 0x79, 0xe5, 0xb5, 0xdb, 0xad, 0x28,
23
0xec, 0x7e, 0xb8, 0xdd, 0xbf, 0xc8, 0xf4, 0xd6,
24
0x72, 0x99, 0xeb, 0xb4, 0x84, 0x75, 0x90, 0x7a,
25
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
26
0xee, 0x5b, 0xe5, 0xc0, 0x00, 0x00, 0x00, 0x00,
27
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
28
0x00, 0x00, 0x00, 0x01, 0xda, 0x2b, 0xee, 0x01,
29
0xbe, 0x82, 0xec, 0xc0, 0x0c, 0x34, 0xf3, 0x61,
30
0xed, 0xa8, 0xeb, 0x30, 0xfb, 0x5a, 0x71, 0x5c,
31
0x00, 0x00, 0x00, 0x01,
32
0xdf, 0xaf, 0xbd, 0xf5, 0xc8, 0x1f, 0x63, 0x5c,
33
0x92, 0x57, 0x82, 0x4f, 0xf2, 0x1c, 0x8e, 0x3e,
34
0x6f, 0x7b, 0x63, 0x2a, 0xc3, 0x06, 0xe1, 0x14,
35
0x46, 0xee, 0x54, 0x0d, 0x34, 0x71, 0x1a, 0x15,
36
0x00, 0x00, 0x00, 0x01,
37
0x68, 0x70, 0xb7, 0xd6, 0x6a, 0xc3, 0x25, 0x40,
38
0x31, 0x13, 0x79, 0xe5, 0xb5, 0xdb, 0xad, 0x28,
39
0xec, 0x7e, 0xb8, 0xdd, 0xbf, 0xc8, 0xf4, 0xd6,
40
0x72, 0x99, 0xeb, 0xb4, 0x84, 0x75, 0x90, 0x7a,
41
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
42
0xee, 0x6b, 0x28, 0x00, 0x00, 0x00, 0x00, 0x01,
43
0x00, 0x00, 0x00, 0x00,
44
0x00, 0x00, 0x00, 0x00,
45
// Node ID
46
0xe9, 0x09, 0x4f, 0x73, 0x69, 0x80, 0x02, 0xfd,
47
0x52, 0xc9, 0x08, 0x19, 0xb4, 0x57, 0xb9, 0xfb,
48
0xc8, 0x66, 0xab, 0x80,
49
// StartTime
50
0x00, 0x00, 0x00, 0x00, 0x5f, 0x21, 0xf3, 0x1d,
51
// EndTime
52
0x00, 0x00, 0x00, 0x00, 0x5f, 0x49, 0x7d, 0xc6,
53
// Weight
54
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x31,
55
// SubnetID
56
0x58, 0xb1, 0x09, 0x28, 0x71, 0xdb, 0x85, 0xbc,
57
0x75, 0x27, 0x42, 0x05, 0x4e, 0x2e, 0x8b, 0xe0,
58
0xad, 0xf8, 0x16, 0x6e, 0xc1, 0xf0, 0xf0, 0x76,
59
0x9f, 0x47, 0x79, 0xf1, 0x4c, 0x71, 0xd7, 0xeb,
60
// SubnetAuth
61
// SubnetAuth TypeID
62
0x00, 0x00, 0x00, 0x0a,
63
// SigIndices length
64
0x00, 0x00, 0x00, 0x01,
65
// SigIndices
66
0x00, 0x00, 0x00, 0x00,
67
]
Copied!

Unsigned Add Delegator Tx

What Unsigned Add Delegator Tx Contains

An unsigned add delegator tx contains a BaseTx, Validator, Stake, and RewardsOwner. The TypeID for this type is 0x0000000e.
    BaseTx
    Validator Validator has a NodeID, StartTime, EndTime, and Weight
      NodeID is 20 bytes which is the node ID of the delegatee.
      StartTime is a long which is the Unix time when the delegator starts delegating.
      EndTime is a long which is the Unix time when the delegator stops delegating (and staked AVAX is returned).
      Weight is a long which is the amount the delegator stakes
    Stake Stake has LockedOuts
      LockedOuts An array of Transferable Outputs that are locked for the duration of the staking period. At the end of the staking period, these outputs are refunded to their respective addresses.
    RewardsOwner An SECP256K1OutputOwners

Gantt Unsigned Add Delegator Tx Specification

1
+---------------+-----------------------+-----------------------------------------+
2
| base_tx : BaseTx | size(base_tx) bytes |
3
+---------------+-----------------------+-----------------------------------------+
4
| validator : Validator | 44 bytes |
5
+---------------+-----------------------+-----------------------------------------+
6
| stake : Stake | size(LockedOuts) bytes |
7
+---------------+-----------------------+-----------------------------------------+
8
| rewards_owner : SECP256K1OutputOwners | size(rewards_owner) bytes |
9
+---------------+-----------------------+-----------------------------------------+
10
| 44 + size(stake) + size(rewards_owner) + size(base_tx) bytes |
11
+--------------------------------------------------------------+
Copied!

Proto Unsigned Add Delegator Tx Specification

1
message AddDelegatorTx {
2
BaseTx base_tx = 1; // size(base_tx)
3
Validator validator = 2; // 44 bytes
4
Stake stake = 3; // size(LockedOuts)
5
SECP256K1OutputOwners rewards_owner = 4; // size(rewards_owner)
6
}
Copied!

Unsigned Add Delegator Tx Example

Let’s make an unsigned add delegator tx that uses the inputs and outputs from the previous examples:
    BaseTx: "Example BaseTx as defined above with ID set to 0e"
    NodeID: 0xe9094f73698002fd52c90819b457b9fbc866ab80
    StarTime: 0x000000005f21f31d
    EndTime: 0x000000005f497dc6
    Weight: 0x000000000000d431
    Stake: 0x0000000139c33a499ce4c33a3b09cdd2cfa01ae70dbf2d18b2d7d168524440e55d55008800000007000001d1a94a2000000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c
    RewardsOwner: 0x0000000b00000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715c
1
[
2
BaseTx <- 0x0000000e000030390000000000000000000000000000000000000000000000000000000000000006870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a0000000700000000ee5be5c000000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715cdfafbdf5c81f635c9257824ff21c8e3e6f7b632ac306e11446ee540d34711a15000000016870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a0000000500000000ee6b28000000000100000000
3
NodeID <- 0xe9094f73698002fd52c90819b457b9fbc866ab80
4
StarTime <- 0x000000005f21f31d
5
EndTime <- 0x000000005f497dc6
6
Weight <- 0x000000000000d431
7
Stake <- 0x0000000139c33a499ce4c33a3b09cdd2cfa01ae70dbf2d18b2d7d168524440e55d55008800000007000001d1a94a2000000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c
8
RewardsOwner <- 0x0000000b00000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715c
9
]
10
=
11
[
12
// base tx:
13
0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x30, 0x39,
14
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18
0x00, 0x00, 0x00, 0x01,
19
0x68, 0x70, 0xb7, 0xd6, 0x6a, 0xc3, 0x25, 0x40,
20
0x31, 0x13, 0x79, 0xe5, 0xb5, 0xdb, 0xad, 0x28,
21
0xec, 0x7e, 0xb8, 0xdd, 0xbf, 0xc8, 0xf4, 0xd6,
22
0x72, 0x99, 0xeb, 0xb4, 0x84, 0x75, 0x90, 0x7a,
23
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
24
0xee, 0x5b, 0xe5, 0xc0, 0x00, 0x00, 0x00, 0x00,
25
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
26
0x00, 0x00, 0x00, 0x01, 0xda, 0x2b, 0xee, 0x01,
27
0xbe, 0x82, 0xec, 0xc0, 0x0c, 0x34, 0xf3, 0x61,
28
0xed, 0xa8, 0xeb, 0x30, 0xfb, 0x5a, 0x71, 0x5c,
29
0x00, 0x00, 0x00, 0x01,
30
0xdf, 0xaf, 0xbd, 0xf5, 0xc8, 0x1f, 0x63, 0x5c,
31
0x92, 0x57, 0x82, 0x4f, 0xf2, 0x1c, 0x8e, 0x3e,
32
0x6f, 0x7b, 0x63, 0x2a, 0xc3, 0x06, 0xe1, 0x14,
33
0x46, 0xee, 0x54, 0x0d, 0x34, 0x71, 0x1a, 0x15,
34
0x00, 0x00, 0x00, 0x01,
35
0x68, 0x70, 0xb7, 0xd6, 0x6a, 0xc3, 0x25, 0x40,
36
0x31, 0x13, 0x79, 0xe5, 0xb5, 0xdb, 0xad, 0x28,
37
0xec, 0x7e, 0xb8, 0xdd, 0xbf, 0xc8, 0xf4, 0xd6,
38
0x72, 0x99, 0xeb, 0xb4, 0x84, 0x75, 0x90, 0x7a,
39
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
40
0xee, 0x6b, 0x28, 0x00, 0x00, 0x00, 0x00, 0x01,
41
0x00, 0x00, 0x00, 0x00,
42
0x00, 0x00, 0x00, 0x00,
43
// Node ID
44
0xe9, 0x09, 0x4f, 0x73, 0x69, 0x80, 0x02, 0xfd,
45
0x52, 0xc9, 0x08, 0x19, 0xb4, 0x57, 0xb9, 0xfb,
46
0xc8, 0x66, 0xab, 0x80,
47
// StartTime
48
0x00, 0x00, 0x00, 0x00, 0x5f, 0x21, 0xf3, 0x1d,
49
// EndTime
50
0x00, 0x00, 0x00, 0x00, 0x5f, 0x49, 0x7d, 0xc6,
51
// Weight
52
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x31,
53
// Stake
54
0x00, 0x00, 0x00, 0x01, 0x39, 0xc3, 0x3a, 0x49,
55
0x9c, 0xe4, 0xc3, 0x3a, 0x3b, 0x09, 0xcd, 0xd2,
56
0xcf, 0xa0, 0x1a, 0xe7, 0x0d, 0xbf, 0x2d, 0x18,
57
0xb2, 0xd7, 0xd1, 0x68, 0x52, 0x44, 0x40, 0xe5,
58
0x5d, 0x55, 0x00, 0x88, 0x00, 0x00, 0x00, 0x07,
59
0x00, 0x00, 0x01, 0xd1, 0xa9, 0x4a, 0x20, 0x00,
60
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
62
0x3c, 0xb7, 0xd3, 0x84, 0x2e, 0x8c, 0xee, 0x6a,
63
0x0e, 0xbd, 0x09, 0xf1, 0xfe, 0x88, 0x4f, 0x68,
64
0x61, 0xe1, 0xb2, 0x9c,
65
// RewardsOwner
66
0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00,
67
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
68
0x00, 0x00, 0x00, 0x01, 0xda, 0x2b, 0xee, 0x01,
69
0xbe, 0x82, 0xec, 0xc0, 0x0c, 0x34, 0xf3, 0x61,
70
0xed, 0xa8, 0xeb, 0x30, 0xfb, 0x5a, 0x71, 0x5c,
71
]
Copied!

Unsigned Create Subnet Tx

What Unsigned Create Subnet Tx Contains

An unsigned create subnet tx contains a BaseTx, and RewardsOwner. The TypeID for this type is 0x00000010.
    BaseTx
    RewardsOwner A SECP256K1OutputOwners

Gantt Unsigned Create Subnet Tx Specification

1
+-----------------+-----------------------|---------------------------------+
2
| base_tx : BaseTx | size(base_tx) bytes |
3
+-----------------+-----------------------+--------------------------------+
4
| rewards_owner : SECP256K1OutputOwners | size(rewards_owner) bytes |
5
+-----------------+-----------------------+---------------------------------+
6
| size(rewards_owner) + size(base_tx) bytes |
7
+-------------------------------------------+
Copied!

Proto Unsigned Create Subnet Tx Specification

1
message CreateSubnetTx {
2
BaseTx base_tx = 1; // size(base_tx)
3
SECP256K1OutputOwners rewards_owner = 2; // size(rewards_owner)
4
}
Copied!

Unsigned Create Subnet Tx Example

Let’s make an unsigned create subnet tx that uses the inputs from the previous examples:
    BaseTx: "Example BaseTx as defined above but with TypeID set to 16"
    RewardsOwner:
      TypeId: 11
      Locktime: 0
      Threshold: 1
      Addresses: [ 0xda2bee01be82ecc00c34f361eda8eb30fb5a715c ]
1
[
2
BaseTx <- 0x00000010000030390000000000000000000000000000000000000000000000000000000000000006870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a0000000700000000ee5be5c000000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715cdfafbdf5c81f635c9257824ff21c8e3e6f7b632ac306e11446ee540d34711a15000000016870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a0000000500000000ee6b28000000000100000000
3
RewardsOwner <-
4
TypeID <- 0x0000000b
5
Locktime <- 0x0000000000000000
6
Threshold <- 0x00000001
7
Addresses <- [
8
0xda2bee01be82ecc00c34f361eda8eb30fb5a715c,
9
]
10
]
11
=
12
[
13
// base tx:
14
0x00, 0x00, 0x00, 0x10,
15
0x00, 0x00, 0x30, 0x39, 0x00, 0x00, 0x00, 0x00,
16
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
19
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
20
0x39, 0xc3, 0x3a, 0x49, 0x9c, 0xe4, 0xc3, 0x3a,
21
0x3b, 0x09, 0xcd, 0xd2, 0xcf, 0xa0, 0x1a, 0xe7,
22
0x0d, 0xbf, 0x2d, 0x18, 0xb2, 0xd7, 0xd1, 0x68,
23
0x52, 0x44, 0x40, 0xe5, 0x5d, 0x55, 0x00, 0x88,
24
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x12, 0x30,
25
0x9c, 0xd5, 0xfd, 0xc0, 0x00, 0x00, 0x00, 0x00,
26
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
27
0x00, 0x00, 0x00, 0x01, 0x3c, 0xb7, 0xd3, 0x84,
28
0x2e, 0x8c, 0xee, 0x6a, 0x0e, 0xbd, 0x09, 0xf1,
29
0xfe, 0x88, 0x4f, 0x68, 0x61, 0xe1, 0xb2, 0x9c,
30
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
31
// RewardsOwner type id
32
0x00, 0x00, 0x00, 0x0b,
33
// locktime:
34
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35
// threshold:
36
0x00, 0x00, 0x00, 0x01,
37
// number of addresses:
38
0x00, 0x00, 0x00, 0x01,
39
// addrs[0]:
40
0xda, 0x2b, 0xee, 0x01,
41
0xbe, 0x82, 0xec, 0xc0, 0x0c, 0x34, 0xf3, 0x61,
42
0xed, 0xa8, 0xeb, 0x30, 0xfb, 0x5a, 0x71, 0x5c
43
]
Copied!

Unsigned Import Tx

What Unsigned Import Tx Contains

An unsigned import tx contains a BaseTx, SourceChain, and Ins. The TypeID for this type is 0x00000011.
    BaseTx
    SourceChain is a 32-byte source blockchain ID.
    Ins is a variable length array of Transferable Inputs.

Gantt Unsigned Import Tx Specification

1
+-----------------+--------------|---------------------------------+
2
| base_tx : BaseTx | size(base_tx) bytes |
3
+-----------------+--------------+---------------------------------+
4
| source_chain : [32]byte | 32 bytes |
5
+-----------------+--------------+---------------------------------+
6
| ins : []TransferIn | 4 + size(ins) bytes |
7
+-----------------+--------------+---------------------------------+
8
| 36 + size(ins) + size(base_tx) bytes |
9
+--------------------------------------+
Copied!

Proto Unsigned Import Tx Specification

1
message ImportTx {
2
BaseTx base_tx = 1; // size(base_tx)
3
bytes source_chain = 2; // 32 bytes
4
repeated TransferIn ins = 3; // 4 bytes + size(ins)
5
}
Copied!

Unsigned Import Tx Example

Let’s make an unsigned import tx that uses the inputs from the previous examples:
    BaseTx: "Example BaseTx as defined above with TypeID set to 17"
    SourceChain:
    Ins: "Example SECP256K1 Transfer Input as defined above"
1
[
2
BaseTx <- 0x00000011000030390000000000000000000000000000000000000000000000000000000000000006870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a0000000700000000ee5be5c000000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715cdfafbdf5c81f635c9257824ff21c8e3e6f7b632ac306e11446ee540d34711a15000000016870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907a0000000500000000ee6b28000000000100000000
3
SourceChain <- 0x787cd3243c002e9bf5bbbaea8a42a16c1a19cc105047c66996807cbf16acee10
4
Ins <- [
5
// input:
6
]
7
]
8
=
9
[
10
// base tx:
11
0x00, 0x00, 0x00, 0x11,
12
0x00, 0x00, 0x30, 0x39, 0x00, 0x00, 0x00, 0x00,
13
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
14
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
17
0x39, 0xc3, 0x3a, 0x49, 0x9c, 0xe4, 0xc3, 0x3a,
18
0x3b, 0x09, 0xcd, 0xd2, 0xcf, 0xa0, 0x1a, 0xe7,
19
0x0d, 0xbf, 0x2d, 0x18, 0xb2, 0xd7, 0xd1, 0x68,
20
0x52, 0x44, 0x40, 0xe5, 0x5d, 0x55, 0x00, 0x88,
21
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x12, 0x30,
22
0x9c, 0xd5, 0xfd, 0xc0, 0x00, 0x00, 0x00, 0x00,
23
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
24
0x00, 0x00, 0x00, 0x01, 0x3c, 0xb7, 0xd3, 0x84,
25
0x2e, 0x8c, 0xee, 0x6a, 0x0e, 0xbd, 0x09, 0xf1,
26
0xfe, 0x88, 0x4f, 0x68, 0x61, 0xe1, 0xb2, 0x9c,
27
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28
// sourceChain
29
0x78, 0x7c, 0xd3, 0x24, 0x3c, 0x00, 0x2e, 0x9b,
30
0xf5, 0xbb, 0xba, 0xea, 0x8a, 0x42, 0xa1, 0x6c,
31
0x1a, 0x19, 0xcc, 0x10, 0x50, 0x47, 0xc6, 0x69,
32
0x96, 0x80, 0x7c, 0xbf, 0x16, 0xac, 0xee, 0x10,
33
// input count:
34
0x00, 0x00, 0x00, 0x01,
35
// txID:
36
0xf1, 0xe1, 0xd1, 0xc1, 0xb1, 0xa1, 0x91, 0x81,
37
0x71, 0x61, 0x51, 0x41, 0x31, 0x21, 0x11, 0x01,
38
0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0, 0x90, 0x80,
39
0x70, 0x60, 0x50, 0x40, 0x30, 0x20, 0x10, 0x00,
40
// utxoIndex:
41
0x00, 0x00, 0x00, 0x05,
42
// assetID:
43
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
44
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
45
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
46
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
47
// input:
48
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
49
0xee, 0x6b, 0x28, 0x00, 0x00, 0x00, 0x00, 0x01,
50
0x00, 0x00, 0x00, 0x00,
51
]
Copied!

Unsigned Export Tx

What Unsigned Export Tx Contains

An unsigned export tx contains a BaseTx, DestinationChain, and Outs. The TypeID for this type is 0x00000012.
    DestinationChain is the 32 byte ID of the chain where the funds are being exported to.
    Outs is a variable length array of Transferable Outputs.

Gantt Unsigned Export Tx Specification

1
+-------------------+---------------+--------------------------------------+
2
| base_tx : BaseTx | size(base_tx) bytes |
3
+-------------------+---------------+--------------------------------------+
4
| destination_chain : [32]byte | 32 bytes |
5
+-------------------+---------------+--------------------------------------+
6
| outs : []TransferOut | 4 + size(outs) bytes |
7
+-------------------+---------------+--------------------------------------+
8
| 36 + size(outs) + size(base_tx) bytes |
9
+---------------------------------------+
Copied!

Proto Unsigned Export Tx Specification

1
message ExportTx {
2
BaseTx base_tx = 1; // size(base_tx)
3
bytes destination_chain = 2; // 32 bytes
4
repeated TransferOut outs = 3; // 4 bytes + size(outs)
5
}
Copied!

Unsigned Export Tx Example

Let’s make an unsigned export tx that uses the outputs from the previous examples: