Help us shape the future of Go! Take the 2026 Go Developer Survey

artifacts

package
v1.28.3 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: BSD-3-Clause Imports: 4 Imported by: 3

Documentation

Overview

Package artifacts defines canonical artifact types for cross-chain settlement per the v1.1 Unified Quantum-Safe PoS Ecosystem specification.

Each chain emits exactly one artifact type that X-Chain accepts:

  • C → CReceipt
  • D → DSettlementReceipt
  • O → OracleAttestation
  • R → VerifiedMessage
  • I → CredentialProof
  • T → Cert (OracleCert, RelayCert, DACert)
  • Z → ZKProofCommitment

Index

Constants

This section is empty.

Variables

View Source
var (
	DomainSepCReceipt           = []byte("LUX:CReceipt:v1")
	DomainSepDSettlementReceipt = []byte("LUX:DSettlementReceipt:v1")
	DomainSepOracleAttestation  = []byte("LUX:OracleAttestation:v1")
	DomainSepVerifiedMessage    = []byte("LUX:VerifiedMessage:v1")
	DomainSepCredentialProof    = []byte("LUX:CredentialProof:v1")
	DomainSepOracleCert         = []byte("LUX:OracleCert:v1")
	DomainSepRelayCert          = []byte("LUX:RelayCert:v1")
	DomainSepDACert             = []byte("LUX:DACert:v1")
	DomainSepZKProof            = []byte("LUX:ZKProofCommitment:v1")
)

Functions

This section is empty.

Types

type Artifact

type Artifact interface {
	// ArtifactID returns the unique identifier for this artifact
	ArtifactID() ids.ID
	// DomainID returns the source domain/chain identifier
	DomainID() ids.ID
	// SchemaVersion returns the artifact schema version
	SchemaVersion() uint32
	// SignatureSuite returns the cryptographic suite used
	SignatureSuite() SignatureSuite
	// Expiry returns when this artifact expires
	Expiry() time.Time
	// Bytes returns the serialized artifact
	Bytes() []byte
}

Artifact is the base interface for all cross-chain artifacts

type CReceipt

type CReceipt struct {
	// Header
	Version_   uint32         `json:"version"`
	SigSuite_  SignatureSuite `json:"sigSuite"`
	DomainID_  ids.ID         `json:"domainId"`
	Height     uint64         `json:"height"`
	Timestamp_ time.Time      `json:"timestamp"`
	ExpiryTime time.Time      `json:"expiry"`

	// State commitments
	CStateRoot   [32]byte `json:"cStateRoot"`
	DARoot       [32]byte `json:"daRoot"`
	WitnessRoot  [32]byte `json:"witnessRoot"`
	MessagesRoot [32]byte `json:"messagesOutRoot"`

	// Settlement data
	Withdrawals []Withdrawal `json:"withdrawals"`
	Fees        []FeePayment `json:"fees"`

	// Proofs
	FinalityProof  []byte `json:"finalityProof"`
	InclusionProof []byte `json:"inclusionProof"`
	// contains filtered or unexported fields
}

CReceipt is the canonical artifact emitted by C-Chain for X-Chain settlement

func (*CReceipt) ArtifactID

func (r *CReceipt) ArtifactID() ids.ID

func (*CReceipt) Bytes

func (r *CReceipt) Bytes() []byte

func (*CReceipt) DomainID

func (r *CReceipt) DomainID() ids.ID

func (*CReceipt) Expiry

func (r *CReceipt) Expiry() time.Time

func (*CReceipt) SchemaVersion

func (r *CReceipt) SchemaVersion() uint32

func (*CReceipt) SignatureSuite

func (r *CReceipt) SignatureSuite() SignatureSuite

type CredentialProof

type CredentialProof struct {
	// Header
	Version_  uint32         `json:"version"`
	SigSuite_ SignatureSuite `json:"sigSuite"`
	DomainID_ ids.ID         `json:"domainId"`

	// Credential identification
	CredentialID ids.ID `json:"credentialId"`
	IssuerDID    string `json:"issuerDid"`
	SubjectDID   string `json:"subjectDid"`
	CredType     string `json:"credentialType"`

	// Claims (can be plain or selectively disclosed via ZK)
	Claims           map[string][]byte `json:"claims,omitempty"`
	ClaimsCommitment [32]byte          `json:"claimsCommitment,omitempty"`
	SelectiveProof   []byte            `json:"selectiveProof,omitempty"`

	// Trust policy
	IssuerTrustPolicy [32]byte `json:"issuerTrustPolicy"`

	// Freshness
	IssuedAt  time.Time `json:"issuedAt"`
	ExpiresAt time.Time `json:"expiresAt"`

	// Non-revocation proof
	RevocationProof []byte `json:"revocationProof,omitempty"`
	RevocationEpoch uint64 `json:"revocationEpoch"`

	// Subject binding (key ownership proof)
	SubjectBinding []byte `json:"subjectBinding"`
	// contains filtered or unexported fields
}

CredentialProof is the canonical artifact for identity credentials

func (*CredentialProof) ArtifactID

func (c *CredentialProof) ArtifactID() ids.ID

func (*CredentialProof) Bytes

func (c *CredentialProof) Bytes() []byte

func (*CredentialProof) DomainID

func (c *CredentialProof) DomainID() ids.ID

func (*CredentialProof) Expiry

func (c *CredentialProof) Expiry() time.Time

func (*CredentialProof) SchemaVersion

func (c *CredentialProof) SchemaVersion() uint32

func (*CredentialProof) SignatureSuite

func (c *CredentialProof) SignatureSuite() SignatureSuite

type DACert

type DACert struct {
	Version_  uint32         `json:"version"`
	SigSuite_ SignatureSuite `json:"sigSuite"`
	DomainID_ ids.ID         `json:"domainId"`

	ChainID ids.ID   `json:"chainId"`
	Height  uint64   `json:"height"`
	DARoot  [32]byte `json:"daRoot"`

	// Sampling evidence
	SampleCount uint32       `json:"sampleCount"`
	Samplers    []ids.NodeID `json:"samplers"`
	Signatures  [][]byte     `json:"signatures"`
	Threshold   uint32       `json:"threshold"`

	Timestamp time.Time `json:"timestamp"`
	ExpiresAt time.Time `json:"expiresAt"`
	// contains filtered or unexported fields
}

DACert aggregates DA sampling evidence

func (*DACert) ArtifactID

func (c *DACert) ArtifactID() ids.ID

func (*DACert) Bytes

func (c *DACert) Bytes() []byte

func (*DACert) DomainID

func (c *DACert) DomainID() ids.ID

func (*DACert) Expiry

func (c *DACert) Expiry() time.Time

func (*DACert) SchemaVersion

func (c *DACert) SchemaVersion() uint32

func (*DACert) SignatureSuite

func (c *DACert) SignatureSuite() SignatureSuite

type DSettlementReceipt

type DSettlementReceipt struct {
	// Header
	Version_   uint32         `json:"version"`
	SigSuite_  SignatureSuite `json:"sigSuite"`
	DomainID_  ids.ID         `json:"domainId"`
	Height     uint64         `json:"height"`
	Timestamp_ time.Time      `json:"timestamp"`
	ExpiryTime time.Time      `json:"expiry"`

	// Escrow inputs (X-Chain UTXO refs)
	EscrowInputs []EscrowRef `json:"escrowInputs"`

	// Trade settlements
	TradeNettings []TradeNetting `json:"tradeNettings"`

	// Fees
	Fees []FeePayment `json:"fees"`

	// Risk checks
	RiskPolicyHash [32]byte `json:"riskPolicyHash"`

	// Proofs
	FinalityProof  []byte `json:"finalityProof"`
	InclusionProof []byte `json:"inclusionProof"`
	// contains filtered or unexported fields
}

DSettlementReceipt is the canonical artifact for D-Chain escrow settlement

func (*DSettlementReceipt) ArtifactID

func (r *DSettlementReceipt) ArtifactID() ids.ID

func (*DSettlementReceipt) Bytes

func (r *DSettlementReceipt) Bytes() []byte

func (*DSettlementReceipt) DomainID

func (r *DSettlementReceipt) DomainID() ids.ID

func (*DSettlementReceipt) Expiry

func (r *DSettlementReceipt) Expiry() time.Time

func (*DSettlementReceipt) SchemaVersion

func (r *DSettlementReceipt) SchemaVersion() uint32

func (*DSettlementReceipt) SignatureSuite

func (r *DSettlementReceipt) SignatureSuite() SignatureSuite

type EscrowRef

type EscrowRef struct {
	TxID        ids.ID `json:"txId"`
	OutputIndex uint32 `json:"outputIndex"`
	Amount      uint64 `json:"amount"`
	AssetID     ids.ID `json:"assetId"`
}

EscrowRef references an escrow UTXO on X-Chain

type FeePayment

type FeePayment struct {
	Recipient []byte `json:"recipient"`
	Amount    uint64 `json:"amount"`
	FeeType   string `json:"feeType"` // "base", "priority", "blob"
}

FeePayment represents a fee payment to be settled on X

type MessageStatus

type MessageStatus uint8

MessageStatus represents the delivery status

const (
	MessagePending MessageStatus = iota
	MessageDelivered
	MessageAcked
	MessageTimeout
	MessageFailed
)

type OracleAttestation

