avm

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: BSD-3-Clause Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ID = ids.NewID([32]byte{'a', 'v', 'm'})
)

ID that this VM uses when labeled

Functions

This section is empty.

Types

type AssetDefinition

type AssetDefinition struct {
	Name         string                   `json:"name"`
	Symbol       string                   `json:"symbol"`
	Denomination cjson.Uint8              `json:"denomination"`
	InitialState map[string][]interface{} `json:"initialState"`
}

AssetDefinition ...

type BaseTx

type BaseTx struct {
	ava.Metadata

	NetID uint32                    `serialize:"true" json:"networkID"`    // ID of the network this chain lives on
	BCID  ids.ID                    `serialize:"true" json:"blockchainID"` // ID of the chain on which this transaction exists (prevents replay attacks)
	Outs  []*ava.TransferableOutput `serialize:"true" json:"outputs"`      // The outputs of this transaction
	Ins   []*ava.TransferableInput  `serialize:"true" json:"inputs"`       // The inputs to this transaction
}

BaseTx is the basis of all transactions.

func (*BaseTx) AssetIDs

func (t *BaseTx) AssetIDs() ids.Set

AssetIDs returns the IDs of the assets this transaction depends on

func (*BaseTx) ExecuteWithSideEffects

func (t *BaseTx) ExecuteWithSideEffects(_ *VM, batch database.Batch) error

ExecuteWithSideEffects writes the batch with any additional side effects

func (*BaseTx) InputUTXOs

func (t *BaseTx) InputUTXOs() []*ava.UTXOID

InputUTXOs track which UTXOs this transaction is consuming.

func (*BaseTx) NumCredentials

func (t *BaseTx) NumCredentials() int

NumCredentials returns the number of expected credentials

func (*BaseTx) SemanticVerify

func (t *BaseTx) SemanticVerify(vm *VM, uTx *UniqueTx, creds []verify.Verifiable) error

SemanticVerify that this transaction is valid to be spent.

func (*BaseTx) SyntacticVerify

func (t *BaseTx) SyntacticVerify(ctx *snow.Context, c codec.Codec, _ int) error

SyntacticVerify that this transaction is well-formed.

func (*BaseTx) UTXOs

func (t *BaseTx) UTXOs() []*ava.UTXO

UTXOs returns the UTXOs transaction is producing.

type BuildGenesisArgs

type BuildGenesisArgs struct {
	GenesisData map[string]AssetDefinition `json:"genesisData"`
}

BuildGenesisArgs are arguments for BuildGenesis

type BuildGenesisReply

type BuildGenesisReply struct {
	Bytes formatting.CB58 `json:"bytes"`
}

BuildGenesisReply is the reply from BuildGenesis

type CreateAddressArgs

type CreateAddressArgs struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

CreateAddressArgs are arguments for calling CreateAddress

type CreateAddressReply

type CreateAddressReply struct {
	Address string `json:"address"`
}

CreateAddressReply define the reply from a CreateAddress call

type CreateAssetTx

type CreateAssetTx struct {
	BaseTx       `serialize:"true"`
	Name         string          `serialize:"true" json:"name"`
	Symbol       string          `serialize:"true" json:"symbol"`
	Denomination byte            `serialize:"true" json:"denomination"`
	States       []*InitialState `serialize:"true" json:"initialStates"`
}

CreateAssetTx is a transaction that creates a new asset.

func (*CreateAssetTx) InitialStates

func (t *CreateAssetTx) InitialStates() []*InitialState

InitialStates track which virtual machines, and the initial state of these machines, this asset uses. The returned array should not be modified.

func (*CreateAssetTx) Sort

func (t *CreateAssetTx) Sort()

Sort ...

func (*CreateAssetTx) SyntacticVerify

func (t *CreateAssetTx) SyntacticVerify(ctx *snow.Context, c codec.Codec, numFxs int) error

SyntacticVerify that this transaction is well-formed.

func (*CreateAssetTx) UTXOs

func (t *CreateAssetTx) UTXOs() []*ava.UTXO

UTXOs returns the UTXOs transaction is producing.

type CreateFixedCapAssetArgs

type CreateFixedCapAssetArgs struct {
	Username       string    `json:"username"`
	Password       string    `json:"password"`
	Name           string    `json:"name"`
	Symbol         string    `json:"symbol"`
	Denomination   byte      `json:"denomination"`
	InitialHolders []*Holder `json:"initialHolders"`
}

CreateFixedCapAssetArgs are arguments for passing into CreateFixedCapAsset requests

type CreateFixedCapAssetReply

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

CreateFixedCapAssetReply defines the CreateFixedCapAsset replies returned from the API

type CreateMintTxArgs

type CreateMintTxArgs struct {
	Amount  json.Uint64 `json:"amount"`
	AssetID string      `json:"assetID"`
	To      string      `json:"to"`
	Minters []string    `json:"minters"`
}

CreateMintTxArgs are arguments for passing into CreateMintTx requests

type CreateMintTxReply

type CreateMintTxReply struct {
	Tx formatting.CB58 `json:"tx"`
}

CreateMintTxReply defines the CreateMintTx replies returned from the API

type CreateVariableCapAssetArgs

type CreateVariableCapAssetArgs struct {
	Username     string   `json:"username"`
	Password     string   `json:"password"`
	Name         string   `json:"name"`
	Symbol       string   `json:"symbol"`
	Denomination byte     `json:"denomination"`
	MinterSets   []Owners `json:"minterSets"`
}

CreateVariableCapAssetArgs are arguments for passing into CreateVariableCapAsset requests

type CreateVariableCapAssetReply

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

CreateVariableCapAssetReply defines the CreateVariableCapAsset replies returned from the API

type ExportAVAArgs

type ExportAVAArgs struct {
	// User providing exported AVA
	Username string `json:"username"`
	Password string `json:"password"`

	// Amount of nAVA to send
	Amount json.Uint64 `json:"amount"`

	// ID of P-Chain account that will receive the AVA
	To ids.ShortID `json:"to"`
}

ExportAVAArgs are arguments for passing into ExportAVA requests

type ExportAVAReply

type ExportAVAReply struct {
	TxID ids.ID `json:"txID"`
}

ExportAVAReply defines the Send replies returned from the API

type ExportKeyArgs

type ExportKeyArgs struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Address  string `json:"address"`
}

ExportKeyArgs are arguments for ExportKey

type ExportKeyReply

type ExportKeyReply struct {
	// The decrypted PrivateKey for the Address provided in the arguments
	PrivateKey formatting.CB58 `json:"privateKey"`
}

ExportKeyReply is the response for ExportKey

type ExportTx

type ExportTx struct {
	BaseTx `serialize:"true"`

	Outs []*ava.TransferableOutput `serialize:"true" json:"exportedOutputs"` // The outputs this transaction is sending to the other chain
}

ExportTx is the basis of all transactions.

func (*ExportTx) ExecuteWithSideEffects

func (t *ExportTx) ExecuteWithSideEffects(vm *VM, batch database.Batch) error

ExecuteWithSideEffects writes the batch with any additional side effects

func (*ExportTx) SemanticVerify

func (t *ExportTx) SemanticVerify(vm *VM, uTx *UniqueTx, creds []verify.Verifiable) error

SemanticVerify that this transaction is valid to be spent.

func (*ExportTx) SyntacticVerify

func (t *ExportTx) SyntacticVerify(ctx *snow.Context, c codec.Codec, _ int) error

SyntacticVerify that this transaction is well-formed.

type Factory

type Factory struct {
	AVA      ids.ID
	Platform ids.ID
}

Factory ...

func (*Factory) New

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

New ...

type Fx

type Fx interface {
	// Initialize this feature extension to be running under this VM. Should
	// return an error if the VM is incompatible.
	Initialize(vm interface{}) error

	// VerifyTransfer verifies that the specified transaction can spend the
	// provided utxo with no restrictions on the destination. If the transaction
	// can't spend the output based on the input and credential, a non-nil error
	// should be returned.
	VerifyTransfer(tx, in, cred, utxo interface{}) error

	// VerifyOperation verifies that the specified transaction can spend the
	// provided utxos conditioned on the result being restricted to the provided
	// outputs. If the transaction can't spend the output based on the input and
	// credential, a non-nil error  should be returned.
	VerifyOperation(tx, op, cred interface{}, utxos []interface{}) error
}

Fx is the interface a feature extension must implement to support the AVM.

type FxOperation

type FxOperation interface {
	verify.Verifiable

	Outs() []verify.Verifiable
}

FxOperation ...

type Genesis

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

Genesis ...

func (*Genesis) IsSortedAndUnique

func (g *Genesis) IsSortedAndUnique() bool

IsSortedAndUnique ...

func (*Genesis) Len

func (g *Genesis) Len() int

Len ...

func (*Genesis) Less

func (g *Genesis) Less(i, j int) bool

Less ...

func (*Genesis) Sort

func (g *Genesis) Sort()

Sort ...

func (*Genesis) Swap

func (g *Genesis) Swap(i, j int)

Swap ...

type GenesisAsset

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

GenesisAsset ...

type GetAssetDescriptionArgs

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

GetAssetDescriptionArgs are arguments for passing into GetAssetDescription requests

type GetAssetDescriptionReply

type GetAssetDescriptionReply struct {
	AssetID      ids.ID     `json:"assetID"`
	Name         string     `json:"name"`
	Symbol       string     `json:"symbol"`
	Denomination json.Uint8 `json:"denomination"`
}

GetAssetDescriptionReply defines the GetAssetDescription replies returned from the API

type GetBalanceArgs

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

GetBalanceArgs are arguments for passing into GetBalance requests

type GetBalanceReply

type GetBalanceReply struct {
	Balance json.Uint64 `json:"balance"`
}

GetBalanceReply defines the GetBalance replies returned from the API

type GetTxStatusArgs

type GetTxStatusArgs struct {
	TxID ids.ID `json:"txID"`
}

GetTxStatusArgs are arguments for passing into GetTxStatus requests

type GetTxStatusReply

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

GetTxStatusReply defines the GetTxStatus replies returned from the API

type GetUTXOsArgs

type GetUTXOsArgs struct {
	Addresses []string `json:"addresses"`
}

GetUTXOsArgs are arguments for passing into GetUTXOs requests

type GetUTXOsReply

type GetUTXOsReply struct {
	UTXOs []formatting.CB58 `json:"utxos"`
}

GetUTXOsReply defines the GetUTXOs replies returned from the API

type Holder

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

Holder describes how much an address owns of an asset

type ImportAVAArgs

type ImportAVAArgs struct {
	// User that controls To
	Username string `json:"username"`
	Password string `json:"password"`

	// Address receiving the imported AVA
	To string `json:"to"`
}

ImportAVAArgs are arguments for passing into ImportAVA requests

type ImportAVAReply

type ImportAVAReply struct {
	TxID ids.ID `json:"txID"`
}

ImportAVAReply defines the ImportAVA replies returned from the API

type ImportKeyArgs

type ImportKeyArgs struct {
	Username   string          `json:"username"`
	Password   string          `json:"password"`
	PrivateKey formatting.CB58 `json:"privateKey"`
}

ImportKeyArgs are arguments for ImportKey

type ImportKeyReply

type ImportKeyReply struct {
	// The address controlled by the PrivateKey provided in the arguments
	Address string `json:"address"`
}

ImportKeyReply is the response for ImportKey

type ImportTx

type ImportTx struct {
	BaseTx `serialize:"true"`

	Ins []*ava.TransferableInput `serialize:"true" json:"importedInputs"` // The inputs to this transaction
}

ImportTx is a transaction that imports an asset from another blockchain.

func (*ImportTx) AssetIDs

func (t *ImportTx) AssetIDs() ids.Set

AssetIDs returns the IDs of the assets this transaction depends on

func (*ImportTx) ExecuteWithSideEffects

func (t *ImportTx) ExecuteWithSideEffects(vm *VM, batch database.Batch) error

ExecuteWithSideEffects writes the batch with any additional side effects

func (*ImportTx) InputUTXOs

func (t *ImportTx) InputUTXOs() []*ava.UTXOID

InputUTXOs track which UTXOs this transaction is consuming.

func (*ImportTx) NumCredentials

func (t *ImportTx) NumCredentials() int

NumCredentials returns the number of expected credentials

func (*ImportTx) SemanticVerify

func (t *ImportTx) SemanticVerify(vm *VM, uTx *UniqueTx, creds []verify.Verifiable) error

SemanticVerify that this transaction is well-formed.

func (*ImportTx) SyntacticVerify

func (t *ImportTx) SyntacticVerify(ctx *snow.Context, c codec.Codec, numFxs int) error

SyntacticVerify that this transaction is well-formed.

type InitialState

type InitialState struct {
	FxID uint32              `serialize:"true" json:"fxID"`
	Outs []verify.Verifiable `serialize:"true" json:"outputs"`
}

InitialState ...

func (*InitialState) Sort

func (is *InitialState) Sort(c codec.Codec)

Sort ...

func (*InitialState) Verify

func (is *InitialState) Verify(c codec.Codec, numFxs int) error

Verify implements the verify.Verifiable interface

type IssueTxArgs

type IssueTxArgs struct {
	Tx formatting.CB58 `json:"tx"`
}

IssueTxArgs are arguments for passing into IssueTx requests

type IssueTxReply

type IssueTxReply struct {
	TxID ids.ID `json:"txID"`
}

IssueTxReply defines the IssueTx replies returned from the API

type Operation

type Operation struct {
	ava.Asset `serialize:"true"`

	UTXOIDs []*ava.UTXOID `serialize:"true" json:"inputIDs"`
	Op      FxOperation   `serialize:"true" json:"operation"`
}

Operation ...

func (*Operation) Verify

func (op *Operation) Verify(c codec.Codec) error

Verify implements the verify.Verifiable interface

type OperationTx

type OperationTx struct {
	BaseTx `serialize:"true"`
	Ops    []*Operation `serialize:"true" json:"operations"`
}

OperationTx is a transaction with no credentials.

func (*OperationTx) AssetIDs

func (t *OperationTx) AssetIDs() ids.Set

AssetIDs returns the IDs of the assets this transaction depends on

func (*OperationTx) InputUTXOs

func (t *OperationTx) InputUTXOs() []*ava.UTXOID

InputUTXOs track which UTXOs this transaction is consuming.

func (*OperationTx) NumCredentials

func (t *OperationTx) NumCredentials() int

NumCredentials returns the number of expected credentials

func (*OperationTx) Operations

func (t *OperationTx) Operations() []*Operation

Operations track which ops this transaction is performing. The returned array should not be modified.

func (*OperationTx) SemanticVerify

func (t *OperationTx) SemanticVerify(vm *VM, uTx *UniqueTx, creds []verify.Verifiable) error

SemanticVerify that this transaction is well-formed.

func (*OperationTx) SyntacticVerify

func (t *OperationTx) SyntacticVerify(ctx *snow.Context, c codec.Codec, numFxs int) error

SyntacticVerify that this transaction is well-formed.

func (*OperationTx) UTXOs

func (t *OperationTx) UTXOs() []*ava.UTXO

UTXOs returns the UTXOs transaction is producing.

type Owners

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

Owners describes who can perform an action

type SendArgs

type SendArgs struct {
	Username string      `json:"username"`
	Password string      `json:"password"`
	Amount   json.Uint64 `json:"amount"`
	AssetID  string      `json:"assetID"`
	To       string      `json:"to"`
}

SendArgs are arguments for passing into Send requests

type SendReply

type SendReply struct {
	TxID ids.ID `json:"txID"`
}

SendReply defines the Send replies returned from the API

type Service

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

Service defines the base service for the asset vm

func (*Service) CreateAddress

func (service *Service) CreateAddress(r *http.Request, args *CreateAddressArgs, reply *CreateAddressReply) error

CreateAddress creates an address for the user [args.Username]

func (*Service) CreateFixedCapAsset

func (service *Service) CreateFixedCapAsset(r *http.Request, args *CreateFixedCapAssetArgs, reply *CreateFixedCapAssetReply) error

CreateFixedCapAsset returns ID of the newly created asset

func (*Service) CreateMintTx

func (service *Service) CreateMintTx(r *http.Request, args *CreateMintTxArgs, reply *CreateMintTxReply) error

CreateMintTx returns the newly created unsigned transaction

func (*Service) CreateVariableCapAsset

func (service *Service) CreateVariableCapAsset(r *http.Request, args *CreateVariableCapAssetArgs, reply *CreateVariableCapAssetReply) error

CreateVariableCapAsset returns ID of the newly created asset

func (*Service) ExportAVA

func (service *Service) ExportAVA(_ *http.Request, args *ExportAVAArgs, reply *ExportAVAReply) error

ExportAVA sends AVA from this chain to the P-Chain. After this tx is accepted, the AVA must be imported to the P-chain with an importTx. Returns the ID of the newly created atomic transaction

func (*Service) ExportKey

func (service *Service) ExportKey(r *http.Request, args *ExportKeyArgs, reply *ExportKeyReply) error

ExportKey returns a private key from the provided user

func (*Service) GetAssetDescription

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

GetAssetDescription creates an empty account with the name passed in

func (*Service) GetBalance

func (service *Service) GetBalance(r *http.Request, args *GetBalanceArgs, reply *GetBalanceReply) error

GetBalance returns the amount of an asset that an address at least partially owns

func (*Service) GetTxStatus

func (service *Service) GetTxStatus(r *http.Request, args *GetTxStatusArgs, reply *GetTxStatusReply) error

GetTxStatus returns the status of the specified transaction

func (*Service) GetUTXOs

func (service *Service) GetUTXOs(r *http.Request, args *GetUTXOsArgs, reply *GetUTXOsReply) error

GetUTXOs creates an empty account with the name passed in

func (*Service) ImportAVA

func (service *Service) ImportAVA(_ *http.Request, args *ImportAVAArgs, reply *ImportAVAReply) error

ImportAVA imports AVA to this chain from the P-Chain. The AVA must have already been exported from the P-Chain. Returns the ID of the newly created atomic transaction

func (*Service) ImportKey

func (service *Service) ImportKey(r *http.Request, args *ImportKeyArgs, reply *ImportKeyReply) error

ImportKey adds a private key to the provided user

func (*Service) IssueTx

func (service *Service) IssueTx(r *http.Request, args *IssueTxArgs, reply *IssueTxReply) error

IssueTx attempts to issue a transaction into consensus

func (*Service) Send

func (service *Service) Send(r *http.Request, args *SendArgs, reply *SendReply) error

Send returns the ID of the newly created transaction

func (*Service) SignMintTx

func (service *Service) SignMintTx(r *http.Request, args *SignMintTxArgs, reply *SignMintTxReply) error

SignMintTx returns the newly signed transaction

type SignMintTxArgs

type SignMintTxArgs struct {
	Username string          `json:"username"`
	Password string          `json:"password"`
	Minter   string          `json:"minter"`
	Tx       formatting.CB58 `json:"tx"`
}

SignMintTxArgs are arguments for passing into SignMintTx requests

type SignMintTxReply

type SignMintTxReply struct {
	Tx formatting.CB58 `json:"tx"`
}

SignMintTxReply defines the SignMintTx replies returned from the API

type StaticService

type StaticService struct{}

StaticService defines the base service for the asset vm

func (*StaticService) BuildGenesis

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 Tx

type Tx struct {
	UnsignedTx `serialize:"true" json:"unsignedTx"`

	Creds []verify.Verifiable `serialize:"true" json:"credentials"` // The credentials of this transaction
}

Tx is the core operation that can be performed. The tx uses the UTXO model. Specifically, a txs inputs will consume previous txs outputs. A tx will be valid if the inputs have the authority to consume the outputs they are attempting to consume and the inputs consume sufficient state to produce the outputs.

func (*Tx) Credentials

func (t *Tx) Credentials() []verify.Verifiable

Credentials describes the authorization that allows the Inputs to consume the specified UTXOs. The returned array should not be modified.

func (*Tx) SemanticVerify

func (t *Tx) SemanticVerify(vm *VM, uTx *UniqueTx) error

SemanticVerify verifies that this transaction is well-formed.

func (*Tx) SyntacticVerify

func (t *Tx) SyntacticVerify(ctx *snow.Context, c codec.Codec, numFxs int) error

SyntacticVerify verifies that this transaction is well-formed.

type TxState

type TxState struct {
	*Tx
	// contains filtered or unexported fields
}

TxState ...

type UniqueTx

type UniqueTx struct {
	*TxState
	// contains filtered or unexported fields
}

UniqueTx provides a de-duplication service for txs. This only provides a performance boost

func (*UniqueTx) Accept

func (tx *UniqueTx) Accept()

Accept is called when the transaction was finalized as accepted by consensus

func (*UniqueTx) Bytes

func (tx *UniqueTx) Bytes() []byte

Bytes returns the binary representation of this transaction

func (*UniqueTx) Dependencies

func (tx *UniqueTx) Dependencies() []snowstorm.Tx

Dependencies returns the set of transactions this transaction builds on

func (*UniqueTx) Evict

func (tx *UniqueTx) Evict()

Evict is called when this UniqueTx will no longer be returned from a cache lookup

func (*UniqueTx) ID

func (tx *UniqueTx) ID() ids.ID

ID returns the wrapped txID

func (*UniqueTx) InputIDs

func (tx *UniqueTx) InputIDs() ids.Set

InputIDs returns the set of utxoIDs this transaction consumes

func (*UniqueTx) InputUTXOs

func (tx *UniqueTx) InputUTXOs() []*ava.UTXOID

InputUTXOs returns the utxos that will be consumed on tx acceptance

func (*UniqueTx) Reject

func (tx *UniqueTx) Reject()

Reject is called when the transaction was finalized as rejected by consensus

func (*UniqueTx) SemanticVerify

func (tx *UniqueTx) SemanticVerify() error

SemanticVerify the validity of this transaction

func (*UniqueTx) Status

func (tx *UniqueTx) Status() choices.Status

Status returns the current status of this transaction

func (*UniqueTx) SyntacticVerify

func (tx *UniqueTx) SyntacticVerify() error

SyntacticVerify verifies that this transaction is well formed

func (*UniqueTx) UTXOs

func (tx *UniqueTx) UTXOs() []*ava.UTXO

UTXOs returns the utxos that will be added to the UTXO set on tx acceptance

func (*UniqueTx) UnsignedBytes

func (tx *UniqueTx) UnsignedBytes() []byte

UnsignedBytes returns the unsigned bytes of the transaction

func (*UniqueTx) Verify

func (tx *UniqueTx) Verify() error

Verify the validity of this transaction

type UnsignedTx

type UnsignedTx interface {
	Initialize(bytes []byte)
	ID() ids.ID
	Bytes() []byte

	AssetIDs() ids.Set
	NumCredentials() int
	InputUTXOs() []*ava.UTXOID
	UTXOs() []*ava.UTXO

	SyntacticVerify(ctx *snow.Context, c codec.Codec, numFxs int) error
	SemanticVerify(vm *VM, uTx *UniqueTx, creds []verify.Verifiable) error
	ExecuteWithSideEffects(vm *VM, batch database.Batch) error
}

UnsignedTx ...

type VM

type VM struct {
	ids.Aliaser
	// contains filtered or unexported fields
}

VM implements the avalanche.DAGVM interface

func (*VM) Clock

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

Clock returns a reference to the internal clock of this VM

func (*VM) Codec

func (vm *VM) Codec() codec.Codec

Codec returns a reference to the internal codec of this VM

func (*VM) CreateHandlers

func (vm *VM) CreateHandlers() map[string]*common.HTTPHandler

CreateHandlers implements the avalanche.DAGVM interface

func (*VM) CreateStaticHandlers

func (vm *VM) CreateStaticHandlers() map[string]*common.HTTPHandler

CreateStaticHandlers implements the avalanche.DAGVM interface

func (*VM) FlushTxs

func (vm *VM) FlushTxs()

FlushTxs into consensus

func (*VM) Format

func (vm *VM) Format(b []byte) string

Format ...

func (*VM) GetAtomicUTXOs

func (vm *VM) GetAtomicUTXOs(addrs ids.Set) ([]*ava.UTXO, error)

GetAtomicUTXOs returns the utxos that at least one of the provided addresses is referenced in.

func (*VM) GetTx

func (vm *VM) GetTx(txID ids.ID) (snowstorm.Tx, error)

GetTx implements the avalanche.DAGVM interface

func (*VM) GetUTXOs

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

GetUTXOs returns the utxos that at least one of the provided addresses is referenced in.

func (*VM) Initialize

func (vm *VM) Initialize(
	ctx *snow.Context,
	db database.Database,
	genesisBytes []byte,
	toEngine chan<- common.Message,
	fxs []*common.Fx,
) error

Initialize implements the avalanche.DAGVM interface

func (*VM) IssueTx

func (vm *VM) IssueTx(b []byte, onDecide func(choices.Status)) (ids.ID, error)

IssueTx attempts to send a transaction to consensus. If onDecide is specified, the function will be called when the transaction is either accepted or rejected with the appropriate status. This function will go out of scope when the transaction is removed from memory.

func (*VM) Logger

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

Logger returns a reference to the internal logger of this VM

func (*VM) Parse

func (vm *VM) Parse(addrStr string) ([]byte, error)

Parse ...

func (*VM) ParseTx

func (vm *VM) ParseTx(b []byte) (snowstorm.Tx, error)

ParseTx implements the avalanche.DAGVM interface

func (*VM) PendingTxs

func (vm *VM) PendingTxs() []snowstorm.Tx

PendingTxs implements the avalanche.DAGVM interface

func (*VM) Shutdown

func (vm *VM) Shutdown()

Shutdown implements the avalanche.DAGVM interface

Jump to

Keyboard shortcuts

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