falconfx

package
v1.22.21 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// FALCON-512 parameters
	Falcon512Degree    = 512
	Falcon512Modulus   = 12289
	Falcon512SaltLen   = 40
	Falcon512PublicLen = 897
	Falcon512SigMaxLen = 690
)

Variables

View Source
var (
	ErrWrongVMType                    = errors.New("wrong vm type")
	ErrWrongTxType                    = errors.New("wrong tx type")
	ErrWrongOpType                    = errors.New("wrong operation type")
	ErrWrongUTXOType                  = errors.New("wrong utxo type")
	ErrWrongInputType                 = errors.New("wrong input type")
	ErrWrongCredentialType            = errors.New("wrong credential type")
	ErrWrongOwnerType                 = errors.New("wrong owner type")
	ErrMismatchedAmounts              = errors.New("utxo amount and input amount are not equal")
	ErrWrongNumberOfUTXOs             = errors.New("wrong number of utxos for the operation")
	ErrTimelocked                     = errors.New("output is time locked")
	ErrTooManySigners                 = errors.New("input has more signers than expected")
	ErrTooFewSigners                  = errors.New("input has less signers than expected")
	ErrInputOutputIndexOutOfBounds    = errors.New("input referenced a nonexistent address in the output")
	ErrInputCredentialSignersMismatch = errors.New("input expected a different number of signers than provided in the credential")
	ErrWrongSig                       = errors.New("wrong signature")
	ErrInvalidFalconSignature         = errors.New("invalid FALCON signature")
	ErrInvalidFalconPublicKey         = errors.New("invalid FALCON public key")
)

Functions

This section is empty.

Types

type FalconCredential

type FalconCredential struct {
	// For single signature
	Salt [40]byte `serialize:"true" json:"salt"`
	Sig  []byte   `serialize:"true" json:"signature"`

	// For multisig (threshold signatures)
	Sigs []FalconSignature `serialize:"true" json:"signatures"`
}

FalconCredential represents a credential that proves ownership using FALCON signatures

func (*FalconCredential) Verify

func (c *FalconCredential) Verify() error

Verify ensures the FalconCredential is well-formed

type FalconFx

type FalconFx struct {
	VerifyCache *VerifyCache
	VM          VM
	// contains filtered or unexported fields
}

FalconFx describes the FALCON-512 post-quantum signature feature extension This provides quantum-resistant signatures for X-Chain UTXOs

func (*FalconFx) Bootstrapped

func (fx *FalconFx) Bootstrapped() error

func (*FalconFx) Bootstrapping

func (*FalconFx) Bootstrapping() error

func (*FalconFx) Initialize

func (fx *FalconFx) Initialize(vmIntf interface{}) error

func (*FalconFx) InitializeVM

func (fx *FalconFx) InitializeVM(vmIntf interface{}) error

func (*FalconFx) VerifyPermission

func (fx *FalconFx) VerifyPermission(txIntf, inIntf, credIntf, ownerIntf interface{}) error

VerifyPermission verifies that a FALCON signature proves ownership

type FalconInput

type FalconInput = FalconTransferInput

Add FalconInput type alias

type FalconMintOperation

type FalconMintOperation struct {
	// MintInput specifies the mint output to consume
	MintInput `serialize:"true"`

	// MintOutput specifies the new mint output to create
	MintOutput FalconMintOutput `serialize:"true" json:"mintOutput"`

	// TransferOutput specifies the newly minted assets
	TransferOutput FalconTransferOutput `serialize:"true" json:"transferOutput"`
}

FalconMintOperation represents an operation to mint new assets

func (*FalconMintOperation) Verify

func (op *FalconMintOperation) Verify() error

Verify ensures the FalconMintOperation is well-formed

type FalconMintOutput

type FalconMintOutput struct {
	// OutputOwners specifies who can mint more of this asset
	FalconOutputOwners `serialize:"true"`
}

FalconMintOutput represents a mintable output protected by FALCON signatures

func (*FalconMintOutput) Verify

func (o *FalconMintOutput) Verify() error

Verify ensures the FalconMintOutput is well-formed

type FalconOutputOwners

type FalconOutputOwners struct {
	Locktime  uint64 `serialize:"true" json:"locktime"`
	Threshold uint32 `serialize:"true" json:"threshold"`

	// Single public key for simple ownership
	FalconPublicKey []byte `serialize:"true" json:"falconPublicKey"`

	// Multiple public keys for threshold multisig
	FalconPublicKeys [][]byte `serialize:"true" json:"falconPublicKeys"`
}

FalconOutputOwners specifies who can spend an output using FALCON signatures

func (*FalconOutputOwners) Addresses

func (o *FalconOutputOwners) Addresses() [][]byte

Addresses returns the addresses that can spend this output For FALCON, we derive addresses from public keys

func (*FalconOutputOwners) Verify

func (o *FalconOutputOwners) Verify() error

Verify ensures the FalconOutputOwners is well-formed

type FalconSignature

type FalconSignature struct {
	Salt [40]byte `serialize:"true" json:"salt"`
	Sig  []byte   `serialize:"true" json:"signature"`
}

FalconSignature represents a single FALCON-512 signature

type FalconTransferInput

type FalconTransferInput struct {
	// Amt is the amount of asset this input consumes
	Amt uint64 `serialize:"true" json:"amount"`

	// Input specifies which UTXOs to consume
	Input `serialize:"true"`
}

FalconTransferInput represents an input that spends a FALCON-protected UTXO

func (*FalconTransferInput) Amount

func (i *FalconTransferInput) Amount() uint64

Amount returns the amount of asset this input consumes

func (*FalconTransferInput) Verify

func (i *FalconTransferInput) Verify() error

Verify ensures the FalconTransferInput is well-formed

type FalconTransferOutput

type FalconTransferOutput struct {
	// Amt is the amount of asset stored in this output
	Amt uint64 `serialize:"true" json:"amount"`

	// OutputOwners specifies who can spend this output
	FalconOutputOwners `serialize:"true"`
}

FalconTransferOutput represents an output that can be spent with FALCON signatures

func (*FalconTransferOutput) Amount

func (o *FalconTransferOutput) Amount() uint64

Amount returns the amount of asset stored in this output

func (*FalconTransferOutput) Verify

func (o *FalconTransferOutput) Verify() error

Verify ensures the FalconTransferOutput is well-formed

type Input

type Input struct {
	// SigIndices specifies which signatures to use from the credential
	SigIndices []uint32 `serialize:"true" json:"signatureIndices"`
}

Input represents a reference to a UTXO

func (*Input) Verify

func (i *Input) Verify() error

Verify ensures the Input is well-formed

type MintInput

type MintInput struct {
	// SigIndices specifies which signatures to use from the credential
	SigIndices []uint32 `serialize:"true" json:"signatureIndices"`
}

MintInput represents a reference to a mint output

func (*MintInput) Verify

func (i *MintInput) Verify() error

Verify ensures the MintInput is well-formed

type UnsignedTx

type UnsignedTx interface {
	verify.Verifiable
	Bytes() []byte
}

UnsignedTx represents an unsigned transaction

type VM

type VM interface {
	CodecRegistry() codec.Registry
	Logger() log.Logger
}

VM defines the required VM interface for FALCON fx

type VerifyCache

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

VerifyCache caches FALCON signature verifications

func NewVerifyCache

func NewVerifyCache(size int) *VerifyCache

Jump to

Keyboard shortcuts

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