wire

package
v0.5.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package wire is the cross-VM ZAP-native wire format for the fxs (feature-extension) primitives shared by P-chain (platformvm) and X-chain (xvm). It replaces the legacy luxfi/codec.Manager registry with a (TypeKind, ShapeKind) discriminator pair on every primitive's wire envelope.

Activation: 2025-12-25T16:20:00-08:00 (LP-023). New final Lux network. No backwards compatibility — legacy codec-encoded fxs primitives on the wire are a protocol-violation reject after activation.

Wire envelope per primitive: [TypeKind:1][ShapeKind:1][ZAP message: N].

The TypeKind byte names the fx family (secp256k1fx, mldsafx, ...) and the ShapeKind byte names the primitive shape within that family (TransferOutput, TransferInput, MintOutput, MintOperation, Credential, AttestationOutput, AttestationInput, OutputOwners). The remaining bytes are a ZAP message describing the shape's fields.

This is decomposed from the legacy codec.Manager slot map (which braided "is this an Output? is this an Input? which fx?" into a single dense uint32 slot id). TypeKind + ShapeKind separates the two values cleanly — composition over inheritance.

Package wire is the cross-VM ZAP-native wire format for the fxs (feature-extension) primitives and UTXO envelopes shared across every Lux VM (P-chain platformvm, X-chain xvm, EVM atomic-import).

As of LP-023, the UTXO, TransferableOutput, and TransferableInput shapes are generated from the canonical schema at github.com/luxfi/proto/schemas/utxo/utxo.zap (relative path: ../../proto/schemas/utxo/utxo.zap from this package). Hand-rolled accessor files (utxo.go, transferable_*.go) are being phased out in favor of the generated *_zap.go output.

Regenerate the *_zap.go files after editing the schema:

go generate ./...

See proto/schemas/README.md for the schema-layout convention.

Index

Constants

View Source
const (
	BLS12381PubKeyLen       = 48
	BLS12381AggSigLen       = 96
	BLS12381AttestedHashLen = 32
)

BLS12381 attestation primitives. The bls12381fx is divergent from the classical / PQ pattern — it is attestation-only (no Mint primitives, no transfer-value semantics). The output records "this 32-byte commitment was attested to by the listed BLS public keys at the listed threshold". The input is a signer-bitmap selecting which committee members contributed.

BLS12381 sizes:

  • PubKeyLen = 48 (compressed G1)
  • AggSigLen = 96 (compressed G2)
  • AttestedHashLen = 32
View Source
const (
	OffsetAttestationOutput_AttestedHash = 0  // 32B
	OffsetAttestationOutput_Threshold    = 32 // uint32
	OffsetAttestationOutput_PubKeyList   = 40 // list (8 bytes)
	SizeAttestationOutput                = 48
)

AttestationOutput is the cross-fx ZAP schema for the bls12381fx AttestationOutput.

Fixed-section layout (size 48 bytes):

AttestedHash  32B    @ 0
Threshold     uint32 @ 32
_padding      4B     @ 36   (reserved-zero, 8-aligned)
PubKeyList    list   @ 40   (8 bytes; payload is stride-48 G1 pubkeys)

Wire prefix: TypeKind=0x07 (BLS12381), ShapeKind=0x07 (AttestationOutput).

View Source
const (
	OffsetAttestationInput_SignerBitmap = 0 // bytes (8 bytes)
	SizeAttestationInput                = 8
)

AttestationInput is the cross-fx ZAP schema for the bls12381fx AttestationInput.

Fixed-section layout (size 8 bytes):

SignerBitmap bytes @ 0   (8 bytes — relOffset + length)

The signer bitmap is a packed bit array where bit i (LSB of byte i/8) indicates that PubKeys[i] of the spent AttestationOutput contributed to the aggregate signature.

Wire prefix: TypeKind=0x07 (BLS12381), ShapeKind=0x08 (AttestationInput).

View Source
const (
	OffsetCredential_SecurityLevel = 0 // uint8
	OffsetCredential_SignatureList = 4 // list (8 bytes)
	OffsetCredential_PubKeyList    = 12
	SizeCredential                 = 20
)

Credential is the cross-fx ZAP schema for fxs signature credentials.

