xvm

package
v1.36.178 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: BSD-3-Clause Imports: 66 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Network:          network.DefaultConfig,
	ChecksumsEnabled: true,
	Config: config.Config{
		TxFee:            1000,
		CreateAssetTxFee: 10000,
	},
}
View Source
var ErrRejected = errors.New("rejected")

Functions

func AssetIDFromGenesisBytes added in v1.26.40

func AssetIDFromGenesisBytes(genesisBytes []byte) (ids.ID, error)

AssetIDFromGenesisBytes returns the first genesis asset's runtime asset ID — the ID vm.initGenesis assigns to genesis.Txs[0]. This is the X-Chain native fee asset by convention (the same asset the platform-vm reports via platform.getStakingAssetID and the wallet builder context's UTXOAssetID).

Returns an error when genesisBytes is malformed or contains zero assets — both are unrecoverable on a primary-network bootstrap.

func AwaitTxAccepted

func AwaitTxAccepted(
	c *Client,
	ctx context.Context,
	txID ids.ID,
	freq time.Duration,
	options ...rpc.Option,
) error

AwaitTxAccepted waits for a transaction to be accepted

func NewPubSubFilterer added in v1.1.11

func NewPubSubFilterer(tx *txs.Tx) pubsub.Filterer

Types

type AssetDefinition

type AssetDefinition struct {
	// Alias is the name the asset is known by. On the wire it is the key the
	// definition hangs under rather than one of its fields, which is what
	// `json:"-"` says; Assets supplies it.
	Alias        string        `json:"-"`
	Name         string        `json:"name"`
	Symbol       string        `json:"symbol"`
	Denomination avajson.Uint8 `json:"denomination"`
	InitialState InitialState  `json:"initialState"`
	Memo         string        `json:"memo"`
}

func (*AssetDefinition) MarshalZAP added in v1.36.178

func (x *AssetDefinition) MarshalZAP() ([]byte, error)

MarshalZAP writes AssetDefinition from constant offsets.

func (*AssetDefinition) UnmarshalZAP added in v1.36.178

func (x *AssetDefinition) UnmarshalZAP(data []byte) error

UnmarshalZAP reads AssetDefinition out of the buffer that arrived.

type AssetInitialState

type AssetInitialState struct {
	FixedCap    []GenesisHolder
	VariableCap []GenesisOwners
}

AssetInitialState describes the initial state of an asset

type Assets added in v1.36.178

type Assets []AssetDefinition

Assets is the set of assets a genesis defines. The wire spells it as an object keyed by the alias each asset is known by; here it is a list, because a field on the plane is an offset and a map has no fixed layout. The alias lives inside each entry, so nothing is lost, and the entries are ordered by it so the same request always encodes to the same bytes.

func (Assets) MarshalJSON added in v1.36.178

func (a Assets) MarshalJSON() ([]byte, error)

func (*Assets) UnmarshalJSON added in v1.36.178

func (a *Assets) UnmarshalJSON(b []byte) error

type BCLookup added in v1.16.16

type BCLookup interface {
	Lookup(string) (ids.ID, error)
	PrimaryAlias(ids.ID) (string, error)
}

BCLookup provides blockchain alias lookup

type Balance

type Balance struct {
	AssetID string         `json:"asset"`
	Balance avajson.Uint64 `json:"balance"`
}

func (*Balance) MarshalZAP added in v1.36.178

func (x *Balance) MarshalZAP() ([]byte, error)

MarshalZAP writes Balance from constant offsets.

func (*Balance) UnmarshalZAP added in v1.36.178

func (x *Balance) UnmarshalZAP(data []byte) error

UnmarshalZAP reads Balance out of the buffer that arrived.

type BuildGenesisArgs added in v1.1.11

type BuildGenesisArgs struct {
	NetworkID   avajson.Uint32      `json:"networkID"`
	GenesisData Assets              `json:"genesisData"`
	Encoding    formatting.Encoding `json:"encoding"`
}

BuildGenesisArgs are arguments for BuildGenesis

func (*BuildGenesisArgs) MarshalZAP added in v1.36.178

func (x *BuildGenesisArgs) MarshalZAP() ([]byte, error)

MarshalZAP writes BuildGenesisArgs from constant offsets.

func (*BuildGenesisArgs) UnmarshalZAP added in v1.36.178

func (x *BuildGenesisArgs) UnmarshalZAP(data []byte) error

UnmarshalZAP reads BuildGenesisArgs out of the buffer that arrived.

type BuildGenesisReply added in v1.1.11

type BuildGenesisReply struct {
	Bytes    string              `json:"bytes"`
	Encoding formatting.Encoding `json:"encoding"`
}

BuildGenesisReply is the reply from BuildGenesis

func (*BuildGenesisReply) MarshalZAP added in v1.36.178

func (x *BuildGenesisReply) MarshalZAP() ([]byte, error)

MarshalZAP writes BuildGenesisReply from constant offsets.

func (*BuildGenesisReply) UnmarshalZAP added in v1.36.178

func (x *BuildGenesisReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads BuildGenesisReply out of the buffer that arrived.

type Client

type Client struct {
	Requester rpc.EndpointRequester
}

Client for interacting with the Exchange VM (X-Chain)

func NewClient

func NewClient(uri, chain string) *Client

NewClient returns an Exchange VM client for interacting with the X-Chain

func (*Client) GetAllBalances deprecated

func (c *Client) GetAllBalances(
	ctx context.Context,
	addr ids.ShortID,
	includePartial bool,
	options ...rpc.Option,
) ([]Balance, error)

GetAllBalances returns all asset balances for addr.

Deprecated: GetUTXOs should be used instead.

func (*Client) GetAssetDescription

func (c *Client) GetAssetDescription(ctx context.Context, assetID string, options ...rpc.Option) (*GetAssetDescriptionReply, error)

GetAssetDescription returns a description of assetID.

func (*Client) GetAtomicUTXOs

func (c *Client) GetAtomicUTXOs(
	ctx context.Context,
	addrs []ids.ShortID,
	sourceChain string,
	limit uint32,
	startAddress ids.ShortID,
	startUTXOID ids.ID,
	options ...rpc.Option,
) ([][]byte, ids.ShortID, ids.ID, error)

GetAtomicUTXOs returns the byte representation of the atomic UTXOs controlled by addrs from sourceChain.

func (*Client) GetBalance deprecated

func (c *Client) GetBalance(
	ctx context.Context,
	addr ids.ShortID,
	assetID string,
	includePartial bool,
	options ...rpc.Option,
) (*GetBalanceReply, error)

GetBalance returns the balance of assetID held by addr.

If includePartial is set, balance includes partial owned (i.e. in a multisig) funds.

Deprecated: GetUTXOs should be used instead.

func (*Client) GetBlock

func (c *Client) GetBlock(ctx context.Context, blkID ids.ID, options ...rpc.Option) ([]byte, error)

GetBlock returns the block with the given id.

func (*Client) GetBlockByHeight

func (c *Client) GetBlockByHeight(ctx context.Context, height uint64, options ...rpc.Option) ([]byte, error)

GetBlockByHeight returns the block at the given height.

func (*Client) GetHeight

func (c *Client) GetHeight(ctx context.Context, options ...rpc.Option) (uint64, error)

GetHeight returns the height of the last accepted block.

func (*Client) GetTx

func (c *Client) GetTx(ctx context.Context, txID ids.ID, options ...rpc.Option) ([]byte, error)

GetTx returns the byte representation of txID.

func (*Client) GetTxFee

func (c *Client) GetTxFee(ctx context.Context, options ...rpc.Option) (uint64, uint64, error)

GetTxFee returns the cost to issue certain transactions.

func (*Client) GetTxStatus deprecated

func (c *Client) GetTxStatus(ctx context.Context, txID ids.ID, options ...rpc.Option) (choices.Status, error)

GetTxStatus returns the status of [txID]

Deprecated: GetTxStatus only returns Accepted or Unknown, GetTx should be used instead to determine if the tx was accepted.

func (*Client) GetUTXOs

func (c *Client) GetUTXOs(
	ctx context.Context,
	addrs []ids.ShortID,
	limit uint32,
	startAddress ids.ShortID,
	startUTXOID ids.ID,
	options ...rpc.Option,
) ([][]byte, ids.ShortID, ids.ID, error)

GetUTXOs returns the byte representation of the UTXOs controlled by addrs.

func (*Client) IssueTx

func (c *Client) IssueTx(ctx context.Context, txBytes []byte, options ...rpc.Option) (ids.ID, error)

IssueTx issues a transaction to a node and returns the TxID

type Config

type Config struct {
	Network          network.Config `json:"network"`
	ChecksumsEnabled bool           `json:"checksumsEnabled"`
	config.Config
}

func ParseConfig

func ParseConfig(configBytes []byte) (Config, error)

type Factory

type Factory struct {
	config.Config

	// SecurityProfile pins the chain-wide credential-admission policy
	// resolved at node bootstrap from the genesis SecurityProfile block
	// (F102). The X-chain VM threads this into its mempool builder via
	// SetAuthPolicy so strict-PQ chains refuse classical secp256k1
	// credentials at gossip time. Nil for legacy (classical-compat)
	// networks that pre-date the locked-profile pin.
	SecurityProfile *consensusconfig.ChainSecurityProfile

	// ClassicalCompatRegistry names the allow-list of legacy operators
	// that may still post classical secp256k1 credentials under a
	// classical-compat fork profile. Nil for strict-PQ.
	ClassicalCompatRegistry auth.ClassicalCompatRegistry
}

func (*Factory) New

func (f *Factory) New(log.Logger) (interface{}, error)

type FormattedAssetID

type FormattedAssetID struct {
	AssetID ids.ID `json:"assetID"`
}

FormattedAssetID defines a JSON formatted struct containing an assetID as a string

func (*FormattedAssetID) MarshalZAP added in v1.36.178

func (x *FormattedAssetID) MarshalZAP() ([]byte, error)

MarshalZAP writes FormattedAssetID from constant offsets.

func (*FormattedAssetID) UnmarshalZAP added in v1.36.178

func (x *FormattedAssetID) UnmarshalZAP(data []byte) error

UnmarshalZAP reads FormattedAssetID out of the buffer that arrived.

type Genesis

type Genesis struct {
	Txs []*GenesisAsset `serialize:"true"`
}

Genesis represents the genesis state of the XVM

func NewGenesis

func NewGenesis(
	networkID uint32,
	genesisData map[string]GenesisAssetDefinition,
) (*Genesis, error)

NewGenesis creates a new Genesis from genesis data

func ParseGenesisBytes added in v1.26.40

func ParseGenesisBytes(genesisBytes []byte) (*Genesis, error)

ParseGenesisBytes decodes the canonical XVM genesis bytes produced by (*Genesis).Bytes() back into a *Genesis with each GenesisAsset's embedded CreateAssetTx initialised against the genesis codec. After Initialize, each tx's deterministic ID (tx.ID()) is the runtime asset ID of that genesis-minted asset — i.e. the same value vm.initGenesis computes when bootstrapping the X-Chain.

Callers (genesis/builder, config/getGenesisData) use this to derive the X-Chain native asset ID from genesis content rather than the network-id-keyed constants.UTXOAssetIDFor(networkID). On sovereign L1s those two values DIFFER — the wallet builder context's UTXOAssetID must be the genesis-derived one or every fee-paying tx fails with "insufficient funds, needs N more µLUX".

func (*Genesis) Bytes

func (g *Genesis) Bytes() ([]byte, error)

Bytes serializes the Genesis to its canonical native-ZAP bytes.

type GenesisAsset

type GenesisAsset struct {
	Alias             string `serialize:"true"`
	txs.CreateAssetTx `serialize:"true"`
}

GenesisAsset represents an asset in the genesis block

func (*GenesisAsset) Compare

func (g *GenesisAsset) Compare(other *GenesisAsset) int

Compare implements utils.Sortable for GenesisAsset

type GenesisAssetDefinition added in v1.24.12

type GenesisAssetDefinition struct {
	Name         string
	Symbol       string
	Denomination byte
	InitialState AssetInitialState
	Memo         []byte
}

GenesisAssetDefinition describes a genesis asset and its initial state

type GenesisHolder added in v1.24.12

type GenesisHolder struct {
	Amount  uint64
	Address string
}

GenesisHolder describes how much asset is owned by an address

type GenesisOwners added in v1.24.12

type GenesisOwners struct {
	Threshold uint32
	Minters   []string
}

GenesisOwners describes who can perform an action

type GetAddressTxsArgs added in v1.1.11

type GetAddressTxsArgs struct {
	apitypes.JSONAddress
	// Cursor used as a page index / offset
	Cursor avajson.Uint64 `json:"cursor"`
	// PageSize num of items per page
	PageSize avajson.Uint64 `json:"pageSize"`
	// AssetID defaulted to LUX if omitted or left blank
	AssetID string `json:"assetID"`
}

func (*GetAddressTxsArgs) MarshalZAP added in v1.36.178

func (x *GetAddressTxsArgs) MarshalZAP() ([]byte, error)

MarshalZAP writes GetAddressTxsArgs from constant offsets.

func (*GetAddressTxsArgs) UnmarshalZAP added in v1.36.178

func (x *GetAddressTxsArgs) UnmarshalZAP(data []byte) error

UnmarshalZAP reads GetAddressTxsArgs out of the buffer that arrived.

type GetAddressTxsReply added in v1.1.11

type GetAddressTxsReply struct {
	TxIDs []ids.ID `json:"txIDs"`
	// Cursor used as a page index / offset
	Cursor avajson.Uint64 `json:"cursor"`
}

func (*GetAddressTxsReply) MarshalZAP added in v1.36.178

func (x *GetAddressTxsReply) MarshalZAP() ([]byte, error)

MarshalZAP writes GetAddressTxsReply from constant offsets.

func (*GetAddressTxsReply) UnmarshalZAP added in v1.36.178

func (x *GetAddressTxsReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads GetAddressTxsReply out of the buffer that arrived.

type GetAllBalancesArgs

type GetAllBalancesArgs struct {
	apitypes.JSONAddress
	IncludePartial bool `json:"includePartial"`
}

func (*GetAllBalancesArgs) MarshalZAP added in v1.36.178

func (x *GetAllBalancesArgs) MarshalZAP() ([]byte, error)

MarshalZAP writes GetAllBalancesArgs from constant offsets.

func (*GetAllBalancesArgs) UnmarshalZAP added in v1.36.178

func (x *GetAllBalancesArgs) UnmarshalZAP(data []byte) error

UnmarshalZAP reads GetAllBalancesArgs out of the buffer that arrived.

type GetAllBalancesReply

type GetAllBalancesReply struct {
	Balances []Balance `json:"balances"`
}

GetAllBalancesReply is the response from a call to GetAllBalances

func (*GetAllBalancesReply) MarshalZAP added in v1.36.178

func (x *GetAllBalancesReply) MarshalZAP() ([]byte, error)

MarshalZAP writes GetAllBalancesReply from constant offsets.

func (*GetAllBalancesReply) UnmarshalZAP added in v1.36.178

func (x *GetAllBalancesReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads GetAllBalancesReply out of the buffer that arrived.

type GetAssetDescriptionArgs

type GetAssetDescriptionArgs struct {
	AssetID string `json:"assetID"`
}

GetAssetDescriptionArgs are arguments for passing into GetAssetDescription requests

func (*GetAssetDescriptionArgs) MarshalZAP added in v1.36.178

func (x *GetAssetDescriptionArgs) MarshalZAP() ([]byte, error)

MarshalZAP writes GetAssetDescriptionArgs from constant offsets.

func (*GetAssetDescriptionArgs) UnmarshalZAP added in v1.36.178

func (x *GetAssetDescriptionArgs) UnmarshalZAP(data []byte) error

UnmarshalZAP reads GetAssetDescriptionArgs out of the buffer that arrived.

type GetAssetDescriptionReply

type GetAssetDescriptionReply struct {
	FormattedAssetID
	Name         string        `json:"name"`
	Symbol       string        `json:"symbol"`
	Denomination avajson.Uint8 `json:"denomination"`
}

GetAssetDescriptionReply defines the GetAssetDescription replies returned from the API

func (*GetAssetDescriptionReply) MarshalZAP added in v1.36.178

func (x *GetAssetDescriptionReply) MarshalZAP() ([]byte, error)

MarshalZAP writes GetAssetDescriptionReply from constant offsets.

func (*GetAssetDescriptionReply) UnmarshalZAP added in v1.36.178

func (x *GetAssetDescriptionReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads GetAssetDescriptionReply out of the buffer that arrived.

type GetBalanceArgs

type GetBalanceArgs struct {
	Address        string `json:"address"`
	AssetID        string `json:"assetID"`
	IncludePartial bool   `json:"includePartial"`
}

GetBalanceArgs are arguments for passing into GetBalance requests

func (*GetBalanceArgs) MarshalZAP added in v1.36.178

func (x *GetBalanceArgs) MarshalZAP() ([]byte, error)

MarshalZAP writes GetBalanceArgs from constant offsets.

func (*GetBalanceArgs) UnmarshalZAP added in v1.36.178

func (x *GetBalanceArgs) UnmarshalZAP(data []byte) error

UnmarshalZAP reads GetBalanceArgs out of the buffer that arrived.

type GetBalanceReply

type GetBalanceReply struct {
	Balance avajson.Uint64 `json:"balance"`
	UTXOIDs []lux.UTXOID   `json:"utxoIDs"`
}

GetBalanceReply defines the GetBalance replies returned from the API

func (*GetBalanceReply) MarshalZAP added in v1.36.178

func (x *GetBalanceReply) MarshalZAP() ([]byte, error)

MarshalZAP writes GetBalanceReply from constant offsets.

func (*GetBalanceReply) UnmarshalZAP added in v1.36.178

func (x *GetBalanceReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads GetBalanceReply out of the buffer that arrived.

type GetCurrentValidatorOutput added in v1.16.16

type GetCurrentValidatorOutput struct {
	NodeID    ids.NodeID
	PublicKey interface{}
	Weight    uint64
}

GetCurrentValidatorOutput represents current validator info

type GetTxFeeReply

type GetTxFeeReply struct {
	TxFee            json.Uint64 `json:"txFee"`
	CreateAssetTxFee json.Uint64 `json:"createAssetTxFee"`
}

GetTxFeeReply is the response from a GetTxFee call

type GetTxStatusReply

type GetTxStatusReply struct {
	Status choices.Status `json:"status"`
}

GetTxStatusReply defines the GetTxStatus replies returned from the API

func (*GetTxStatusReply) MarshalZAP added in v1.36.178

func (x *GetTxStatusReply) MarshalZAP() ([]byte, error)

MarshalZAP writes GetTxStatusReply from constant offsets.

func (*GetTxStatusReply) UnmarshalZAP added in v1.36.178

func (x *GetTxStatusReply) UnmarshalZAP(data []byte) error

UnmarshalZAP reads GetTxStatusReply out of the buffer that arrived.

type Holder

type Holder struct {
	Amount  avajson.Uint64 `json:"amount"`
	Address string         `json:"address"`
}

Holder describes how much an address owns of an asset

func (*Holder) MarshalZAP added in v1.36.178

func (x *Holder) MarshalZAP() ([]byte, error)

MarshalZAP writes Holder from constant offsets.

func (*Holder) UnmarshalZAP added in v1.36.178

func (x *Holder) UnmarshalZAP(data []byte) error

UnmarshalZAP reads Holder out of the buffer that arrived.

type InitialState added in v1.36.178

type InitialState struct {
	FixedCap    []Holder `json:"fixedCap,omitempty"`
	VariableCap []Owners `json:"variableCap,omitempty"`
}

InitialState is what an asset holds at genesis.

The wire spells it as an object, but its keys are not data: fixedCap carries holders, variableCap carries minters, and any other key has always been refused. A closed vocabulary of two is a struct with two fields, which is also what has a layout — and it removes the round trip through `any` that re-marshalled every element just to read it back into the type it already was.

func (*InitialState) MarshalZAP added in v1.36.178

func (x *InitialState) MarshalZAP() ([]byte, error)

MarshalZAP writes InitialState from constant offsets.

func (*InitialState) UnmarshalJSON added in v1.36.178

func (s *InitialState) UnmarshalJSON(b []byte) error

UnmarshalJSON refuses a key outside the vocabulary, which is where a malformed request belongs — the alternative is a genesis quietly built without the state that was asked for.

func (*InitialState) UnmarshalZAP added in v1.36.178

func (x *InitialState) UnmarshalZAP(data []byte) error

UnmarshalZAP reads InitialState out of the buffer that arrived.

type Owners

type Owners struct {
	Threshold avajson.Uint32 `json:"threshold"`
	Minters   []string       `json:"minters"`
}

Owners describes who can perform an action

func (*Owners) MarshalZAP added in v1.36.178

func (x *Owners) MarshalZAP() ([]byte, error)

MarshalZAP writes Owners from constant offsets.

func (*Owners) UnmarshalZAP added in v1.36.178

func (x *Owners) UnmarshalZAP(data []byte) error

UnmarshalZAP reads Owners out of the buffer that arrived.

type Service

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

Service defines the base service for the asset vm

func (*Service) GetAddressTxs added in v1.1.11

func (s *Service) GetAddressTxs(_ *http.Request, args *GetAddressTxsArgs, reply *GetAddressTxsReply) error

GetAddressTxs returns list of transactions for a given address

func (*Service) GetAllBalances

func (s *Service) GetAllBalances(_ *http.Request, args *GetAllBalancesArgs, reply *GetAllBalancesReply) error

GetAllBalances returns a map where:

Key: ID of an asset such that [args.Address] has a non-zero balance of the asset Value: The balance of the asset held by the address

If ![args.IncludePartial], returns only unlocked balance/UTXOs with a 1-out-of-1 multisig. Otherwise, returned balance/UTXOs includes assets held only partially by the address, and includes balances with locktime in the future.

func (*Service) GetAssetDescription

func (s *Service) GetAssetDescription(_ *http.Request, args *GetAssetDescriptionArgs, reply *GetAssetDescriptionReply) error

GetAssetDescription creates an empty account with the name passed in

func (*Service) GetBalance

func (s *Service) GetBalance(_ *http.Request, args *GetBalanceArgs, reply *GetBalanceReply) error

GetBalance returns the balance of an asset held by an address. If ![args.IncludePartial], returns only the balance held solely (1 out of 1 multisig) by the address and with a locktime in the past. Otherwise, returned balance includes assets held only partially by the address, and includes balances with locktime in the future.

func (*Service) GetBlock

func (s *Service) GetBlock(_ *http.Request, args *apitypes.GetBlockArgs, reply *apitypes.GetBlockResponse) error

GetBlock returns the requested block.

func (*Service) GetBlockByHeight

func (s *Service) GetBlockByHeight(_ *http.Request, args *apitypes.GetBlockByHeightArgs, reply *apitypes.GetBlockResponse) error

GetBlockByHeight returns the block at the given height.

func (*Service) GetHeight

func (s *Service) GetHeight(_ *http.Request, _ *struct{}, reply *apitypes.GetHeightResponse) error

GetHeight returns the height of the last accepted block.

func (*Service) GetTx

func (s *Service) GetTx(_ *http.Request, args *apitypes.GetTxArgs, reply *apitypes.GetTxReply) error

GetTx returns the specified transaction

func (*Service) GetTxStatus deprecated

func (s *Service) GetTxStatus(_ *http.Request, args *apitypes.JSONTxID, reply *GetTxStatusReply) error

GetTxStatus returns the status of the specified transaction

Deprecated: GetTxStatus only returns Accepted or Unknown, GetTx should be used instead to determine if the tx was accepted.

func (*Service) GetUTXOs

func (s *Service) GetUTXOs(_ *http.Request, args *apitypes.GetUTXOsArgs, reply *apitypes.GetUTXOsReply) error

GetUTXOs gets all utxos for passed in addresses

func (*Service) IssueTx

func (s *Service) IssueTx(_ *http.Request, args *apitypes.FormattedTx, reply *apitypes.JSONTxID) error

IssueTx attempts to issue a transaction into consensus

type SharedMemory added in v1.16.16

type SharedMemory interface {
	Get(peerChainID ids.ID, keys [][]byte) ([][]byte, error)
	Apply(map[ids.ID]interface{}, ...interface{}) error
}

SharedMemory provides cross-chain shared memory

type StaticClient added in v1.1.11

type StaticClient interface {
	BuildGenesis(ctx context.Context, args *BuildGenesisArgs, options ...rpc.Option) (*BuildGenesisReply, error)
}

StaticClient for interacting with the XVM static api

func NewStaticClient added in v1.1.11

func NewStaticClient(uri string) StaticClient

NewClient returns an XVM client for interacting with the xvm static api

type StaticService added in v1.1.11

type StaticService struct{}

StaticService defines the base service for the asset vm

func CreateStaticService added in v1.1.11

func CreateStaticService() *StaticService

func (*StaticService) BuildGenesis added in v1.1.11

func (*StaticService) BuildGenesis(_ *http.Request, args *BuildGenesisArgs, reply *BuildGenesisReply) error

BuildGenesis returns the UTXOs such that at least one address in [args.Addresses] is referenced in the UTXO.

type VM

type VM struct {
	network.Atomic

	config.Config

	lux.AddressManager
	ids.Aliaser

	// Lock for thread safety (exposed for tests)
	Lock sync.RWMutex

	// Chain information
	ChainID  ids.ID
	XChainID ids.ID

	// SharedMemory for cross-chain operations
	SharedMemory SharedMemory

	// These values are only initialized after the chain has been linearized.
	blockbuilder.Builder
	// contains filtered or unexported fields
}

func (*VM) Clock added in v1.24.12

func (vm *VM) Clock() *mockable.Clock

Clock returns the VM's clock for time-related operations

func (*VM) Connected

func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *consensusversion.Application) error

func (*VM) CreateHandlers

func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error)

func (*VM) CreateStaticHandlers added in v1.16.16

func (vm *VM) CreateStaticHandlers(context.Context) (map[string]http.Handler, error)

func (*VM) Disconnected

func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error

func (*VM) GetBlock

func (vm *VM) GetBlock(_ context.Context, blkID ids.ID) (chain.Block, error)

func (*VM) GetBlockIDAtHeight

func (vm *VM) GetBlockIDAtHeight(_ context.Context, height uint64) (ids.ID, error)

func (*VM) GetUTXOs added in v1.30.16

func (vm *VM) GetUTXOs(addrs set.Set[ids.ShortID]) ([]*lux.UTXO, error)

GetUTXOs returns every UTXO this chain's state holds that is owned by at least one address in [addrs]. This is the in-process (no-HTTP) counterpart to Service.GetUTXOs: the chain manager's NFT-authorization gate calls it to decide whether a validator's staking X-address holds a chain-activation NFT.

GetAllUTXOs is a multi-step UTXOIDs-then-GetUTXO walk over vm.state, so it acquires vm.Lock for read to take a consistent snapshot — mirroring Service.GetUTXOs, which locks for its own GetUTXOs walk. The lock is taken HERE (not left to callers) so the snapshot guarantee is part of the method's contract and no caller can violate it; a read lock is sufficient and lets concurrent readers proceed. Safe against deadlock: the sole in-process caller is the chain manager's NFT gate (chains/manager_authz.go), which holds only its own chainsLock when resolving this reader and never vm.Lock. Returns an empty slice (never nil error) when [addrs] is empty.

func (*VM) HealthCheck

func (vm *VM) HealthCheck(context.Context) (chain.HealthResult, error)

HealthCheck reports the VM's health to the consensus engine. It returns a chain.HealthResult (= block.HealthCheckResult) so *VM satisfies the linear chain.ChainVM interface used by the certificate path.

func (*VM) Initialize

func (vm *VM) Initialize(
	ctx context.Context,
	init vmcore.Init,
) error

func (*VM) LastAccepted

func (vm *VM) LastAccepted(context.Context) (ids.ID, error)

func (*VM) Linearize

func (vm *VM) Linearize(ctx context.Context, stopVertexID ids.ID, toEngine chan<- vmcore.Message) error

func (*VM) Logger added in v1.24.12

func (vm *VM) Logger() log.Logger

Logger returns the VM's logger

func (*VM) NewHTTPHandler

func (vm *VM) NewHTTPHandler(ctx context.Context) (http.Handler, error)

NewHTTPHandler implements the engine.VM interface

func (*VM) ParseAddress added in v1.24.12

func (vm *VM) ParseAddress(addrStr string) (ids.ID, ids.ShortID, error)

ParseAddress resolves chain aliases (like "X") via BCLookup before parsing. This overrides the embedded AddressManager which can't resolve aliases.

func (*VM) ParseBlock

func (vm *VM) ParseBlock(_ context.Context, blkBytes []byte) (chain.Block, error)

func (*VM) SetPreference

func (vm *VM) SetPreference(_ context.Context, blkID ids.ID) error

func (*VM) SetState

func (vm *VM) SetState(_ context.Context, stateNum uint32) error

func (*VM) Shutdown

func (vm *VM) Shutdown(context.Context) error

func (*VM) Version

func (*VM) Version(context.Context) (string, error)

func (*VM) WaitForEvent added in v1.1.11

func (vm *VM) WaitForEvent(ctx context.Context) (vmcore.Message, error)

WaitForEvent blocks until the VM has work for the consensus engine (a pending-tx event) or ctx is cancelled. It returns a vmcore.Message (= block.Message) so *VM satisfies the linear chain.ChainVM interface used by the certificate path.

type WalletClient deprecated

type WalletClient struct {
	Requester rpc.EndpointRequester
}

WalletClient for interacting with exchangevm managed wallet.

Deprecated: Transactions should be issued using the `luxfi/node/wallet/chain/x.Wallet` utility.

func NewWalletClient deprecated

func NewWalletClient(uri, chain string) *WalletClient

NewWalletClient returns an Exchange VM wallet client for interacting with exchangevm managed wallet

Deprecated: Transactions should be issued using the `luxfi/node/wallet/chain/x.Wallet` utility.

func (*WalletClient) IssueTx

func (c *WalletClient) IssueTx(ctx context.Context, txBytes []byte, options ...rpc.Option) (ids.ID, error)

IssueTx issues a transaction to a node and returns the TxID

type WalletService

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

func (*WalletService) IssueTx

func (w *WalletService) IssueTx(_ *http.Request, args *apitypes.FormattedTx, reply *apitypes.JSONTxID) error

IssueTx attempts to issue a transaction into consensus

Directories

Path Synopsis
Package block is a generated GoMock package.
Package block is a generated GoMock package.
executor
Package executor is a generated GoMock package.
Package executor is a generated GoMock package.
executor/executormock
Package executormock is a generated GoMock package.
Package executormock is a generated GoMock package.
Package genesis builds X-Chain (XVM) genesis bytes from a small, caller-supplied descriptor.
Package genesis builds X-Chain (XVM) genesis bytes from a small, caller-supplied descriptor.
metricsmock
Package metricsmock is a generated GoMock package.
Package metricsmock is a generated GoMock package.
Package state is a generated GoMock package.
Package state is a generated GoMock package.
statemock
Package statemock is a generated GoMock package.
Package statemock is a generated GoMock package.
xvmroot
Package xvmroot computes the xvm execution_root in native Go, byte-identical to the lux-private GPU xvm_root_update kernel (ops/xvm/cuda/xvm_roots.cu) and every backend's CPU oracle.
Package xvmroot computes the xvm execution_root in native Go, byte-identical to the lux-private GPU xvm_root_update kernel (ops/xvm/cuda/xvm_roots.cu) and every backend's CPU oracle.
txs
Package txs is the X-chain (xvm) transaction package for the luxfi/node binary.
Package txs is the X-chain (xvm) transaction package for the luxfi/node binary.
mempool/mempoolmock
Package mempoolmock is a generated GoMock package.
Package mempoolmock is a generated GoMock package.
txsmock
Package txsmock is a generated GoMock package.
Package txsmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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