type OracleAttestation struct {
	// Header
	Version_  uint32         `json:"version"`
	SigSuite_ SignatureSuite `json:"sigSuite"`
	DomainID_ ids.ID         `json:"domainId"`

	// Feed identification
	FeedID ids.ID `json:"feedId"`
	Epoch  uint64 `json:"epoch"`

	// Value (can be plain or committed)
	Value           []byte   `json:"value,omitempty"`
	ValueCommitment [32]byte `json:"valueCommitment,omitempty"`

	// Aggregation proof (optional ZK proof of correct aggregation)
	AggProof []byte `json:"aggProof,omitempty"`

	// Quorum certificate (optional, for attested mode)
	QuorumCert []byte `json:"quorumCert,omitempty"`

	// Validity window
	ValidFrom time.Time `json:"validFrom"`
	ValidTo   time.Time `json:"validTo"`

	// Policy
	PolicyHash [32]byte `json:"policyHash"`
	// contains filtered or unexported fields
}

OracleAttestation is the canonical artifact for oracle data feeds

func (*OracleAttestation) ArtifactID

func (a *OracleAttestation) ArtifactID() ids.ID

func (*OracleAttestation) Bytes

func (a *OracleAttestation) Bytes() []byte

func (*OracleAttestation) DomainID

func (a *OracleAttestation) DomainID() ids.ID

func (*OracleAttestation) Expiry

func (a *OracleAttestation) Expiry() time.Time

func (*OracleAttestation) SchemaVersion

func (a *OracleAttestation) SchemaVersion() uint32

func (*OracleAttestation) SignatureSuite

func (a *OracleAttestation) SignatureSuite() SignatureSuite

type OracleCert

type OracleCert struct {
	Version_  uint32         `json:"version"`
	SigSuite_ SignatureSuite `json:"sigSuite"`
	DomainID_ ids.ID         `json:"domainId"`

	FeedID          ids.ID   `json:"feedId"`
	Epoch           uint64   `json:"epoch"`
	AttestationHash [32]byte `json:"attestationHash"`

	// Quorum signatures
	Signers    []ids.NodeID `json:"signers"`
	Signatures [][]byte     `json:"signatures"`
	Threshold  uint32       `json:"threshold"`

	Timestamp time.Time `json:"timestamp"`
	ExpiresAt time.Time `json:"expiresAt"`
	// contains filtered or unexported fields
}

OracleCert attests that a quorum signed an oracle attestation

func (*OracleCert) ArtifactID

func (c *OracleCert) ArtifactID() ids.ID

func (*OracleCert) Bytes

func (c *OracleCert) Bytes() []byte

func (*OracleCert) DomainID

func (c *OracleCert) DomainID() ids.ID

func (*OracleCert) Expiry

func (c *OracleCert) Expiry() time.Time

func (*OracleCert) SchemaVersion

func (c *OracleCert) SchemaVersion() uint32

func (*OracleCert) SignatureSuite

func (c *OracleCert) SignatureSuite() SignatureSuite

type RelayCert

type RelayCert struct {
	Version_  uint32         `json:"version"`
	SigSuite_ SignatureSuite `json:"sigSuite"`
	DomainID_ ids.ID         `json:"domainId"`

	SrcDomain    ids.ID   `json:"srcDomain"`
	MsgBatchHash [32]byte `json:"msgBatchHash"`

	// Quorum signatures
	Signers    []ids.NodeID `json:"signers"`
	Signatures [][]byte     `json:"signatures"`
	Threshold  uint32       `json:"threshold"`

	// Risk bounds (for attested mode)
	ValueCap      uint64 `json:"valueCap"`
	MinDelay      uint64 `json:"minDelay"`
	EmergencyHalt bool   `json:"emergencyHalt"`

	Timestamp time.Time `json:"timestamp"`
	ExpiresAt time.Time `json:"expiresAt"`
	// contains filtered or unexported fields
}

RelayCert attests that a quorum verified a message batch

func (*RelayCert) ArtifactID

func (c *RelayCert) ArtifactID() ids.ID

func (*RelayCert) Bytes

func (c *RelayCert) Bytes() []byte

func (*RelayCert) DomainID

func (c *RelayCert) DomainID() ids.ID

func (*RelayCert) Expiry

func (c *RelayCert) Expiry() time.Time

func (*RelayCert) SchemaVersion

func (c *RelayCert) SchemaVersion() uint32

func (*RelayCert) SignatureSuite

func (c *RelayCert) SignatureSuite() SignatureSuite

type SignatureSuite

type SignatureSuite uint8

SignatureSuite defines the cryptographic suite used

const (
	// SuitePQOnly uses post-quantum signatures only
	SuitePQOnly SignatureSuite = iota
	// SuiteHybrid uses hybrid PQ+classical signatures
	SuiteHybrid
	// SuiteClassic uses classical signatures (legacy)
	SuiteClassic
)

type TradeNetting