Classical fx credentials (secp256k1fx, schnorrfx) carry only signatures (the pubkey is recoverable from the sig or implicit from the spent output's address list). Modern fx credentials (ed25519fx, secp256r1fx) carry pubkeys alongside signatures because those schemes are not pubkey-recoverable from a single signature. Post-quantum credentials (mldsafx, slhdsafx) carry a SecurityLevel byte selecting the parameter set, then variable-length signatures.

Fixed-section layout (size 12 bytes):

SecurityLevel  uint8 @ 0   (0=L1, 1=L2, 2=L3, ... — fx-specific; 0 for classical)
_padding       3B    @ 1   (reserved-zero for 4-byte alignment)
SignatureList  list  @ 4   (8 bytes; payload is concatenated signature blobs)

Wire prefix: TypeKind names the fx; ShapeKind is ShapeKindCredential (0x06). The SignatureList payload is a stride-N byte run where N is the per-fx signature size (e.g. 65 for secp256k1, 64 for Ed25519/Schnorr, 3309 for ML-DSA-65). Length field counts CONCATENATED BYTES, not number of signatures — divide by per-fx stride to recover sig count.

PubKeys (when an fx ships them on the wire alongside sigs) live in a trailing PubKeyList field; classical and PQ fxs leave it empty.

View Source
const (
	OffsetLockedOutput_Locktime         = 0 // uint64
	OffsetLockedOutput_TransferOutBytes = 8 // bytes (8 bytes)
	SizeLockedOutput                    = 16
)

LockedOutput is the cross-fx ZAP schema for stakeable-locked outputs (the platformvm/stakeable.LockOut primitive). Carries a Locktime and an inner TransferableOut wire envelope (any fx's TransferOutput). Operationally: an output that cannot be spent until block.Timestamp >= Locktime, wrapping any fx's transfer output.

Fixed-section layout (size 16 bytes):

Locktime         uint64 @ 0   (8 bytes — unlock unix time)
TransferOutBytes bytes  @ 8   (8 bytes — inner wire envelope)

Wire prefix: TypeKind is TypeKindReserved (lock is fx-agnostic; inner envelope carries its own fx TypeKind). ShapeKind is ShapeKindLockedOutput (0x0F). The inner TransferOutBytes carries its own discriminator pair — consumers dispatch via WrapTransferOutput or the fx-specific wrap.

View Source
const (
	OffsetMintOperation_SigIndicesList      = 0  // list (8 bytes)
	OffsetMintOperation_MintOutputBytes     = 8  // bytes (8 bytes)
	OffsetMintOperation_TransferOutputBytes = 16 // bytes (8 bytes)
	SizeMintOperation                       = 24
)

MintOperation is the cross-fx ZAP schema for the MintOperation primitive (Input { SigIndices } + MintOutput + TransferOutput). Operationally: an asset-minting authority (the MintInput's SigIndices) produces a new TransferOutput (value) and updates/re-confirms the MintOutput (mint authority continuation).

Fixed-section layout (size 24 bytes):

SigIndicesList list @ 0    (8 bytes — for the mint authority signatures)
MintOutputBytes bytes @ 8  (8 bytes — wire envelope of MintOutput)
TransferOutputBytes bytes @ 16  (8 bytes — wire envelope of TransferOutput)

Wire prefix: TypeKind names the fx; ShapeKind is ShapeKindMintOperation (0x05). The inner MintOutputBytes and TransferOutputBytes carry their own discriminator pairs — consumers dispatch via WrapMintOutput / WrapTransferOutput.

View Source
const (
	OffsetMintOutput_Locktime    = OffsetOutputOwners_Locktime    // 0
	OffsetMintOutput_Threshold   = OffsetOutputOwners_Threshold   // 8
	OffsetMintOutput_AddressList = OffsetOutputOwners_AddressList // 12
	SizeMintOutput               = SizeOutputOwners               // 20
)

MintOutput is the cross-fx ZAP schema for the MintOutput primitive (`OutputOwners`). Same shape as OutputOwners — MintOutput identifies a mint-authority owner group, not a value-bearing output.

Fixed-section layout (size 20 bytes; identical to OutputOwners):

Locktime    uint64 @ 0
Threshold   uint32 @ 8
AddressList list   @ 12   (4-byte relOffset + 4-byte length, 8 bytes)

Wire prefix: TypeKind names the fx; ShapeKind is ShapeKindMintOutput (0x03). Same payload bytes as a TransferOutput owner section — only the ShapeKind discriminator distinguishes "mint authority" from "spending output".

View Source
const (
	OffsetNFTMintOutput_GroupID     = 0
	OffsetNFTMintOutput_Locktime    = 4
	OffsetNFTMintOutput_Threshold   = 12
	OffsetNFTMintOutput_AddressList = 16
	SizeNFTMintOutput               = 24
)

---- NFTMintOutput ----

Fixed-section layout (size 24 bytes):

GroupID     uint32 @ 0
Locktime    uint64 @ 4
Threshold   uint32 @ 12
AddressList list   @ 16   (8 bytes)
View Source
const (
	OffsetNFTTransferOutput_GroupID     = 0
	OffsetNFTTransferOutput_Locktime    = 4
	OffsetNFTTransferOutput_Threshold   = 12
	OffsetNFTTransferOutput_AddressList = 16
	OffsetNFTTransferOutput_Payload     = 24
	SizeNFTTransferOutput               = 32
)

---- NFTTransferOutput ----

Fixed-section layout (size 32 bytes):

GroupID     uint32 @ 0
Locktime    uint64 @ 4
Threshold   uint32 @ 12
AddressList list   @ 16   (8 bytes)
Payload     bytes  @ 24   (8 bytes)
View Source
const (
	OffsetNFTMintOperation_SigIndicesList = 0
	OffsetNFTMintOperation_GroupID        = 8
	OffsetNFTMintOperation_Payload        = 12
	OffsetNFTMintOperation_OwnersCount    = 20
	OffsetNFTMintOperation_OwnersBytes    = 24
	SizeNFTMintOperation                  = 36
)

---- NFTMintOperation ----

Fixed-section layout (size 36 bytes):

SigIndicesList list  @ 0    (8 bytes)
GroupID        uint32 @ 8
Payload        bytes @ 12   (8 bytes)
OwnersCount    uint32 @ 20
OwnersBytes    bytes @ 24   (8 bytes — concatenated OutputOwners envelopes)
_pad           uint32 @ 32  (reserved, zero)

Each owners entry is a self-describing OutputOwners wire envelope; walk with OwnersAt.

View Source
const (
	OffsetNFTTransferOp_SigIndicesList = 0
	OffsetNFTTransferOp_OutputBytes    = 8
	SizeNFTTransferOp                  = 16
)

---- NFTTransferOperation ----

Fixed-section layout (size 16 bytes):

SigIndicesList list  @ 0   (8 bytes)
OutputBytes    bytes @ 8   (8 bytes — wire envelope of NFTTransferOutput)
View Source
const (
	OffsetOwnedOutput_Locktime    = OffsetOutputOwners_Locktime
	OffsetOwnedOutput_Threshold   = OffsetOutputOwners_Threshold
	OffsetOwnedOutput_AddressList = OffsetOutputOwners_AddressList
	SizeOwnedOutput               = SizeOutputOwners
)

---- OwnedOutput ----

Bare OutputOwners state output (propertyfx). Same payload layout as OutputOwners/MintOutput; the distinct ShapeKind is what separates a property state output from a mint authority.

View Source
const (
	OffsetBurnOperation_SigIndicesList = 0
	SizeBurnOperation                  = 8
)

---- BurnOperation ----

Fixed-section layout (size 8 bytes):

SigIndicesList list @ 0   (8 bytes)
View Source
const (
	OffsetOutputOwners_Locktime    = 0  // uint64
	OffsetOutputOwners_Threshold   = 8  // uint32
	OffsetOutputOwners_AddressList = 12 // list (8 bytes)
	SizeOutputOwners               = 20
)

OutputOwners is the cross-VM ZAP schema for github.com/luxfi/utxo/secp256k1fx.OutputOwners. Carries a Locktime, a signature-threshold count, and a variable-length list of 20-byte addresses (the addresses that may co-sign to spend an output owned by this group).

Fixed-section layout (size 20 bytes; uint64 reads alignment-tolerant):

Locktime    uint64 @ 0
Threshold   uint32 @ 8
AddressList list   @ 12   (4-byte relOffset + 4-byte length, 8 bytes)

Total fixed section = 20 bytes. AddressList payload is stride-20 in the variable section.

Semantically equivalent to message.PChainOwner when Locktime=0; the PChainOwner wire envelope uses ShapeKindPChainOwner and skips the Locktime field entirely (see WrapPChainOwner below).

View Source
const (
	OffsetPChainOwner_Threshold   = 0 // uint32
	OffsetPChainOwner_AddressList = 4 // list (8 bytes)
	SizePChainOwner               = 12
)

PChainOwner is the cross-VM ZAP schema for github.com/luxfi/node/vms/platformvm/warp/message.PChainOwner. Strict subset of OutputOwners: Threshold + Addresses, no Locktime.

Used in warp validator registration where locktime is not a meaningful gate (validator weight changes happen at known points in the permissionless validator pipeline).

Fixed-section layout (size 12 bytes):

Threshold   uint32 @ 0
AddressList list   @ 4   (4-byte relOffset + 4-byte length, 8 bytes)

Total fixed section = 12 bytes.

View Source
const (
	OffsetPQMintOutput_SecurityLevel = OffsetPQOutputOwners_SecurityLevel // 0
	OffsetPQMintOutput_Locktime      = OffsetPQOutputOwners_Locktime      // 8
	OffsetPQMintOutput_Threshold     = OffsetPQOutputOwners_Threshold     // 16
	OffsetPQMintOutput_PubKeyList    = OffsetPQOutputOwners_PubKeyList    // 24
	SizePQMintOutput                 = SizePQOutputOwners                 // 32
)

PQMintOutput is the cross-PQ-fx ZAP schema for the MintOutput primitive carrying variable-length PQ pubkeys (mldsafx, slhdsafx).

Same payload as PQOutputOwners — MintOutput identifies a mint-authority owner group, not a value-bearing output. Only the ShapeKind discriminator distinguishes "mint authority" from "spending owner".

View Source
const (
	OffsetPQOutputOwners_SecurityLevel = 0  // uint8
	OffsetPQOutputOwners_Locktime      = 8  // uint64
	OffsetPQOutputOwners_Threshold     = 16 // uint32
	OffsetPQOutputOwners_PubKeyList    = 24 // list (8 bytes)
	SizePQOutputOwners                 = 32
)

PQOutputOwners is the cross-PQ-fx ZAP schema for fx-specific OutputOwners that carry FULL post-quantum public keys (not the 20-byte hashed ShortIDs used by classical fxs). Both mldsafx and slhdsafx are pubkey-on-chain (no hash address derivation in the owner set), so they need a wire schema that varies the pubkey stride by the SecurityLevel byte.

Fixed-section layout (size 28 bytes; uint64 alignment-tolerant):

SecurityLevel uint8  @ 0
_padding      7B     @ 1   (reserved-zero, 8-aligned)
Locktime      uint64 @ 8
Threshold     uint32 @ 16
_padding      4B     @ 20  (reserved-zero, 8-aligned)
PubKeyList    list   @ 24  (8 bytes; payload stride is fx-specific —
                            mldsafx: 1312/1952/2592, slhdsafx: 32/48/64)

Wire prefix: TypeKind names the fx (mldsafx, slhdsafx); ShapeKind is ShapeKindPQOutputOwners (0x0F).

View Source
const (
	OffsetPQTransferOutput_SecurityLevel = 0  // uint8
	OffsetPQTransferOutput_Amount        = 8  // uint64
	OffsetPQTransferOutput_Locktime      = 16 // uint64
	OffsetPQTransferOutput_Threshold     = 24 // uint32
	OffsetPQTransferOutput_PubKeyList    = 32 // list (8 bytes)
	SizePQTransferOutput                 = 40
)

PQTransferOutput is the cross-PQ-fx ZAP schema for the TransferOutput primitive carrying variable-length PQ pubkeys (mldsafx, slhdsafx).

Fixed-section layout (size 40 bytes; uint64 alignment-tolerant):

SecurityLevel uint8  @ 0
_padding      7B     @ 1   (reserved-zero, 8-aligned)
Amount        uint64 @ 8
Locktime      uint64 @ 16
Threshold     uint32 @ 24
_padding      4B     @ 28  (reserved-zero, 8-aligned)
PubKeyList    list   @ 32  (8 bytes; payload stride is fx-specific)

Wire prefix: TypeKind names the fx; ShapeKind is ShapeKindPQTransferOutput (0x10).

View Source
const (
	OffsetSignedTx_UnsignedBytes   = 0  // bytes (8 bytes)
	OffsetSignedTx_CredentialCount = 8  // uint32 (number of credentials)
	OffsetSignedTx_CredentialBytes = 12 // bytes (8 bytes — all credential envelopes concatenated)
	SizeSignedTx                   = 20
)

SignedTx is the ZAP-native replacement for the legacy `txs.Tx{Unsigned UnsignedTx; Creds []verify.Verifiable}` envelope used by both platformvm and xvm. It wraps:

  • UnsignedBytes: the canonical wire bytes the signature was computed over
  • Credentials: a list of fxs Credential wire envelopes (one per input)

The unsigned bytes already carry a TxKind discriminator at offset 0 (see vms/platformvm/txs/zap_native/kind.go). The Credentials list indices align with the UnsignedTx's input list indices (1:1 by index) just like the legacy Tx.Creds slice.

Fixed-section layout (size 16 bytes):

UnsignedBytes  bytes @ 0   (8 bytes — relOffset + length)
Credentials    list  @ 8   (8 bytes — relOffset + length; stride is
                            the per-credential ENVELOPE size, variable)

Wire prefix: TypeKind=0x00 (reserved/cross-VM envelope), ShapeKind=0x0E (SignedTx).

Because credentials are variable-stride byte envelopes (each carries its own TypeKind+ShapeKind+ZAP message of independent length), the credential list is encoded as a packed sequence of length-prefixed envelopes rather than a fixed-stride ZAP list. See SignedTx.CredentialAt for the parser.

View Source
const (
	OffsetTransferInput_Amount         = 0 // uint64
	OffsetTransferInput_SigIndicesList = 8 // list (8 bytes)
	SizeTransferInput                  = 16
)

TransferInput is the cross-fx ZAP schema for the TransferInput primitive (`Amt uint64 + SigIndices []uint32`). The semantics are uniform across classical and PQ fxs — only the matching Credential's signature size varies.

Fixed-section layout (size 16 bytes):

Amount         uint64 @ 0
SigIndicesList list   @ 8   (4-byte relOffset + 4-byte length, 8 bytes)

SigIndicesList payload is stride-4 (each entry is a uint32).

Wire prefix discriminator: TypeKind names the fx; ShapeKind is ShapeKindTransferInput (0x02).

View Source
const (
	OffsetTransferOutput_Amount      = 0  // uint64
	OffsetTransferOutput_Locktime    = 8  // uint64
	OffsetTransferOutput_Threshold   = 16 // uint32
	OffsetTransferOutput_AddressList = 20 // list (8 bytes)
	SizeTransferOutput               = 28
)

TransferOutput is the cross-fx ZAP schema for the TransferOutput primitive (`Amt uint64 + OutputOwners`). Every classical fx (secp256k1fx, ed25519fx, secp256r1fx, schnorrfx) and post-quantum fx (mldsafx, slhdsafx) use this same shape — they differ only in the Credential's signature size, not in the spending-output layout.

Fixed-section layout (size 28 bytes; uint64 reads alignment-tolerant):

Amount      uint64 @ 0
Locktime    uint64 @ 8
Threshold   uint32 @ 16
AddressList list   @ 20   (4-byte relOffset + 4-byte length, 8 bytes)

Total fixed section = 28 bytes. The TypeKind discriminator byte in the 2-byte wire prefix names the owning fx (e.g. 0x01=secp256k1fx, 0x02=mldsafx). The ShapeKind byte is always ShapeKindTransferOutput (0x01).

View Source
const (
	OffsetTransferableOut_AssetID = 0
	OffsetTransferableOut_Output  = 32
	SizeTransferableOut           = 40
)

---- TransferableOut object ----

AssetID 32B   @ 0
Output  bytes @ 32  (relOffset + length, 8 bytes — inner fx Output envelope)
View Source
const (
	OffsetTransferableIn_TxID        = 0
	OffsetTransferableIn_OutputIndex = 32
	OffsetTransferableIn_AssetID     = 36
	OffsetTransferableIn_Input       = 68
	SizeTransferableIn               = 76
)

---- TransferableIn object ----

TxID        32B    @ 0
OutputIndex uint32 @ 32
AssetID     32B    @ 36
Input       bytes  @ 68  (relOffset + length, 8 bytes — inner fx Input envelope)
View Source
const (
	OffsetUTXO_TxID        = 0
	OffsetUTXO_OutputIndex = 32 // uint32
	OffsetUTXO_AssetID     = 36 // 32B
	OffsetUTXO_Output      = 68 // bytes (relOffset + length, 8 bytes)
	SizeUTXO               = 76
)

UTXO is the cross-VM ZAP schema for github.com/luxfi/utxo.UTXO. Carries the spent TxID + OutputIndex (UTXOID), the asset identifier, and the concrete output payload (a fxs primitive — TransferOutput, MintOutput, AttestationOutput). The output payload is itself a wire envelope with its own (TypeKind, ShapeKind) discriminator pair, written as a bytes field in the parent UTXO message.

Fixed-section layout (size 76 bytes; uint64 reads alignment-tolerant):

TxID         32B    @ 0
OutputIndex  uint32 @ 32
AssetID      32B    @ 36
Output       bytes  @ 68  (relOffset + length, 8 bytes)

Total fixed section = 32 + 4 + 32 + 8 = 76 bytes.

The Output bytes field carries the inner fxs primitive's wire envelope (2-byte discriminator prefix + ZAP message). Consumers parse it via WrapTransferableOutput / WrapMintOutput / WrapAttestationOutput, dispatching on the discriminator pair.

View Source
const (
	OffsetXVMBaseTx_NetworkID    = 0
	OffsetXVMBaseTx_BlockchainID = 8
	OffsetXVMBaseTx_Outs         = 40
	OffsetXVMBaseTx_Ins          = 48
	OffsetXVMBaseTx_Memo         = 56
	SizeXVMBaseTx                = 64
)

XVMBaseTx is the X-chain BaseTx wire object — the ZAP-native replacement for the reflection-encoded `xvm/txs.BaseTx`.

NATIVE-NESTED FORM: the outputs and inputs are AddObjectPtr object-lists — each element is a TransferableOut/In object living INLINE in this same buffer, reached by a 4-byte signed pointer slot. There are no per-container TypeKind/ShapeKind prefixes, no blob concatenation, and no parallel length list: the object-ptr list is the native "repeated message" encoding. The inner fx Output/Input envelope (which DOES carry an fx discriminator, since polymorphism lives there) is stored zero-copy in the leaf object's bytes field.

NetworkID    uint32     @ 0
BlockchainID 32B        @ 8   (8-aligned)
Outs         objptrlist @ 40  (relOffset + count, 8 bytes)
Ins          objptrlist @ 48  (relOffset + count, 8 bytes)
Memo         bytes      @ 56  (relOffset + length, 8 bytes)
View Source
const AddressStride = ids.ShortIDLen

AddressStride is the per-element width of an AddressList in the OutputOwners variable section. Each address is a 20-byte ids.ShortID.

View Source
const EnvelopePrefix = 2

EnvelopePrefix is the 2-byte discriminator prefix that every fxs primitive's wire envelope begins with. The remainder of the envelope is a ZAP message describing the shape's fields.

View Source
const SigIndexStride = 4

SigIndexStride is the per-element width of the SigIndices list (one uint32 per index).

Variables

View Source
var (
	ErrWrongTypeKind  = errors.New("wire: TypeKind discriminator does not match expected fx family")
	ErrWrongShapeKind = errors.New("wire: ShapeKind discriminator does not match expected primitive shape")
	ErrShortEnvelope  = errors.New("wire: envelope shorter than 2-byte discriminator prefix")
	// ErrTrailingBytes is returned when an envelope carries bytes beyond the
	// self-delimiting ZAP message. zap.Parse truncates to the header size
	// field, so a buffer with a trailing tail would wrap the same message
	// but hash to a different id — a malleability vector. Canonical
	// envelopes MUST consume every byte; mirrors the proven node-side
	// block/blockwire.go ErrExtraSpace (msg.Size() != len(bytes)).
	ErrTrailingBytes = errors.New("wire: trailing bytes after zap message (non-canonical envelope)")
)

Errors returned by every Wrap*Primitive accessor when the discriminator pair on the wire does not match the expected (TypeKind, ShapeKind) for the function being called. This closes the cross-type confusion surface where a TransferInput buffer could be Wrap'd as a TransferOutput and return garbage-but-deterministic field reads.

View Source
var (
	ErrOwnerThresholdZero         = errors.New("wire: OutputOwners.Threshold must be > 0; threshold=0 disables authorization")
	ErrOwnerThresholdExceedsAddrs = errors.New("wire: OutputOwners.Threshold exceeds Addresses.Len() — unsatisfiable signer quorum")
	ErrOwnerAddrsEmpty            = errors.New("wire: OutputOwners.Addresses is empty — signer set undefined")
	ErrOwnerAddrZero              = errors.New("wire: OutputOwners.Addresses contains the zero ShortID — phantom signer")
)

Semantic-verification errors. The wire layer (ZAP) is permissive by design — semantic gates live here. Mirrors the zap_native/owner.go Owner.SyntacticVerify error set so cross-VM consumers see a single canonical error set.

View Source
var (
	ErrPQOwnerPubKeysEmpty       = errors.New("wire: PQOutputOwners.PubKeys is empty — signer set undefined")
	ErrPQOwnerThresholdZero      = errors.New("wire: PQOutputOwners.Threshold must be > 0; threshold=0 disables authorization")
	ErrPQOwnerThresholdExceeds   = errors.New("wire: PQOutputOwners.Threshold exceeds PubKeys.Len() — unsatisfiable signer quorum")
	ErrPQOwnerPubKeyWrongStride  = errors.New("wire: PQOutputOwners.PubKeys entry does not match SecurityLevel's pubkey stride")
	ErrPQOwnerPubKeysNotSortedUq = errors.New("wire: PQOutputOwners.PubKeys not sorted lexicographically and unique")
	ErrPQAmountZero              = errors.New("wire: PQTransferOutput.Amount must be > 0; zero-value transfers are not permitted")
)

Semantic-verification errors for PQ owners.

Functions

func AppendTransferableIn added in v0.5.6

func AppendTransferableIn(b *zap.Builder, txID ids.ID, outputIndex uint32, assetID ids.ID, innerEnvelope []byte) int

AppendTransferableIn writes a TransferableIn object into b and returns its offset.

func AppendTransferableOut added in v0.5.6

func AppendTransferableOut(b *zap.Builder, assetID ids.ID, innerEnvelope []byte) int

AppendTransferableOut writes a TransferableOut object into b and returns its offset (for an AddObjectPtr slot). The inner fx Output envelope bytes are stored zero-copy in the Output field. Exported so any native-nested carrier (XVMBaseTx here, ExportTx in node) nests a transferable ONE way.

func NewAttestationInput

func NewAttestationInput(in AttestationInputInput) []byte

NewAttestationInput builds an AttestationInput wire envelope.

func NewAttestationOutput

func NewAttestationOutput(in AttestationOutputInput) []byte

NewAttestationOutput builds an AttestationOutput wire envelope.

func NewBurnOperation added in v0.5.1

func NewBurnOperation(in BurnOperationInput) []byte

NewBurnOperation builds a BurnOperation wire envelope.

func NewCredential

func NewCredential(in CredentialInput) []byte

NewCredential builds a Credential wire envelope.

func NewLockedOutput added in v0.3.6

func NewLockedOutput(in LockedOutputInput) []byte

NewLockedOutput builds a LockedOutput wire envelope.

func NewMintOperation

func NewMintOperation(in MintOperationInput) []byte

NewMintOperation builds a MintOperation wire envelope.

func NewMintOutput

func NewMintOutput(in MintOutputInput) []byte

NewMintOutput builds a MintOutput wire envelope.

func NewNFTMintOperation added in v0.5.1

func NewNFTMintOperation(in NFTMintOperationInput) []byte

NewNFTMintOperation builds an NFTMintOperation wire envelope.

func NewNFTMintOutput added in v0.5.1

func NewNFTMintOutput(in NFTMintOutputInput) []byte

NewNFTMintOutput builds an NFTMintOutput wire envelope.

func NewNFTTransferOperation added in v0.5.1

func NewNFTTransferOperation(in NFTTransferOperationInput) []byte

NewNFTTransferOperation builds an NFTTransferOperation wire envelope.

func NewNFTTransferOutput added in v0.5.1

func NewNFTTransferOutput(in NFTTransferOutputInput) []byte

NewNFTTransferOutput builds an NFTTransferOutput wire envelope.

func NewOutputOwners

func NewOutputOwners(in OutputOwnersInput) []byte

NewOutputOwners builds an OutputOwners wire envelope.

func NewOwnedOutput added in v0.5.1

func NewOwnedOutput(in OwnedOutputInput) []byte

NewOwnedOutput builds an OwnedOutput wire envelope.

func NewPChainOwner

func NewPChainOwner(in PChainOwnerInput) []byte

NewPChainOwner builds a PChainOwner wire envelope.

func NewPQMintOutput

func NewPQMintOutput(in PQMintOutputInput) []byte

NewPQMintOutput builds a PQMintOutput wire envelope.

func NewPQOutputOwners

func NewPQOutputOwners(in PQOutputOwnersInput) []byte

NewPQOutputOwners builds a PQOutputOwners wire envelope.

func NewPQTransferOutput

func NewPQTransferOutput(in PQTransferOutputInput) []byte

NewPQTransferOutput builds a PQTransferOutput wire envelope.

func NewSignedTx

func NewSignedTx(in SignedTxInput) []byte

NewSignedTx builds a SignedTx wire envelope. The unsigned bytes are stored verbatim, and the credentials slice is concatenated into a single byte run — the per-credential ZAP header carries each envelope's length so the parser can walk them.

func NewTransferInput

func NewTransferInput(in TransferInputInput) []byte

NewTransferInput builds a TransferInput wire envelope.

func NewTransferOutput

func NewTransferOutput(in TransferOutputInput) []byte

NewTransferOutput builds a TransferOutput wire envelope.

func NewUTXO

func NewUTXO(in UTXOInput) []byte

NewUTXO builds a UTXO wire envelope (2-byte discriminator prefix + ZAP message) from the input fields. The returned slice is the canonical on-wire representation.

func NewXVMBaseTx added in v0.3.8

func NewXVMBaseTx(in XVMBaseTxInput) []byte

NewXVMBaseTx builds an XVM BaseTx wire envelope with native-nested out/in object lists — one buffer, one Finish, zero per-container prefix, zero blob concatenation.

func NextEnvelope added in v0.5.1

func NextEnvelope(blob []byte) (env, rest []byte, err error)

NextEnvelope splits the first self-describing wire envelope off a packed sequence of concatenated envelopes and returns (envelope, rest). The envelope length is EnvelopePrefix + the inner ZAP message size (the little-endian uint32 at ZAP-header offset 12..16, which counts the full message including its header). This is the ONE walker for every packed envelope list (SignedTx credentials, XVMBaseTx outs/ins, nft mint owners).

func PeekDiscriminator added in v0.3.7

func PeekDiscriminator(b []byte) (TypeKind, ShapeKind, error)

PeekDiscriminator returns the (TypeKind, ShapeKind) of a wire envelope without consuming the ZAP body. Used by composite-shape dispatchers (e.g. LockedOutput) that need to recurse on an inner envelope's discriminator without committing to a Wrap*. Returns ErrShortEnvelope when the buffer is shorter than the 2-byte prefix.

func SignSecp256k1

func SignSecp256k1(unsignedBytes []byte, signers [][]*secp256k1.PrivateKey) ([]byte, error)

SignSecp256k1 is the ZAP-native replacement for the legacy `txs.Tx.Sign(c codec.Manager, ...)` method. It takes the unsigned tx bytes (already ZAP-encoded by the txs.zap_native build path) plus a list of signer groups (one group per input, like the legacy API), and returns a fully-formed SignedTx wire envelope.

The signing target is hash(unsignedBytes) — same as the legacy Sign. Each signer group produces one Credential whose Signatures field is the concatenation of all per-key secp256k1 signatures.

This is the canonical secp256k1fx signing entry point. For multi-fx signing (mixing secp256k1 + ML-DSA + Ed25519 credentials), build the per-input credentials individually with NewCredential and pass them directly to NewSignedTx.

Returns:

  • signedTxBytes: the canonical wire envelope (SignedTx{unsigned, creds})
  • err: a typed error from secp256k1.PrivateKey.SignHash on failure

Types

type AddressList

type AddressList struct {
	// contains filtered or unexported fields
}

AddressList is the zero-copy view over the address list inside an OutputOwners. Stride is 20 bytes (ids.ShortIDLen).

func (AddressList) All

func (a AddressList) All() []ids.ShortID

All returns a fresh []ShortID copy of every address in the list.

func (AddressList) At

func (a AddressList) At(i int) ids.ShortID

At returns the i'th address. Returns the zero ShortID when out of range.

CONSUMER SAFETY (RED-HIGH-3): when i >= the actual entry count (a malicious encoder published a length-padded list), this returns the zero ShortID which is a phantom signer. Always call OutputOwners.SyntacticVerify() before iterating.

func (AddressList) IsNull

func (a AddressList) IsNull() bool

IsNull returns true if no list pointer was set.

func (AddressList) Len

func (a AddressList) Len() int

Len returns the number of addresses.

type AttestationInput

type AttestationInput struct {
	// contains filtered or unexported fields
}

AttestationInput is the zero-copy typed accessor.

func WrapAttestationInput

func WrapAttestationInput(b []byte) (AttestationInput, error)

WrapAttestationInput parses an AttestationInput wire envelope.

func (AttestationInput) IsZero

func (a AttestationInput) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (AttestationInput) SignerBitmap

func (a AttestationInput) SignerBitmap() []byte

SignerBitmap returns the signer-selection bitmap.

READ-ONLY: aliases the underlying buffer.

type AttestationInputInput

type AttestationInputInput struct {
	SignerBitmap []byte
}

AttestationInputInput is the constructor input.

type AttestationOutput

type AttestationOutput struct {
	// contains filtered or unexported fields
}

AttestationOutput is the zero-copy typed accessor.

func WrapAttestationOutput

func WrapAttestationOutput(b []byte) (AttestationOutput, error)

WrapAttestationOutput parses an AttestationOutput wire envelope.

func (AttestationOutput) AttestedHash

AttestedHash returns the 32-byte commitment.

func (AttestationOutput) IsZero

func (a AttestationOutput) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (AttestationOutput) PubKeys

func (a AttestationOutput) PubKeys() [][]byte

PubKeys returns the committee pubkeys as a fresh [][]byte slice (each inner []byte is BLS12381PubKeyLen = 48 bytes).

func (AttestationOutput) Threshold

func (a AttestationOutput) Threshold() uint32

Threshold returns the minimum number of pubkeys required.

type AttestationOutputInput

type AttestationOutputInput struct {
	AttestedHash [BLS12381AttestedHashLen]byte
	Threshold    uint32
	// PubKeys MUST each be BLS12381PubKeyLen bytes; the constructor does
	// not pad or truncate. Sort lexicographically before passing in —
	// AttestationOutput.Verify requires sorted-unique pubkeys.
	PubKeys [][]byte
}

AttestationOutputInput is the constructor input.

type BurnOperation added in v0.5.1

type BurnOperation struct {
	// contains filtered or unexported fields
}

BurnOperation is the zero-copy typed accessor.

func WrapBurnOperation added in v0.5.1

func WrapBurnOperation(b []byte) (BurnOperation, error)

WrapBurnOperation parses a BurnOperation wire envelope.

func (BurnOperation) IsZero added in v0.5.1

func (m BurnOperation) IsZero() bool

func (BurnOperation) SigIndices added in v0.5.1

func (m BurnOperation) SigIndices() []uint32

SigIndices returns the input signature indices.

func (BurnOperation) TypeKind added in v0.5.1

func (m BurnOperation) TypeKind() TypeKind

type BurnOperationInput added in v0.5.1

type BurnOperationInput struct {
	TypeKind   TypeKind
	SigIndices []uint32
}

BurnOperationInput is the constructor input.

type Credential

type Credential struct {
	// contains filtered or unexported fields
}

Credential is the zero-copy typed accessor.

func WrapCredential

func WrapCredential(b []byte) (Credential, error)

WrapCredential parses a Credential wire envelope.

func (Credential) IsZero

func (c Credential) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (Credential) PubKeyBytes

func (c Credential) PubKeyBytes() []byte

PubKeyBytes returns the concatenated pubkey blob, for fxs that ship pubkeys on the wire (Ed25519, secp256r1, Schnorr). Classical (secp256k1) and PQ (ML-DSA, SLH-DSA) leave this empty.

func (Credential) SecurityLevel

func (c Credential) SecurityLevel() uint8

SecurityLevel returns the fx-specific security level byte. 0 for classical fxs; (0,1,2) for ML-DSA (-44/-65/-87) and SLH-DSA variants.

func (Credential) SignatureAt

func (c Credential) SignatureAt(i, sigSize int) []byte

SignatureAt returns the i'th signature, given the per-fx signature size. Returns nil when i is out of range or sigSize doesn't divide cleanly.

func (Credential) SignatureBytes

func (c Credential) SignatureBytes() []byte

SignatureBytes returns the concatenated signature blob as a single fresh []byte. Divide len()/sigSize to get the signature count.

READ-ONLY: aliases the underlying buffer when used via the List accessor. The returned slice is a copy.

func (Credential) SignatureCount

func (c Credential) SignatureCount(sigSize int) int

SignatureCount returns the number of signatures, given the per-fx signature size. Returns 0 if sigSize is 0 or the total bytes don't divide cleanly.

func (Credential) TypeKind

func (c Credential) TypeKind() TypeKind

TypeKind returns the fx family of this credential.

type CredentialInput

type CredentialInput struct {
	TypeKind      TypeKind
	SecurityLevel uint8
	// Signatures is the concatenated signature blob: e.g. 2 secp256k1
	// signatures = 2*65 = 130 bytes.
	Signatures []byte
	// PubKeys is the concatenated pubkey blob (empty for classical fxs
	// and ML-DSA/SLH-DSA).
	PubKeys []byte
}

CredentialInput is the constructor input. Signatures and PubKeys MUST already be concatenated by the caller — the constructor does not split or pad. For classical fxs, PubKeys should be nil.

type LockedOutput added in v0.3.6

type LockedOutput struct {
	// contains filtered or unexported fields
}

LockedOutput is the zero-copy typed accessor.

func WrapLockedOutput added in v0.3.6

func WrapLockedOutput(b []byte) (LockedOutput, error)

WrapLockedOutput parses a LockedOutput wire envelope.

func (LockedOutput) IsZero added in v0.3.6

func (l LockedOutput) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (LockedOutput) Locktime added in v0.3.6

func (l LockedOutput) Locktime() uint64

Locktime returns the unix timestamp before which the inner output cannot be spent.

func (LockedOutput) TransferOutBytes added in v0.3.6

func (l LockedOutput) TransferOutBytes() []byte

TransferOutBytes returns the inner TransferableOut wire envelope. Pass to the appropriate fx's WrapTransferOutput for typed access.

READ-ONLY: aliases the underlying buffer.

type LockedOutputInput added in v0.3.6

type LockedOutputInput struct {
	Locktime         uint64
	TransferOutBytes []byte // wire envelope from any fx's NewTransferOutput
}

LockedOutputInput is the constructor input.

type MintOperation

type MintOperation struct {
	// contains filtered or unexported fields
}

MintOperation is the zero-copy typed accessor.

func WrapMintOperation

func WrapMintOperation(b []byte) (MintOperation, error)

WrapMintOperation parses a MintOperation wire envelope.

func (MintOperation) IsZero

func (m MintOperation) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (MintOperation) MintOutputBytes

func (m MintOperation) MintOutputBytes() []byte

MintOutputBytes returns the inner MintOutput wire envelope. Pass to WrapMintOutput for typed access.

READ-ONLY: aliases the underlying buffer.

func (MintOperation) SigIndices

func (m MintOperation) SigIndices() []uint32

SigIndices returns the mint-authority signature indices.

func (MintOperation) TransferOutputBytes

func (m MintOperation) TransferOutputBytes() []byte

TransferOutputBytes returns the inner TransferOutput wire envelope. Pass to WrapTransferOutput for typed access.

READ-ONLY: aliases the underlying buffer.

func (MintOperation) TypeKind

func (m MintOperation) TypeKind() TypeKind

TypeKind returns the fx family that owns this operation.

type MintOperationInput

type MintOperationInput struct {
	TypeKind       TypeKind
	SigIndices     []uint32
	MintOutput     []byte // wire envelope from NewMintOutput
	TransferOutput []byte // wire envelope from NewTransferOutput
}

MintOperationInput is the constructor input.

type MintOutput

type MintOutput struct {
	// contains filtered or unexported fields
}

MintOutput is the zero-copy typed accessor.

func WrapMintOutput

func WrapMintOutput(b []byte) (MintOutput, error)

WrapMintOutput parses a MintOutput wire envelope.

func (MintOutput) AddressList

func (m MintOutput) AddressList() AddressList

AddressList returns the mint authority address list.

func (MintOutput) IsZero

func (m MintOutput) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (MintOutput) Locktime

func (m MintOutput) Locktime() uint64

Locktime returns the unix timestamp before which mint cannot fire.

func (MintOutput) SyntacticVerify

func (m MintOutput) SyntacticVerify() error

SyntacticVerify enforces the same gates as OutputOwners.

func (MintOutput) Threshold

func (m MintOutput) Threshold() uint32

Threshold returns the signatures-required count for mint authority.

func (MintOutput) TypeKind

func (m MintOutput) TypeKind() TypeKind

TypeKind returns the fx family that owns this mint authority.

type MintOutputInput

type MintOutputInput struct {
	TypeKind  TypeKind
	Locktime  uint64
	Threshold uint32
	Addresses []ids.ShortID
}

MintOutputInput is the constructor input.

type NFTMintOperation added in v0.5.1

type NFTMintOperation struct {
	// contains filtered or unexported fields
}

NFTMintOperation is the zero-copy typed accessor.

func WrapNFTMintOperation added in v0.5.1

func WrapNFTMintOperation(b []byte) (NFTMintOperation, error)

WrapNFTMintOperation parses an NFTMintOperation wire envelope.

func (NFTMintOperation) GroupID added in v0.5.1

func (m NFTMintOperation) GroupID() uint32

func (NFTMintOperation) IsZero added in v0.5.1

func (m NFTMintOperation) IsZero() bool

func (NFTMintOperation) OwnersBytes added in v0.5.1

func (m NFTMintOperation) OwnersBytes() []byte

OwnersBytes returns the concatenated OutputOwners envelopes blob.

READ-ONLY: aliases the underlying buffer.

func (NFTMintOperation) OwnersCount added in v0.5.1

func (m NFTMintOperation) OwnersCount() uint32

OwnersCount returns the number of minted-to owner groups.

func (NFTMintOperation) Payload added in v0.5.1

func (m NFTMintOperation) Payload() []byte

Payload returns the NFT payload bytes.

READ-ONLY: aliases the underlying buffer.

func (NFTMintOperation) SigIndices added in v0.5.1

func (m NFTMintOperation) SigIndices() []uint32

SigIndices returns the mint-authority signature indices.

func (NFTMintOperation) TypeKind added in v0.5.1

func (m NFTMintOperation) TypeKind() TypeKind

type NFTMintOperationInput added in v0.5.1

type NFTMintOperationInput struct {
	TypeKind   TypeKind
	SigIndices []uint32
	GroupID    uint32
	Payload    []byte
	Owners     [][]byte // wire envelopes from NewOutputOwners
}

NFTMintOperationInput is the constructor input.

type NFTMintOutput added in v0.5.1

type NFTMintOutput struct {
	// contains filtered or unexported fields
}

NFTMintOutput is the zero-copy typed accessor.

func WrapNFTMintOutput added in v0.5.1

func WrapNFTMintOutput(b []byte) (NFTMintOutput, error)

WrapNFTMintOutput parses an NFTMintOutput wire envelope.

func (NFTMintOutput) AddressList added in v0.5.1

func (m NFTMintOutput) AddressList() AddressList

func (NFTMintOutput) GroupID added in v0.5.1

func (m NFTMintOutput) GroupID() uint32

func (NFTMintOutput) IsZero added in v0.5.1

func (m NFTMintOutput) IsZero() bool

func (NFTMintOutput) Locktime added in v0.5.1

func (m NFTMintOutput) Locktime() uint64

func (NFTMintOutput) Threshold added in v0.5.1

func (m NFTMintOutput) Threshold() uint32

func (NFTMintOutput) TypeKind added in v0.5.1

func (m NFTMintOutput) TypeKind() TypeKind

type NFTMintOutputInput added in v0.5.1

type NFTMintOutputInput struct {
	TypeKind  TypeKind
	GroupID   uint32
	Locktime  uint64
	Threshold uint32
	Addresses []ids.ShortID
}

NFTMintOutputInput is the constructor input.

type NFTTransferOperation added in v0.5.1

type NFTTransferOperation struct {
	// contains filtered or unexported fields
}

NFTTransferOperation is the zero-copy typed accessor.

func WrapNFTTransferOperation added in v0.5.1

func WrapNFTTransferOperation(b []byte) (NFTTransferOperation, error)

WrapNFTTransferOperation parses an NFTTransferOperation wire envelope.

func (NFTTransferOperation) IsZero added in v0.5.1

func (m NFTTransferOperation) IsZero() bool

func (NFTTransferOperation) OutputBytes added in v0.5.1

func (m NFTTransferOperation) OutputBytes() []byte

OutputBytes returns the inner NFTTransferOutput wire envelope.

READ-ONLY: aliases the underlying buffer.

func (NFTTransferOperation) SigIndices added in v0.5.1

func (m NFTTransferOperation) SigIndices() []uint32

SigIndices returns the input signature indices.

func (NFTTransferOperation) TypeKind added in v0.5.1

func (m NFTTransferOperation) TypeKind() TypeKind

type NFTTransferOperationInput added in v0.5.1

type NFTTransferOperationInput struct {
	TypeKind   TypeKind
	SigIndices []uint32
	Output     []byte // wire envelope from NewNFTTransferOutput
}

NFTTransferOperationInput is the constructor input.

type NFTTransferOutput added in v0.5.1

type NFTTransferOutput struct {
	// contains filtered or unexported fields
}

NFTTransferOutput is the zero-copy typed accessor.

func WrapNFTTransferOutput added in v0.5.1

func WrapNFTTransferOutput(b []byte) (NFTTransferOutput, error)

WrapNFTTransferOutput parses an NFTTransferOutput wire envelope.

func (NFTTransferOutput) AddressList added in v0.5.1

func (m NFTTransferOutput) AddressList() AddressList

func (NFTTransferOutput) GroupID added in v0.5.1

func (m NFTTransferOutput) GroupID() uint32

func (NFTTransferOutput) IsZero added in v0.5.1

func (m NFTTransferOutput) IsZero() bool

func (NFTTransferOutput) Locktime added in v0.5.1

func (m NFTTransferOutput) Locktime() uint64

func (NFTTransferOutput) Payload added in v0.5.1

func (m NFTTransferOutput) Payload() []byte

Payload returns the NFT payload bytes.

READ-ONLY: aliases the underlying buffer.

func (NFTTransferOutput) Threshold added in v0.5.1

func (m NFTTransferOutput) Threshold() uint32

func (NFTTransferOutput) TypeKind added in v0.5.1

func (m NFTTransferOutput) TypeKind() TypeKind

type NFTTransferOutputInput added in v0.5.1

type NFTTransferOutputInput struct {
	TypeKind  TypeKind
	GroupID   uint32
	Payload   []byte
	Locktime  uint64
	Threshold uint32
	Addresses []ids.ShortID
}

NFTTransferOutputInput is the constructor input.

type OutputOwners

type OutputOwners struct {
	// contains filtered or unexported fields
}

OutputOwners is the zero-copy typed accessor over a ZAP-encoded OutputOwners wire envelope.

READ-ONLY: each address aliases the underlying ZAP buffer.

func WrapOutputOwners

func WrapOutputOwners(b []byte) (OutputOwners, error)

WrapOutputOwners parses an OutputOwners wire envelope into a typed accessor. The discriminator is (TypeKindReserved, ShapeKindOutputOwners) — owners are not fx-owned, every fx with multi-address ownership shares the same wire schema.

func (OutputOwners) AddressList

func (o OutputOwners) AddressList() AddressList

AddressList returns the variable-stride address list view.

func (OutputOwners) IsZero

func (o OutputOwners) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (OutputOwners) Locktime

func (o OutputOwners) Locktime() uint64

Locktime returns the unix timestamp before which the output cannot be spent.

func (OutputOwners) SyntacticVerify

func (o OutputOwners) SyntacticVerify() error

SyntacticVerify enforces every executor-side semantic gate on an OutputOwners read from an untrusted wire buffer:

  • Addresses non-empty
  • Threshold > 0
  • Threshold <= len(Addresses)
  • Every Address is non-zero

Returns one of the typed sentinel errors above, or nil when valid. Every consumer that treats Threshold/Addresses as a quorum gate MUST call SyntacticVerify before trusting the values.

func (OutputOwners) Threshold

func (o OutputOwners) Threshold() uint32

Threshold returns the number of signatures required to spend.

type OutputOwnersInput

type OutputOwnersInput struct {
	Locktime  uint64
	Threshold uint32
	Addresses []ids.ShortID
}

OutputOwnersInput is the constructor input for NewOutputOwners.

type OwnedOutput added in v0.5.1

type OwnedOutput struct {
	// contains filtered or unexported fields
}

OwnedOutput is the zero-copy typed accessor.

func WrapOwnedOutput added in v0.5.1

func WrapOwnedOutput(b []byte) (OwnedOutput, error)

WrapOwnedOutput parses an OwnedOutput wire envelope.

func (OwnedOutput) AddressList added in v0.5.1

func (m OwnedOutput) AddressList() AddressList

func (OwnedOutput) IsZero added in v0.5.1

func (m OwnedOutput) IsZero() bool

func (OwnedOutput) Locktime added in v0.5.1

func (m OwnedOutput) Locktime() uint64

func (OwnedOutput) Threshold added in v0.5.1

func (m OwnedOutput) Threshold() uint32

func (OwnedOutput) TypeKind added in v0.5.1

func (m OwnedOutput) TypeKind() TypeKind

type OwnedOutputInput added in v0.5.1

type OwnedOutputInput struct {
	TypeKind  TypeKind
	Locktime  uint64
	Threshold uint32
	Addresses []ids.ShortID
}

OwnedOutputInput is the constructor input.

type PChainOwner

type PChainOwner struct {
	// contains filtered or unexported fields
}

PChainOwner is the zero-copy typed accessor over a ZAP-encoded PChainOwner wire envelope.

func WrapPChainOwner

func WrapPChainOwner(b []byte) (PChainOwner, error)

WrapPChainOwner parses a PChainOwner wire envelope into a typed accessor.

func (PChainOwner) AddressList

func (p PChainOwner) AddressList() AddressList

AddressList returns the variable-stride address list view.

func (PChainOwner) IsZero

func (p PChainOwner) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (PChainOwner) SyntacticVerify

func (p PChainOwner) SyntacticVerify() error

SyntacticVerify enforces the executor-side semantic gates: non-empty addresses, non-zero threshold, threshold <= len(addresses), every address non-zero. Returns one of the OutputOwners error sentinels.

func (PChainOwner) Threshold

func (p PChainOwner) Threshold() uint32

Threshold returns the signatures-required count.

type PChainOwnerInput

type PChainOwnerInput struct {
	Threshold uint32
	Addresses []ids.ShortID
}

PChainOwnerInput is the constructor input for NewPChainOwner.

type PQMintOutput

type PQMintOutput struct {
	// contains filtered or unexported fields
}

PQMintOutput is the zero-copy typed accessor.

func WrapPQMintOutput

func WrapPQMintOutput(b []byte, stride int) (PQMintOutput, error)

WrapPQMintOutput parses a PQMintOutput wire envelope.

func (PQMintOutput) IsZero

func (m PQMintOutput) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (PQMintOutput) Locktime

func (m PQMintOutput) Locktime() uint64

Locktime returns the unix timestamp before which mint cannot fire.

func (PQMintOutput) PubKeyStride

func (m PQMintOutput) PubKeyStride() int

PubKeyStride returns the per-element width of the PubKeys list.

func (PQMintOutput) PubKeys

func (m PQMintOutput) PubKeys() PQPubKeyList

PubKeys returns the variable-stride pubkey list view.

func (PQMintOutput) SecurityLevel

func (m PQMintOutput) SecurityLevel() uint8

SecurityLevel returns the fx-specific security level byte.

func (PQMintOutput) SyntacticVerify

func (m PQMintOutput) SyntacticVerify() error

SyntacticVerify enforces the same gates as PQOutputOwners.

func (PQMintOutput) Threshold

func (m PQMintOutput) Threshold() uint32

Threshold returns the signatures-required count for mint authority.

func (PQMintOutput) TypeKind

func (m PQMintOutput) TypeKind() TypeKind

TypeKind returns the PQ fx family.

type PQMintOutputInput

type PQMintOutputInput struct {
	TypeKind      TypeKind
	SecurityLevel uint8
	Locktime      uint64
	Threshold     uint32
	PubKeyStride  int
	PubKeys       [][]byte
}

PQMintOutputInput is the constructor input.

type PQOutputOwners

type PQOutputOwners struct {
	// contains filtered or unexported fields
}

PQOutputOwners is the zero-copy typed accessor over a ZAP-encoded PQOutputOwners wire envelope.

READ-ONLY: each pubkey aliases the underlying ZAP buffer.

func WrapPQOutputOwners

func WrapPQOutputOwners(b []byte, stride int) (PQOutputOwners, error)

WrapPQOutputOwners parses a PQOutputOwners wire envelope. The stride argument names the fx-specific pubkey size — the wire layer does not infer it from SecurityLevel because the fx-to-stride mapping lives in the fx package (mldsafx.SecurityLevel.PubKeyLen, slhdsafx.SecurityLevel.PubKeyLen).

func (PQOutputOwners) IsZero

func (o PQOutputOwners) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (PQOutputOwners) Locktime

func (o PQOutputOwners) Locktime() uint64

Locktime returns the unix timestamp before which the output cannot be spent.

func (PQOutputOwners) PubKeyStride

func (o PQOutputOwners) PubKeyStride() int

PubKeyStride returns the per-element width of the PubKeys list, as passed to WrapPQOutputOwners. The caller is responsible for resolving SecurityLevel → stride; the wire layer is stride-agnostic.

func (PQOutputOwners) PubKeys

func (o PQOutputOwners) PubKeys() PQPubKeyList

PubKeys returns the variable-stride pubkey list view.

READ-ONLY: each pubkey aliases the underlying ZAP buffer.

func (PQOutputOwners) SecurityLevel

func (o PQOutputOwners) SecurityLevel() uint8

SecurityLevel returns the fx-specific security level byte.

func (PQOutputOwners) SyntacticVerify

func (o PQOutputOwners) SyntacticVerify() error

SyntacticVerify enforces the executor-side semantic gates on a PQ owner set read from an untrusted wire buffer. Stride is taken from the WrapPQOutputOwners call; per-entry stride mismatches are rejected, as are zero-threshold and threshold-exceeds-pubkeys.

func (PQOutputOwners) Threshold

func (o PQOutputOwners) Threshold() uint32

Threshold returns the number of signatures required to spend.

func (PQOutputOwners) TypeKind

func (o PQOutputOwners) TypeKind() TypeKind

TypeKind returns the PQ fx family that owns this owner set.

type PQOutputOwnersInput

type PQOutputOwnersInput struct {
	TypeKind      TypeKind
	SecurityLevel uint8
	Locktime      uint64
	Threshold     uint32
	// PubKeyStride names the per-entry width of the PubKeys list. The
	// caller is responsible for the SecurityLevel → stride mapping.
	PubKeyStride int
	// PubKeys MUST each be exactly PubKeyStride bytes. The constructor
	// does not pad or truncate.
	PubKeys [][]byte
}

PQOutputOwnersInput is the constructor input for NewPQOutputOwners.

type PQPubKeyList

type PQPubKeyList struct {
	// contains filtered or unexported fields
}

PQPubKeyList is the zero-copy view over the pubkey list inside a PQOutputOwners. Stride is fx-specific.

func (PQPubKeyList) All

func (p PQPubKeyList) All() [][]byte

All returns a fresh [][]byte copy of every pubkey in the list.

func (PQPubKeyList) At

func (p PQPubKeyList) At(i int) []byte

At returns the i'th pubkey as a fresh []byte copy of length stride. Returns nil when i is out of range.

func (PQPubKeyList) IsNull

func (p PQPubKeyList) IsNull() bool

IsNull returns true if no list pointer was set.

func (PQPubKeyList) Len

func (p PQPubKeyList) Len() int

Len returns the number of pubkeys.

type PQTransferOutput

type PQTransferOutput struct {
	// contains filtered or unexported fields
}

PQTransferOutput is the zero-copy typed accessor.

func WrapPQTransferOutput

func WrapPQTransferOutput(b []byte, stride int) (PQTransferOutput, error)

WrapPQTransferOutput parses a PQTransferOutput wire envelope.

func (PQTransferOutput) Amount

func (t PQTransferOutput) Amount() uint64

Amount returns the asset amount this output is worth.

func (PQTransferOutput) IsZero

func (t PQTransferOutput) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (PQTransferOutput) Locktime

func (t PQTransferOutput) Locktime() uint64

Locktime returns the unix timestamp before which the output cannot be spent.

func (PQTransferOutput) PubKeyStride

func (t PQTransferOutput) PubKeyStride() int

PubKeyStride returns the per-element width of the PubKeys list.

func (PQTransferOutput) PubKeys

func (t PQTransferOutput) PubKeys() PQPubKeyList

PubKeys returns the variable-stride pubkey list view.

func (PQTransferOutput) SecurityLevel

func (t PQTransferOutput) SecurityLevel() uint8

SecurityLevel returns the fx-specific security level byte.

func (PQTransferOutput) SyntacticVerify

func (t PQTransferOutput) SyntacticVerify() error

SyntacticVerify enforces Amount > 0 plus the PQOutputOwners gates.

func (PQTransferOutput) Threshold

func (t PQTransferOutput) Threshold() uint32

Threshold returns the signatures-required count.

func (PQTransferOutput) TypeKind

func (t PQTransferOutput) TypeKind() TypeKind

TypeKind returns the PQ fx family.

type PQTransferOutputInput

type PQTransferOutputInput struct {
	TypeKind      TypeKind
	SecurityLevel uint8
	Amount        uint64
	Locktime      uint64
	Threshold     uint32
	PubKeyStride  int
	PubKeys       [][]byte
}

PQTransferOutputInput is the constructor input.

type ShapeKind

type ShapeKind uint8

ShapeKind names the primitive shape within a fx family. Dense values, 0x00 reserved.

const (
	ShapeKindReserved        ShapeKind = 0x00
	ShapeKindTransferOutput  ShapeKind = 0x01
	ShapeKindTransferInput   ShapeKind = 0x02
	ShapeKindMintOutput      ShapeKind = 0x03
	ShapeKindMintInput       ShapeKind = 0x04
	ShapeKindMintOperation   ShapeKind = 0x05
	ShapeKindCredential      ShapeKind = 0x06
	ShapeKindAttestationOut  ShapeKind = 0x07
	ShapeKindAttestationIn   ShapeKind = 0x08
	ShapeKindOutputOwners    ShapeKind = 0x09
	ShapeKindUTXO            ShapeKind = 0x0A
	ShapeKindTransferableOut ShapeKind = 0x0B
	ShapeKindTransferableIn  ShapeKind = 0x0C
	ShapeKindPChainOwner     ShapeKind = 0x0D
	ShapeKindSignedTx        ShapeKind = 0x0E
	ShapeKindLockedOutput    ShapeKind = 0x0F
	// NFT fx shapes (GroupID/Payload composites over OutputOwners).
	ShapeKindNFTMintOutput     ShapeKind = 0x10
	ShapeKindNFTTransferOutput ShapeKind = 0x11
	ShapeKindXVMBaseTx         ShapeKind = 0x12
	ShapeKindNFTMintOperation  ShapeKind = 0x13
	ShapeKindNFTTransferOp     ShapeKind = 0x14
	// Property fx shapes.
	ShapeKindOwnedOutput   ShapeKind = 0x15
	ShapeKindBurnOperation ShapeKind = 0x16
)
const ShapeKindPQMintOutput ShapeKind = 0x11

ShapeKindPQMintOutput is the discriminator for PQ-fx MintOutput.

const ShapeKindPQOutputOwners ShapeKind = 0x0F

ShapeKindPQOutputOwners is the discriminator for PQ-fx OutputOwners.

const ShapeKindPQTransferOutput ShapeKind = 0x10

ShapeKindPQTransferOutput is the discriminator for PQ-fx TransferOutput.

type SignedTx

type SignedTx struct {
	// contains filtered or unexported fields
}

SignedTx is the zero-copy typed accessor.

func WrapSignedTx

func WrapSignedTx(b []byte) (SignedTx, error)

WrapSignedTx parses a SignedTx wire envelope.

func (SignedTx) AllCredentials

func (s SignedTx) AllCredentials() ([]Credential, error)

AllCredentials parses every credential into a fresh slice. Use this when the caller needs to iterate all credentials (the executor's VerifyTransfer pass).

func (SignedTx) CredentialAt

func (s SignedTx) CredentialAt(i uint32) (Credential, error)

CredentialAt parses the i'th credential envelope from the concatenated blob and returns its typed accessor. Returns the zero Credential (IsZero=true) if i is out of range or the blob is malformed.

Walking is O(i) because each ZAP credential carries its own length in the wire header. For a hot-loop verifier, prefetch all credentials once into a []Credential slice.

func (SignedTx) CredentialBytes

func (s SignedTx) CredentialBytes() []byte

CredentialBytes returns the concatenated credential envelopes blob. Each credential is a self-describing wire envelope (2-byte prefix + length-prefixed ZAP message); see CredentialAt for the index walk.

func (SignedTx) CredentialCount

func (s SignedTx) CredentialCount() uint32

CredentialCount returns the number of credentials.

func (SignedTx) IsZero

func (s SignedTx) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (SignedTx) UnsignedBytes

func (s SignedTx) UnsignedBytes() []byte

UnsignedBytes returns the unsigned tx bytes. This is the canonical signing target — every fxs signature was computed over a hash of these bytes.

READ-ONLY: aliases the underlying buffer. Use append([]byte(nil), ...) to take ownership.

type SignedTxInput

type SignedTxInput struct {
	UnsignedBytes []byte
	// Credentials is the slice of credential wire envelopes (each one
	// already prefixed with its own TypeKind+ShapeKind+ZAP message).
	// The constructor concatenates them — order is preserved and aligns
	// 1:1 with the unsigned tx's input list.
	Credentials [][]byte
}

SignedTxInput is the constructor input.

type TransferInput

type TransferInput struct {
	// contains filtered or unexported fields
}

TransferInput is the zero-copy typed accessor.

func WrapTransferInput

func WrapTransferInput(b []byte) (TransferInput, error)

WrapTransferInput parses a TransferInput wire envelope.

func (TransferInput) Amount

func (t TransferInput) Amount() uint64

Amount returns the amount being spent.

func (TransferInput) IsZero

func (t TransferInput) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (TransferInput) SigIndices

func (t TransferInput) SigIndices() []uint32

SigIndices returns the SigIndices view as a fresh []uint32.

func (TransferInput) SigIndicesLen

func (t TransferInput) SigIndicesLen() int

SigIndicesLen returns the number of signature indices.

func (TransferInput) TypeKind

func (t TransferInput) TypeKind() TypeKind

TypeKind returns the fx family that owns this input.

type TransferInputInput

type TransferInputInput struct {
	TypeKind   TypeKind
	Amount     uint64
	SigIndices []uint32
}

TransferInputInput is the constructor input.

type TransferOutput

type TransferOutput struct {
	// contains filtered or unexported fields
}

TransferOutput is the zero-copy typed accessor over a ZAP-encoded TransferOutput wire envelope.

func WrapTransferOutput

func WrapTransferOutput(b []byte) (TransferOutput, error)

WrapTransferOutput parses a TransferOutput wire envelope into a typed accessor. Accepts any TypeKind (classical or PQ); ShapeKind must be ShapeKindTransferOutput.

func (TransferOutput) AddressList

func (t TransferOutput) AddressList() AddressList

AddressList returns the address list view.

func (TransferOutput) Amount

func (t TransferOutput) Amount() uint64

Amount returns the asset amount this output is worth.

func (TransferOutput) IsZero

func (t TransferOutput) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (TransferOutput) Locktime

func (t TransferOutput) Locktime() uint64

Locktime returns the unix timestamp before which the output cannot be spent.

func (TransferOutput) SyntacticVerify

func (t TransferOutput) SyntacticVerify() error

SyntacticVerify enforces the same gates as OutputOwners.SyntacticVerify plus Amount > 0.

func (TransferOutput) Threshold

func (t TransferOutput) Threshold() uint32

Threshold returns the signatures-required count.

func (TransferOutput) TypeKind

func (t TransferOutput) TypeKind() TypeKind

TypeKind returns the fx family that owns this output.

type TransferOutputInput

type TransferOutputInput struct {
	TypeKind  TypeKind
	Amount    uint64
	Locktime  uint64
	Threshold uint32
	Addresses []ids.ShortID
}

TransferOutputInput is the constructor input.

type TransferableIn added in v0.5.1

type TransferableIn struct {
	// contains filtered or unexported fields
}

TransferableIn is a zero-copy typed accessor over a TransferableIn object nested in a parent (XVMBaseTx) ZAP message.

func TransferableInFromObject added in v0.5.6

func TransferableInFromObject(msg *zap.Message, obj zap.Object) TransferableIn

TransferableInFromObject wraps a nested TransferableIn object reached from a parent AddObjectPtr list slot (e.g. ImportTx's ImportedIns list).

func (TransferableIn) AssetID added in v0.5.1

func (t TransferableIn) AssetID() ids.ID

AssetID returns the asset identifier the spent UTXO holds.

func (TransferableIn) InputBytes added in v0.5.1

func (t TransferableIn) InputBytes() []byte

InputBytes returns the inner fx Input wire envelope (2-byte discriminator prefix + ZAP message). Dispatch on InputDiscriminator, then WrapTransferInput.

READ-ONLY: aliases the parent buffer.

func (TransferableIn) InputDiscriminator added in v0.5.1

func (t TransferableIn) InputDiscriminator() (TypeKind, ShapeKind)

InputDiscriminator returns the (TypeKind, ShapeKind) at the head of InputBytes(). Returns (0, 0) when shorter than the 2-byte prefix.

func (TransferableIn) IsZero added in v0.5.1

func (t TransferableIn) IsZero() bool

IsZero reports whether the accessor wraps a parsed object.

func (TransferableIn) OutputIndex added in v0.5.1

func (t TransferableIn) OutputIndex() uint32

OutputIndex returns the spent UTXO's output index.

func (TransferableIn) TxID added in v0.5.1

func (t TransferableIn) TxID() ids.ID

TxID returns the spent UTXO's tx id.

type TransferableOut added in v0.5.1

type TransferableOut struct {
	// contains filtered or unexported fields
}

TransferableOut is a zero-copy typed accessor over a TransferableOut object nested in a parent (XVMBaseTx) ZAP message.

READ-ONLY: every field aliases the parent buffer. Use append([]byte(nil), ...) to take ownership of OutputBytes when handing off to another goroutine.

func TransferableOutFromObject added in v0.5.6

func TransferableOutFromObject(msg *zap.Message, obj zap.Object) TransferableOut

TransferableOutFromObject wraps a nested TransferableOut object reached from a parent AddObjectPtr list slot (e.g. ExportTx's ExportedOuts list). msg is the parent message (obj.Message()); obj is the list element from List.ObjectPtr. This is the exported reader every native-nested carrier of TransferableOut objects uses — one way to read a nested transferable.

func (TransferableOut) AssetID added in v0.5.1

func (t TransferableOut) AssetID() ids.ID

AssetID returns the asset identifier this output moves.

func (TransferableOut) IsZero added in v0.5.1

func (t TransferableOut) IsZero() bool

IsZero reports whether the accessor wraps a parsed object.

func (TransferableOut) OutputBytes added in v0.5.1

func (t TransferableOut) OutputBytes() []byte

OutputBytes returns the inner fx Output wire envelope (2-byte discriminator prefix + ZAP message). Dispatch on OutputDiscriminator, then the fx Wrap*.

READ-ONLY: aliases the parent buffer.

func (TransferableOut) OutputDiscriminator added in v0.5.1

func (t TransferableOut) OutputDiscriminator() (TypeKind, ShapeKind)

OutputDiscriminator returns the (TypeKind, ShapeKind) at the head of OutputBytes(). Returns (0, 0) when shorter than the 2-byte prefix.

type TypeKind

type TypeKind uint8

TypeKind names the fx family that owns the primitive. Dense values, 0x00 reserved (rejected by every Wrap*).

const (
	TypeKindReserved  TypeKind = 0x00
	TypeKindSecp256k1 TypeKind = 0x01
	TypeKindMLDSA     TypeKind = 0x02
	TypeKindSLHDSA    TypeKind = 0x03
	TypeKindEd25519   TypeKind = 0x04
	TypeKindSecp256r1 TypeKind = 0x05
	TypeKindSchnorr   TypeKind = 0x06
	TypeKindBLS12381  TypeKind = 0x07
	// Application fx families (built on secp256k1 credentials).
	TypeKindNFT      TypeKind = 0x08
	TypeKindProperty TypeKind = 0x09
)

type UTXO

type UTXO struct {
	// contains filtered or unexported fields
}

UTXO is the zero-copy typed accessor over a ZAP-encoded UTXO wire envelope.

READ-ONLY: every field aliases the underlying ZAP buffer. Mutation corrupts any UTXOID = hash(buffer) computed downstream and breaks cross-VM atomic UTXO transfer semantics. Use append([]byte(nil), ...) to take ownership of the Output bytes when handing off to a different goroutine.

func WrapUTXO

func WrapUTXO(b []byte) (UTXO, error)

WrapUTXO parses a UTXO wire envelope into a typed accessor.

Returns ErrShortEnvelope when the buffer is shorter than the 2-byte discriminator prefix; ErrWrongShapeKind when the prefix names a non-UTXO shape.

func (UTXO) AssetID

func (u UTXO) AssetID() ids.ID

AssetID returns the asset identifier.

func (UTXO) Bytes

func (u UTXO) Bytes() []byte

Bytes returns the full wire envelope (2-byte discriminator prefix + ZAP message) for the UTXO. Stable across calls — backed by the originally-parsed buffer.

func (UTXO) IsZero

func (u UTXO) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (UTXO) OutputBytes

func (u UTXO) OutputBytes() []byte

OutputBytes returns the inner fxs primitive's wire envelope (2-byte discriminator prefix + ZAP message). Use WrapTransferableOutput, WrapMintOutput, etc. to parse the bytes into a typed accessor after dispatching on the (TypeKind, ShapeKind) pair.

READ-ONLY: aliases the underlying ZAP buffer.

func (UTXO) OutputDiscriminator

func (u UTXO) OutputDiscriminator() (TypeKind, ShapeKind)

OutputDiscriminator returns the (TypeKind, ShapeKind) pair embedded at the head of OutputBytes(). Returns (0, 0) when OutputBytes is shorter than the 2-byte prefix.

func (UTXO) OutputIndex

func (u UTXO) OutputIndex() uint32

OutputIndex returns the spent UTXO's output index.

func (UTXO) TxID

func (u UTXO) TxID() ids.ID

TxID returns the spent UTXO's tx id.

type UTXOInput

type UTXOInput struct {
	TxID        ids.ID
	OutputIndex uint32
	AssetID     ids.ID
	// Output is the inner fxs primitive's wire envelope (already
	// prefixed with its own discriminator). The constructor stores
	// these bytes verbatim in the Output field.
	Output []byte
}

UTXOInput is the constructor input for NewUTXO.

type XVMBaseTx added in v0.3.8

type XVMBaseTx struct {
	// contains filtered or unexported fields
}

XVMBaseTx is the zero-copy typed accessor.

READ-ONLY: every accessor aliases the underlying ZAP buffer. Mutation corrupts any TxID = hash(buffer) computed downstream.

func WrapXVMBaseTx added in v0.3.8

func WrapXVMBaseTx(b []byte) (XVMBaseTx, error)

WrapXVMBaseTx parses an XVM BaseTx wire envelope into a typed accessor.

func (XVMBaseTx) BlockchainID added in v0.3.8

func (t XVMBaseTx) BlockchainID() [32]byte

BlockchainID returns the 32-byte chain id.

func (XVMBaseTx) Bytes added in v0.3.8

func (t XVMBaseTx) Bytes() []byte

Bytes returns the full wire envelope (2-byte discriminator prefix + ZAP message). Stable across calls — backed by the originally-parsed buffer.

func (XVMBaseTx) InAt added in v0.3.8

func (t XVMBaseTx) InAt(i uint32) (TransferableIn, error)

InAt returns the i'th TransferableIn (UTXOID + AssetID + inner fx Input).

func (XVMBaseTx) InsCount added in v0.3.8

func (t XVMBaseTx) InsCount() uint32

InsCount returns the number of transferable inputs.

func (XVMBaseTx) IsZero added in v0.3.8

func (t XVMBaseTx) IsZero() bool

IsZero reports whether the accessor wraps a parsed message.

func (XVMBaseTx) Memo added in v0.3.8

func (t XVMBaseTx) Memo() []byte

Memo returns the memo bytes.

READ-ONLY: aliases the underlying buffer.

func (XVMBaseTx) NetworkID added in v0.3.8

func (t XVMBaseTx) NetworkID() uint32

NetworkID returns the network id.

func (XVMBaseTx) OutAt added in v0.3.8

func (t XVMBaseTx) OutAt(i uint32) (TransferableOut, error)

OutAt returns the i'th TransferableOut (AssetID + inner fx Output). X-Chain is multi-asset, so every output names the asset it moves.

func (XVMBaseTx) OutsCount added in v0.3.8

func (t XVMBaseTx) OutsCount() uint32

OutsCount returns the number of transferable outputs.

type XVMBaseTxInput added in v0.3.8

type XVMBaseTxInput struct {
	NetworkID    uint32
	BlockchainID [32]byte
	Outs         []XVMTransferOut
	Ins          []XVMTransferIn
	Memo         []byte
}

XVMBaseTxInput is the constructor input.

type XVMTransferIn added in v0.5.5

type XVMTransferIn struct {
	TxID        ids.ID
	OutputIndex uint32
	AssetID     ids.ID
	Input       []byte
}

XVMTransferIn is one input: a spent-UTXO reference plus the already-built inner fx Input envelope (from NewTransferInput).

type XVMTransferOut added in v0.5.5

type XVMTransferOut struct {
	AssetID ids.ID
	Output  []byte
}

XVMTransferOut is one output: an AssetID plus the already-built inner fx Output envelope (from NewTransferOutput / NewMintOutput / NewNFT*).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL