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).
Proof of Possession
A BLS public key and a proof of possession of the key.
What Proof of Possession Contains
- PublicKey is the 48 byte representation of the public key.
- Signature is the 96 byte signature by the private key over its public key.
Proof of Possession Specification
Proof of Possession Specification
Proof of Possession Example
Transferable Output
Transferable outputs wrap an output with an asset ID.
What Transferable Output Contains
A transferable output contains an AssetID and an Output.
AssetIDis a 32-byte array that defines which asset this output references. The only validAssetIDis the AVAXAssetID.Outputis an output, as defined below. For example, this can be a SECP256K1 transfer output.
Gantt Transferable Output Specification
Proto Transferable Output Specification
Transferable Output Example
Let's make a transferable output:
AssetID: 0x6870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907aOutput: "Example SECP256K1 Transfer Output from below"
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.
TxIDis a 32-byte array that defines which transaction this input is consuming an output from.UTXOIndexis an int that defines which utxo this input is consuming the specified transaction.AssetIDis a 32-byte array that defines which asset this input references. The only validAssetIDis the AVAXAssetID.Inputis a transferable input object.
Gantt Transferable Input Specification
Proto Transferable Input Specification
Transferable Input Example
Let's make a transferable input:
TxID:0x0dfafbdf5c81f635c9257824ff21c8e3e6f7b632ac306e11446ee540d34711a15UTXOIndex:0AssetID:0x6870b7d66ac32540311379e5b5dbad28ec7eb8ddbfc8f4d67299ebb48475907aInput:"Example SECP256K1 Transfer Input from below"
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.
TypeIDis the ID for this output type. It is0x00000007.Amountis a long that specifies the quantity of the asset that this output owns. Must be positive.Locktimeis a long that contains the Unix timestamp that this output can be spent after. The Unix timestamp is specific to the second.Thresholdis an int that names the number of unique signatures required to spend the output. Must be less than or equal to the length ofAddresses. IfAddressesis empty, must be 0.Addressesis 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
Proto SECP256K1 Transfer Output Specification
SECP256K1 Transfer Output Example
Let's make a secp256k1 transfer output with:
TypeID: 7Amount: 3999000000Locktime: 0Threshold: 1Addresses:- 0xda2bee01be82ecc00c34f361eda8eb30fb5a715c
SECP256K1 Output Owners Output
A secp256k1 output owners output will receive 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.
TypeIDis the ID for this output type. It is0x0000000b.Locktimeis a long that contains the Unix timestamp that this output can be spent after. The Unix timestamp is specific to the second.Thresholdis an int that names the number of unique signatures required to spend the output. Must be less than or equal to the length ofAddresses. IfAddressesis empty, must be 0.Addressesis 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
Proto SECP256K1 Output Owners Output Specification
SECP256K1 Output Owners Output Example
Let's make a secp256k1 output owners output with:
TypeID: 11Locktime: 0Threshold: 1Addresses:- 0xda2bee01be82ecc00c34f361eda8eb30fb5a715c
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.
TypeIDis the ID for this output type. It is0x00000005.Amountis 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.AddressIndicesis 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
Proto SECP256K1 Transfer Input Specification
SECP256K1 Transfer Input Example
Let's make a payment input with:
TypeID: 5Amount: 4000000000AddressIndices: [0]
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.
TypeIDis the ID for this type. It is0x00000000.NetworkIDis 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.BlockchainIDis 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.Outputsis 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.Inputsis an array of transferable input objects. Inputs must be sorted and unique. Inputs are sorted first lexicographically by theirTxIDand then by theUTXOIndexfrom low to high. If there are inputs that have the sameTxIDandUTXOIndex, then the transaction is invalid as this would result in a double spend.MemoMemo field contains arbitrary bytes, up to 256 bytes.
Gantt Base TX Specification
Proto Base TX Specification
Base TX Example
Let's make a base TX that uses the inputs and outputs from the previous examples:
TypeID:0NetworkID:12345BlockchainID:0x000000000000000000000000000000000000000000000000000000000000000Outputs:"Example Transferable Output as defined above"
Inputs:"Example Transferable Input as defined above"
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.
BaseTxValidatorValidator has aNodeID,StartTime,EndTime, andWeightNodeIDis 20 bytes which is the node ID of the validator.StartTimeis a long which is the Unix time when the validator starts validating.EndTimeis a long which is the Unix time when the validator stops validating.Weightis a long which is the amount the validator stakes
StakeStake hasLockedOutsLockedOutsAn 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.
RewardsOwnerASECP256K1OutputOwnersShares10,000 times percentage of reward taken from delegators
Gantt Unsigned Add Validator TX Specification
Proto Unsigned Add Validator TX Specification
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"ValidatorValidator has aNodeID,StartTime,EndTime, andWeightNodeIDis 20 bytes which is the node ID of the validator.StartTimeis a long which is the Unix time when the validator starts validating.EndTimeis a long which is the Unix time when the validator stops validating.Weightis a long which is the amount the validator stakes
Stake:0x0000000139c33a499ce4c33a3b09cdd2cfa01ae70dbf2d18b2d7d168524440e55d55008800000007000001d1a94a2000000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29cRewardsOwner:0x0000000b00000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715cShares:0x00000064
Unsigned Remove Avalanche L1 Validator TX
What Unsigned Remove Avalanche L1 Validator TX Contains
An unsigned remove Avalanche L1 validator TX contains a BaseTx, NodeID,
SubnetID, and SubnetAuth. The TypeID for this type is 23 or 0x00000017.
BaseTxNodeIDis the 20 byte node ID of the validator.SubnetIDis the 32 byte Avalanche L1 ID (SubnetID) that the validator is being removed from.SubnetAuthcontainsSigIndicesand has a type id of0x0000000a.SigIndicesis a list of unique ints that define the addresses signing the control signature which proves that the issuer has the right to remove the node from the Avalanche L1. The array must be sorted low to high.
Gantt Unsigned Remove Avalanche L1 Validator TX Specification
Proto Unsigned Remove Avalanche L1 Validator TX Specification
Unsigned Remove Avalanche L1 Validator TX Example
Let's make an unsigned remove Avalanche L1 validator TX that uses the inputs and outputs from the previous examples:
BaseTx:"Example BaseTx as defined above with ID set to 17"NodeID:0xe902a9a86640bfdb1cd0e36c0cc982b83e5765faSubnetID:0x4a177205df5c29929d06db9d941f83d5ea985de302015e99252d16469a6610dbSubnetAuth:0x0000000a0000000100000000
Unsigned Add Permissionless Validator TX
What Unsigned Add Permissionless Validator TX Contains
An unsigned add permissionless validator TX contains a BaseTx, Validator,
SubnetID, Signer, StakeOuts, ValidatorRewardsOwner,
DelegatorRewardsOwner, and DelegationShares. The TypeID for this type is
25 or 0x00000019.
BaseTxValidatorValidator has aNodeID,StartTime,EndTime, andWeightNodeIDis the 20 byte node ID of the validator.StartTimeis a long which is the Unix time when the validator starts validating.EndTimeis a long which is the Unix time when the validator stops validating.Weightis a long which is the amount the validator stakes
SubnetIDis the 32 byte Avalanche L1 ID (SubnetID) of the Avalanche L1 this validator will validate.SignerIf the [SubnetID] is the primary network, [Signer] is the type ID 28 (0x1C) followed by a Proof of Possession. If the [SubnetID] is not the primary network, this value is the empty signer, whose byte representation is only the type ID 27 (0x1B).StakeOutsAn array of Transferable Outputs. Where to send staked tokens when done validating.ValidatorRewardsOwnerWhere to send validation rewards when done validating.DelegatorRewardsOwnerWhere to send delegation rewards when done validating.DelegationSharesa short which is the fee this validator charges delegators as a percentage, times 10,000 For example, if this validator has DelegationShares=300,000 then they take 30% of rewards from delegators.
Gantt Unsigned Add Permissionless Validator TX Specification
Proto Unsigned Add Permissionless Validator TX Specification
Unsigned Add Permissionless Validator TX Example
Let's make an unsigned add permissionless validator TX that uses the inputs and outputs from the previous examples:
BaseTx:"Example BaseTx as defined above with ID set to 1a"Validator:0x5fa29ed4356903dac2364713c60f57d8472c7dda000000006397616e0000000063beee6e000001d1a94a2000SubnetID:0xf3086d7bfc35be1c68db664ba9ce61a2060126b0d6b4bfb09fd7a5fb7678cadaSigner:0x0000001ca5af179e4188583893c2b99e1a8be27d90a9213cfbff1d75b74fe2bc9f3b072c2ded0863a9d9acd9033f223295810e429238e28d3c9b7f7212b63d746b2ae73a54fe08a3de61b132f2f89e9eeff97d4d7ca3a3c88986aa855cd36296fcfe8f02162d0258be494d267d4c5798bc081ab602ded90b0fc16d8a035e68ff5294794cb63ff1ee068fbfc2b4c8cd2d08ebf297StakeOuts:0x000000013d0ad12b8ee8928edf248ca91ca55600fb383f07c32bff1d6dec472b25cf59a700000007000001d1a94a20000000000000000000000000010000000133eeffc64785cf9d80e7731d9f31f67bd03c5cf0ValidatorRewardsOwner:0x0000000b0000000000000000000000010000000172f3eb9aeaf8283011ce6e437fdecd65eace8f52DelegatorRewardsOwner:0x0000000b00000000000000000000000100000001b2b91313ac487c222445254e26cd026d21f6f440DelegationShares:0x00004e20
Unsigned Add Permissionless Delegator TX
What Unsigned Add Permissionless Delegator TX Contains
An unsigned add permissionless delegator TX contains a BaseTx, Validator,
SubnetID, StakeOuts, and DelegatorRewardsOwner. The TypeID for this type
is 26 or 0x0000001a.
BaseTxValidatorValidator has aNodeID,StartTime,EndTime, andWeightNodeIDis the 20 byte node ID of the validator.StartTimeis a long which is the Unix time when the validator starts validating.EndTimeis a long which is the Unix time when the validator stops validating.Weightis a long which is the amount the validator stakes
SubnetIDis the 32 byte Avalanche L1 ID (SubnetID) of the Avalanche L1 this delegation is on.StakeOutsAn array of Transferable Outputs. Where to send staked tokens when done validating.DelegatorRewardsOwnerWhere to send staking rewards when done validating.
Gantt Unsigned Add Permissionless Delegator TX Specification
Proto Unsigned Add Permissionless Delegator TX Specification
Unsigned Add Permissionless Delegator TX Example
Let's make an unsigned add permissionless delegator TX that uses the inputs and outputs from the previous examples:
BaseTx:"Example BaseTx as defined above with ID set to 1a"Validator:0x5fa29ed4356903dac2364713c60f57d8472c7dda00000000639761970000000063beee97000001d1a94a2000SubnetID:0xf3086d7bfc35be1c68db664ba9ce61a2060126b0d6b4bfb09fd7a5fb7678cadaStakeOuts:0x000000013d0ad12b8ee8928edf248ca91ca55600fb383f07c32bff1d6dec472b25cf59a700000007000001d1a94a20000000000000000000000000010000000133eeffc64785cf9d80e7731d9f31f67bd03c5cf0DelegatorRewardsOwner:0x0000000b0000000000000000000000010000000172f3eb9aeaf8283011ce6e437fdecd65eace8f52
Unsigned Transform Avalanche L1 TX
Transforms a permissioned Avalanche L1 into a permissionless Avalanche L1. Must be signed by the Avalanche L1 owner.
What Unsigned Transform Avalanche L1 TX Contains
An unsigned transform Avalanche L1 TX contains a BaseTx, SubnetID, AssetID,
InitialSupply, MaximumSupply, MinConsumptionRate, MaxConsumptionRate,
MinValidatorStake, MaxValidatorStake, MinStakeDuration,
MaxStakeDuration, MinDelegationFee, MinDelegatorStake,
MaxValidatorWeightFactor, UptimeRequirement, and SubnetAuth. The TypeID
for this type is 24 or 0x00000018.
BaseTxSubnetIDa 32-byte Avalanche L1 ID of the Avalanche L1 to transform.AssetIDis a 32-byte array that defines which asset to use when staking on the Avalanche L1.- Restrictions
- Must not be the Empty ID
- Must not be the AVAX ID
- Restrictions
InitialSupplyis a long which is the amount to initially specify as the current supply.- Restrictions
- Must be > 0
- Restrictions
MaximumSupplyis a long which is the amount to specify as the maximum token supply.- Restrictions
- Must be >= [InitialSupply]
- Restrictions
MinConsumptionRateis a long which is the rate to allocate funds if the validator's stake duration is 0.MaxConsumptionRateis a long which is the rate to allocate funds if the validator's stake duration is equal to the minting period.- Restrictions
- Must be
>=[MinConsumptionRate] - Must be
<=[reward.PercentDenominator]
- Must be
- Restrictions
MinValidatorStakeis a long which the minimum amount of funds required to become a validator.- Restrictions
- Must be
>0 - Must be
<=[InitialSupply]
- Must be
- Restrictions
MaxValidatorStakeis a long which is the maximum amount of funds a single validator can be allocated, including delegated funds.- Restrictions:
- Must be
>=[MinValidatorStake] - Must be
<=[MaximumSupply]
- Must be
- Restrictions:
MinStakeDurationis a short which is the minimum number of seconds a staker can stake for.- Restrictions
- Must be
>0
- Must be
- Restrictions
MaxStakeDurationis a short which is the maximum number of seconds a staker can stake for.- Restrictions
- Must be
>=[MinStakeDuration] - Must be
<=[GlobalMaxStakeDuration]
- Must be
- Restrictions
MinDelegationFeeis a short is the minimum percentage a validator must charge a delegator for delegating.- Restrictions
- Must be
<=[reward.PercentDenominator]
- Must be
- Restrictions
MinDelegatorStakeis a short which is the minimum amount of funds required to become a delegator.- Restrictions
- Must be
>0
- Must be
- Restrictions
MaxValidatorWeightFactoris a byte which is the factor which calculates the maximum amount of delegation a validator can receive. Note: a value of 1 effectively disables delegation.- Restrictions
- Must be
>0
- Must be
- Restrictions
UptimeRequirementis a short which is the minimum percentage a validator must be online and responsive to receive a reward.- Restrictions
- Must be
<=[reward.PercentDenominator]
- Must be
- Restrictions
SubnetAuthcontainsSigIndicesand has a type id of0x0000000a.SigIndicesis a list of unique ints that define the addresses signing the control signature to authorizes this transformation. The array must be sorted low to high.
Gantt Unsigned Transform Avalanche L1 TX Specification
Proto Unsigned Transform Avalanche L1 TX Specification
Unsigned Transform Avalanche L1 TX Example
Let's make an unsigned transform Avalanche L1 TX that uses the inputs and outputs from the previous examples:
BaseTx:"Example BaseTx as defined above with ID set to 18"SubnetID:0x5fa29ed4356903dac2364713c60f57d8472c7dda4a5e08d88a88ad8ea71aed60AssetID:0xf3086d7bfc35be1c68db664ba9ce61a2060126b0d6b4bfb09fd7a5fb7678cadaInitialSupply:0x000000e8d4a51000MaximumSupply:0x000009184e72a000MinConsumptionRate:0x0000000000000001MaxConsumptionRate:0x000000000000000aMinValidatorStake:0x000000174876e800MaxValidatorStake:0x000001d1a94a2000MinStakeDuration:0x00015180MaxStakeDuration:0x01e13380MinDelegationFee:0x00002710MinDelegatorStake:0x000000174876e800MaxValidatorWeightFactor:0x05UptimeRequirement:0x000c3500SubnetAuth:TypeID:0x0000000aSigIndices:0x00000000
// SubnetAuth
Unsigned Add Avalanche L1 Validator TX
What Unsigned Add Avalanche L1 Validator TX Contains
An unsigned add Avalanche L1 validator TX contains a BaseTx, Validator,
SubnetID, and SubnetAuth. The TypeID for this type is 0x0000000d.
BaseTxValidatorValidator has aNodeID,StartTime,EndTime, andWeightNodeIDis the 20 byte node ID of the validator.StartTimeis a long which is the Unix time when the validator starts validating.EndTimeis a long which is the Unix time when the validator stops validating.Weightis a long which is the amount the validator stakes
SubnetIDis the 32 byte Avalanche L1 ID to add the validator to.SubnetAuthcontainsSigIndicesand has a type id of0x0000000a.SigIndicesis a list of unique ints that define the addresses signing the control signature to add a validator to an Avalanche L1. The array must be sorted low to high.
Gantt Unsigned Add Avalanche L1 Validator TX Specification
Proto Unsigned Add Avalanche L1 Validator TX Specification
Unsigned Add Avalanche L1 Validator TX Example
Let's make an unsigned add Avalanche L1 validator TX that uses the inputs and outputs from the previous examples:
BaseTx:"Example BaseTx as defined above with ID set to 0d"NodeID:0xe9094f73698002fd52c90819b457b9fbc866ab80StarTime:0x000000005f21f31dEndTime:0x000000005f497dc6Weight:0x000000000000d431SubnetID:0x58b1092871db85bc752742054e2e8be0adf8166ec1f0f0769f4779f14c71d7ebSubnetAuth:TypeID:0x0000000aSigIndices:0x00000000
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.
BaseTxValidatorValidator has aNodeID,StartTime,EndTime, andWeightNodeIDis 20 bytes which is the node ID of the delegatee.StartTimeis a long which is the Unix time when the delegator starts delegating.EndTimeis a long which is the Unix time when the delegator stops delegating (and staked AVAX is returned).Weightis a long which is the amount the delegator stakes
StakeStake hasLockedOutsLockedOutsAn 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.
RewardsOwnerAnSECP256K1OutputOwners
Gantt Unsigned Add Delegator TX Specification
Proto Unsigned Add Delegator TX Specification
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:0xe9094f73698002fd52c90819b457b9fbc866ab80StarTime:0x000000005f21f31dEndTime:0x000000005f497dc6Weight:0x000000000000d431Stake:0x0000000139c33a499ce4c33a3b09cdd2cfa01ae70dbf2d18b2d7d168524440e55d55008800000007000001d1a94a2000000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29cRewardsOwner:0x0000000b00000000000000000000000100000001da2bee01be82ecc00c34f361eda8eb30fb5a715c
Unsigned Create Chain TX
What Unsigned Create Chain TX Contains
An unsigned create chain TX contains a BaseTx, SubnetID, ChainName,
VMID, FxIDs, GenesisData and SubnetAuth. The TypeID for this type is
0x0000000f.
BaseTxSubnetIDID of the Avalanche L1 that validates this blockchainChainNameA human readable name for the chain; need not be uniqueVMIDID of the VM running on the new chainFxIDsIDs of the feature extensions running on the new chainGenesisDataByte representation of genesis state of the new chainSubnetAuthAuthorizes this blockchain to be added to this Avalanche L1
Gantt Unsigned Create Chain TX Specification
Proto Unsigned Create Chain TX Specification
Unsigned Create Chain TX Example
Let's make an unsigned create chain TX that uses the inputs and outputs from the previous examples:
BaseTx:"Example BaseTx as defined above with ID set to 0f"SubnetID:24tZhrm8j8GCJRE9PomW8FaeqbgGS4UAQjJnqqn8pq5NwYSYV1ChainName:EPIC AVMVMID:avmFxIDs: [secp256k1fx]GenesisData:11111DdZMhYXUZiFV9FNpfpTSQroysXhzWicG954YAKfkrk3bCEzLVY7gun1eAmAwMiQzVhtGpdR6dnPVcfhBE7brzkJ1r4wzi3dgA8G9Jwc4WpZ6Uh4Dr9aTdw7sFA5cpvCAVBsx6Xf3CB82jwH1gjPZ3WQnnCSKr2reoLtam6TfyYRra5xxXSkZcUm6BaJMW4fKzNP58uyExajPYKZvT5LrQ7MPJ9Fp7ebmYSzXg7YYauNARjSubnetAuth:0x0000000a0000000100000000
Unsigned Create Avalanche L1 TX
What Unsigned Create Avalanche L1 TX Contains
An unsigned create Avalanche L1 TX contains a BaseTx, and RewardsOwner. The TypeID for this type is 0x00000010.
BaseTxRewardsOwnerASECP256K1OutputOwners
Gantt Unsigned Create Avalanche L1 TX Specification
Proto Unsigned Create Avalanche L1 TX Specification
Unsigned Create Avalanche L1 TX Example
Let's make an unsigned create Avalanche L1 TX that uses the inputs from the previous examples:
BaseTx: "Example BaseTx as defined above but with TypeID set to 16"RewardsOwner:TypeId: 11Locktime: 0Threshold: 1Addresses: [ 0xda2bee01be82ecc00c34f361eda8eb30fb5a715c ]
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.
BaseTxSourceChainis a 32-byte source blockchain ID.Insis a variable length array of Transferable Inputs.
Gantt Unsigned Import TX Specification
Proto Unsigned Import TX Specification
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"
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.
DestinationChainis the 32 byte ID of the chain where the funds are being exported to.Outsis a variable length array of Transferable Outputs.
Gantt Unsigned Export TX Specification
Proto Unsigned Export TX Specification
Unsigned Export TX Example
Let's make an unsigned export TX that uses the outputs from the previous examples:
BaseTx: "Example BaseTx as defined above" withTypeIDset to 18DestinationChain:0x0000000000000000000000000000000000000000000000000000000000000000Outs: "Example SECP256K1 Transfer Output as defined above"
Credentials
Credentials have one possible types: SECP256K1Credential. Each credential is
paired with an Input or Operation. The order of the credentials match the order
of the inputs or operations.
SECP256K1 Credential
A secp256k1 credential contains a list of 65-byte recoverable signatures.
What SECP256K1 Credential Contains
TypeIDis the ID for this type. It is0x00000009.Signaturesis an array of 65-byte recoverable signatures. The order of the signatures must match the input's signature indices.
Gantt SECP256K1 Credential Specification
Proto SECP256K1 Credential Specification
SECP256K1 Credential Example
Let's make a payment input with:
signatures:0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1e1d1f202122232425262728292a2b2c2e2d2f303132333435363738393a3b3c3d3e3f000x404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5e5d5f606162636465666768696a6b6c6e6d6f707172737475767778797a7b7c7d7e7f00
Signed Transaction
A signed transaction is an unsigned transaction with the addition of an array of credentials.
What Signed Transaction Contains
A signed transaction contains a CodecID, UnsignedTx, and Credentials.
CodecIDThe only current valid codec id is00 00.UnsignedTxis an unsigned transaction, as described above.Credentialsis an array of credentials. Each credential will be paired with the input in the same index at this credential.
Gantt Signed Transaction Specification
Proto Signed Transaction Specification
Signed Transaction Example
Let's make a signed transaction that uses the unsigned transaction and credential from the previous examples.
CodecID:0UnsignedTx:0x0000000100000003ffffffffeeeeeeeeddddddddccccccccbbbbbbbbaaaaaaaa999999998888888800000001000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f000000070000000000003039000000000000d431000000010000000251025c61fbcfc078f69334f834be6dd26d55a955c3344128e060128ede3523a24a461c8943ab085900000001f1e1d1c1b1a191817161514131211101f0e0d0c0b0a09080706050403020100000000005000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f0000000500000000075bcd150000000200000003000000070000000400010203Credentials0x0000000900000002000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1e1d1f202122232425262728292a2b2c2e2d2f303132333435363738393a3b3c3d3e3f00404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5e5d5f606162636465666768696a6b6c6e6d6f707172737475767778797a7b7c7d7e7f00
UTXO
A UTXO is a standalone representation of a transaction output.
What UTXO Contains
A UTXO contains a CodecID, TxID, UTXOIndex, and Output.
CodecIDThe only current valid codec id is00 00.TxIDis a 32-byte transaction ID. Transaction IDs are calculated by taking sha256 of the bytes of the signed transaction.UTXOIndexis an int that specifies which output in the transaction specified byTxIDthat this utxo was created by.AssetIDis a 32-byte array that defines which asset this utxo references.Outputis the output object that created this utxo. The serialization of Outputs was defined above.
Gantt UTXO Specification
Proto UTXO Specification
UTXO Example
Let's make a UTXO from the signed transaction created above:
CodecID:0TxID:0xf966750f438867c3c9828ddcdbe660e21ccdbb36a9276958f011ba472f75d4e7UTXOIndex: 0x00000000AssetID:0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1fOutput:"Example SECP256K1 Transferable Output as defined above"
StakeableLockIn
A StakeableLockIn is a staked and locked input. The StakeableLockIn can only fund StakeableLockOuts with the same address until its lock time has passed.
What StakeableLockIn Contains
A StakeableLockIn contains a TypeID, Locktime and TransferableIn.
TypeIDis the ID for this output type. It is0x00000015.Locktimeis a long that contains the Unix timestamp before which the input can be consumed only to stake. The Unix timestamp is specific to the second.TransferableInis a transferable input object.
Gantt StakeableLockIn Specification
Proto StakeableLockIn Specification
StakeableLockIn Example
Let's make a StakeableLockIn with:
TypeID: 21Locktime: 54321TransferableIn: "Example SECP256K1 Transfer Input as defined above"
StakeableLockOut
A StakeableLockOut is an output that is locked until its lock time, but can be staked in the meantime.
What StakeableLockOut Contains
A StakeableLockOut contains a TypeID, Locktime and TransferableOut.
TypeIDis the ID for this output type. It is0x00000016.Locktimeis a long that contains the Unix timestamp before which the output can be consumed only to stake. The Unix timestamp is specific to the second.transferableout: "Example SECP256K1 Transfer Output as defined above"
Gantt StakeableLockOut Specification
Proto StakeableLockOut Specification
StakeableLockOut Example
Let's make a stakeablelockout with:
TypeID: 22Locktime: 54321TransferableOutput:"Example SECP256K1 Transfer Output from above"
Avalanche L1 Auth
What Avalanche L1 Auth Contains
Specifies the addresses whose signatures will be provided to demonstrate that the owners of an Avalanche L1 approve something.
TypeIDis the ID for this type. It is0x0000000a.AddressIndicesdefines which addresses' signatures will be attached to this transaction. AddressIndices[i] is the index in an Avalanche L1 owner list that corresponds to the signature at index i in the signature list. Must be sorted low to high and not have duplicates.
Gantt Avalanche L1 Auth Specification
Proto Avalanche L1 Auth Specification
Avalanche L1 Auth Example
Let's make an Avalanche L1 auth:
TypeID:10AddressIndices: [0]
Validator
A validator verifies transactions on a blockchain.
What Validator Contains
A validator contains NodeID, Start, End, and Wght
NodeIDis the ID of the validatorStartUnix time this validator starts validatingEndUnix time this validator stops validatingWghtWeight of this validator used when sampling
Gantt Validator Specification
Proto Validator Specification
Validator Example
Let's make a validator:
NodeID:"NodeID-GWPcbFJZFfZreETSoWjPimr846mXEKCtu"Start:1643068824End:1644364767Wght:20
Rewards Owner
Where to send staking rewards when done validating
What Rewards Owner Contains
A rewards owner contains a TypeID, Locktime, Threshold, and Addresses.
TypeIDis the ID for this validator. It is0x0000000b.Locktimeis a long that contains the Unix timestamp that this output can be spent after. The Unix timestamp is specific to the second.Thresholdis an int that names the number of unique signatures required to spend the output. Must be less than or equal to the length ofAddresses. IfAddressesis empty, must be 0.Addressesis 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 Rewards Owner Specification
Proto Rewards Owner Specification
Rewards Owner Example
Let's make a rewards owner:
TypeID:11Locktime:54321Threshold:1Addresses:0x51025c61fbcfc078f69334f834be6dd26d55a9550xc3344128e060128ede3523a24a461c8943ab0859
Last updated on