type TradeNetting struct {
	Maker      []byte `json:"maker"`
	Taker      []byte `json:"taker"`
	MakerDelta int64  `json:"makerDelta"` // Positive = receive, negative = send
	TakerDelta int64  `json:"takerDelta"`
	AssetID    ids.ID `json:"assetId"`
	TradeID    ids.ID `json:"tradeId"`
}

TradeNetting represents netted trade outcomes

type VerificationMode

type VerificationMode uint8

VerificationMode defines how an artifact is verified

const (
	// LCMode uses light-client verified headers + inclusion proofs (preferred)
	LCMode VerificationMode = iota
	// ValidityMode uses ZK validity proofs
	ValidityMode
	// AttestedMode uses threshold certificate (compatibility fallback)
	AttestedMode
)

type VerifiedMessage

type VerifiedMessage struct {
	// Header
	Version_  uint32         `json:"version"`
	SigSuite_ SignatureSuite `json:"sigSuite"`

	// Message envelope
	SrcDomain   ids.ID `json:"srcDomain"`
	DstDomain   ids.ID `json:"dstDomain"`
	Nonce       uint64 `json:"nonce"`
	PayloadType string `json:"payloadType"`
	Payload     []byte `json:"payload"`
	Fee         uint64 `json:"fee"`
	Timeout     uint64 `json:"timeout"` // Block height

	// Verification mode
	Mode VerificationMode `json:"mode"`

	// Proofs (based on mode)
	SrcFinalityProof  []byte `json:"srcFinalityProof,omitempty"`
	SrcInclusionProof []byte `json:"srcInclusionProof,omitempty"`
	ValidityProof     []byte `json:"validityProof,omitempty"`
	RelayCert         []byte `json:"relayCert,omitempty"`

	// Status
	Status    MessageStatus `json:"status"`
	Timestamp time.Time     `json:"timestamp"`
	// contains filtered or unexported fields
}

VerifiedMessage is the canonical artifact for cross-chain messages

func (*VerifiedMessage) ArtifactID

func (m *VerifiedMessage) ArtifactID() ids.ID

func (*VerifiedMessage) Bytes

func (m *VerifiedMessage) Bytes() []byte

func (*VerifiedMessage) DomainID

func (m *VerifiedMessage) DomainID() ids.ID

func (*VerifiedMessage) Expiry

func (m *VerifiedMessage) Expiry() time.Time

func (*VerifiedMessage) SchemaVersion

func (m *VerifiedMessage) SchemaVersion() uint32

func (*VerifiedMessage) SignatureSuite

func (m *VerifiedMessage) SignatureSuite() SignatureSuite

type Withdrawal

type Withdrawal struct {
	AssetID   ids.ID `json:"assetId"`
	Amount    uint64 `json:"amount"`
	Recipient []byte `json:"recipient"` // X-Chain address
	Nonce     uint64 `json:"nonce"`
}

Withdrawal represents an asset withdrawal from C to X

type ZKProofCommitment

type ZKProofCommitment struct {
	Version_  uint32         `json:"version"`
	SigSuite_ SignatureSuite `json:"sigSuite"`
	DomainID_ ids.ID         `json:"domainId"`

	// Proof identification
	ProofID   ids.ID `json:"proofId"`
	ProofType string `json:"proofType"` // groth16, plonk, stark, bulletproof

	// Commitments
	ProofCommitment  [32]byte `json:"proofCommitment"`
	PublicInputsHash [32]byte `json:"publicInputsHash"`
	VerifyingKeyHash [32]byte `json:"verifyingKeyHash"`

	// The actual proof (can be large)
	ProofData    []byte   `json:"proofData"`
	PublicInputs [][]byte `json:"publicInputs"`

	// Verification status
	Verified   bool      `json:"verified"`
	VerifiedAt time.Time `json:"verifiedAt,omitempty"`
	VerifiedBy ids.ID    `json:"verifiedBy,omitempty"`

	Timestamp time.Time `json:"timestamp"`
	ExpiresAt time.Time `json:"expiresAt"`
	// contains filtered or unexported fields
}

ZKProofCommitment is the canonical artifact for ZK proofs

func (*ZKProofCommitment) ArtifactID

func (z *ZKProofCommitment) ArtifactID() ids.ID

func (*ZKProofCommitment) Bytes

func (z *ZKProofCommitment) Bytes() []byte

func (*ZKProofCommitment) DomainID

func (z *ZKProofCommitment) DomainID() ids.ID

func (*ZKProofCommitment) Expiry

func (z *ZKProofCommitment) Expiry() time.Time

func (*ZKProofCommitment) SchemaVersion

func (z *ZKProofCommitment) SchemaVersion() uint32

func (*ZKProofCommitment) SignatureSuite

func (z *ZKProofCommitment) SignatureSuite() SignatureSuite

Jump to

Keyboard shortcuts

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