Documentation ¶
Index ¶
- Constants
- Variables
- func CanDelegate(current, pending []*UnsignedAddDelegatorTx, new *UnsignedAddDelegatorTx, ...) (bool, error)
- type APIBlockchain
- type APIChain
- type APIOwner
- type APIPrimaryDelegator
- type APIPrimaryValidator
- type APIStaker
- type APISubnet
- type APIUTXO
- type AbortBlock
- type AddDelegatorArgs
- type AddSubnetValidatorArgs
- type AddValidatorArgs
- type AtomicBlock
- type BaseTx
- type Block
- type BuildGenesisArgs
- type BuildGenesisReply
- type Client
- type CommitBlock
- type CommonBlock
- func (b *CommonBlock) Accept() error
- func (b *CommonBlock) Bytes() []byte
- func (b *CommonBlock) Height() uint64
- func (b *CommonBlock) ID() ids.ID
- func (b *CommonBlock) Parent() ids.ID
- func (b *CommonBlock) Reject() error
- func (b *CommonBlock) Status() choices.Status
- func (b *CommonBlock) Timestamp() time.Time
- func (b *CommonBlock) Verify() error
- type CommonDecisionBlock
- type CreateBlockchainArgs
- type CreateSubnetArgs
- type DoubleDecisionBlock
- type ExportAVAXArgs
- type ExportKeyArgs
- type ExportKeyReply
- type Factory
- type Fx
- type Genesis
- type GenesisUTXO
- type GetBalanceRequest
- type GetBalanceResponse
- type GetBlockchainStatusArgs
- type GetBlockchainStatusReply
- type GetBlockchainsResponse
- type GetCurrentSupplyReply
- type GetCurrentValidatorsArgs
- type GetCurrentValidatorsReply
- type GetHeightResponse
- type GetMaxStakeAmountArgs
- type GetMaxStakeAmountReply
- type GetMinStakeReply
- type GetPendingValidatorsArgs
- type GetPendingValidatorsReply
- type GetRewardUTXOsReply
- type GetStakeArgs
- type GetStakeReply
- type GetStakingAssetIDArgs
- type GetStakingAssetIDResponse
- type GetSubnetsArgs
- type GetSubnetsResponse
- type GetTimestampReply
- type GetTotalStakeReply
- type GetTxStatusArgs
- type GetTxStatusResponse
- type GetUTXOsArgs
- type GetUTXOsResponse
- type GetValidatorsAtArgs
- type GetValidatorsAtReply
- type ImportAVAXArgs
- type ImportKeyArgs
- type Index
- type InternalState
- type Mempool
- type MutableState
- type Owned
- type Owner
- type ProposalBlock
- type SampleValidatorsArgs
- type SampleValidatorsReply
- type Service
- func (service *Service) AddDelegator(_ *http.Request, args *AddDelegatorArgs, reply *api.JSONTxIDChangeAddr) error
- func (service *Service) AddSubnetValidator(_ *http.Request, args *AddSubnetValidatorArgs, ...) error
- func (service *Service) AddValidator(_ *http.Request, args *AddValidatorArgs, reply *api.JSONTxIDChangeAddr) error
- func (service *Service) CreateAddress(_ *http.Request, args *api.UserPass, response *api.JSONAddress) error
- func (service *Service) CreateBlockchain(_ *http.Request, args *CreateBlockchainArgs, response *api.JSONTxIDChangeAddr) error
- func (service *Service) CreateSubnet(_ *http.Request, args *CreateSubnetArgs, response *api.JSONTxIDChangeAddr) error
- func (service *Service) ExportAVAX(_ *http.Request, args *ExportAVAXArgs, response *api.JSONTxIDChangeAddr) error
- func (service *Service) ExportKey(r *http.Request, args *ExportKeyArgs, reply *ExportKeyReply) error
- func (service *Service) GetBalance(_ *http.Request, args *GetBalanceRequest, response *GetBalanceResponse) error
- func (service *Service) GetBlockchainStatus(_ *http.Request, args *GetBlockchainStatusArgs, ...) error
- func (service *Service) GetBlockchains(_ *http.Request, args *struct{}, response *GetBlockchainsResponse) error
- func (service *Service) GetCurrentSupply(_ *http.Request, _ *struct{}, reply *GetCurrentSupplyReply) error
- func (service *Service) GetCurrentValidators(_ *http.Request, args *GetCurrentValidatorsArgs, ...) error
- func (service *Service) GetHeight(r *http.Request, args *struct{}, response *GetHeightResponse) error
- func (service *Service) GetMaxStakeAmount(_ *http.Request, args *GetMaxStakeAmountArgs, reply *GetMaxStakeAmountReply) error
- func (service *Service) GetMinStake(_ *http.Request, _ *struct{}, reply *GetMinStakeReply) error
- func (service *Service) GetPendingValidators(_ *http.Request, args *GetPendingValidatorsArgs, ...) error
- func (service *Service) GetRewardUTXOs(_ *http.Request, args *api.GetTxArgs, reply *GetRewardUTXOsReply) error
- func (service *Service) GetStake(_ *http.Request, args *GetStakeArgs, response *GetStakeReply) error
- func (service *Service) GetStakingAssetID(_ *http.Request, args *GetStakingAssetIDArgs, ...) error
- func (service *Service) GetSubnets(_ *http.Request, args *GetSubnetsArgs, response *GetSubnetsResponse) error
- func (service *Service) GetTimestamp(_ *http.Request, args *struct{}, reply *GetTimestampReply) error
- func (service *Service) GetTotalStake(_ *http.Request, _ *struct{}, reply *GetTotalStakeReply) error
- func (service *Service) GetTx(_ *http.Request, args *api.GetTxArgs, response *api.FormattedTx) error
- func (service *Service) GetTxStatus(_ *http.Request, args *GetTxStatusArgs, response *GetTxStatusResponse) error
- func (service *Service) GetUTXOs(_ *http.Request, args *GetUTXOsArgs, response *GetUTXOsResponse) error
- func (service *Service) GetValidatorsAt(_ *http.Request, args *GetValidatorsAtArgs, reply *GetValidatorsAtReply) error
- func (service *Service) ImportAVAX(_ *http.Request, args *ImportAVAXArgs, response *api.JSONTxIDChangeAddr) error
- func (service *Service) ImportKey(r *http.Request, args *ImportKeyArgs, reply *api.JSONAddress) error
- func (service *Service) IssueTx(_ *http.Request, args *api.FormattedTx, response *api.JSONTxID) error
- func (service *Service) ListAddresses(_ *http.Request, args *api.UserPass, response *api.JSONAddresses) error
- func (service *Service) SampleValidators(_ *http.Request, args *SampleValidatorsArgs, reply *SampleValidatorsReply) error
- func (service *Service) ValidatedBy(_ *http.Request, args *ValidatedByArgs, response *ValidatedByResponse) error
- func (service *Service) Validates(_ *http.Request, args *ValidatesArgs, response *ValidatesResponse) error
- type StakeableLockIn
- type StakeableLockOut
- type StandardBlock
- type StaticService
- type Subnet
- type SubnetValidator
- type TimedTx
- type TimedTxHeap
- type Tx
- type TxHeap
- type UTXOAdder
- type UTXODeleter
- type UTXOGetter
- type UTXOState
- type UnsignedAddDelegatorTx
- func (tx *UnsignedAddDelegatorTx) EndTime() time.Time
- func (tx *UnsignedAddDelegatorTx) Execute(vm *VM, parentState MutableState, stx *Tx) (VersionedState, VersionedState, error)
- func (tx *UnsignedAddDelegatorTx) InitCtx(ctx *snow.Context)
- func (tx *UnsignedAddDelegatorTx) InitiallyPrefersCommit(vm *VM) bool
- func (tx *UnsignedAddDelegatorTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
- func (tx *UnsignedAddDelegatorTx) StartTime() time.Time
- func (tx *UnsignedAddDelegatorTx) SyntacticVerify(ctx *snow.Context) error
- func (tx *UnsignedAddDelegatorTx) Weight() uint64
- type UnsignedAddSubnetValidatorTx
- func (tx *UnsignedAddSubnetValidatorTx) EndTime() time.Time
- func (tx *UnsignedAddSubnetValidatorTx) Execute(vm *VM, parentState MutableState, stx *Tx) (VersionedState, VersionedState, error)
- func (tx *UnsignedAddSubnetValidatorTx) InitiallyPrefersCommit(vm *VM) bool
- func (tx *UnsignedAddSubnetValidatorTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
- func (tx *UnsignedAddSubnetValidatorTx) StartTime() time.Time
- func (tx *UnsignedAddSubnetValidatorTx) SyntacticVerify(ctx *snow.Context) error
- func (tx *UnsignedAddSubnetValidatorTx) Weight() uint64
- type UnsignedAddValidatorTx
- func (tx *UnsignedAddValidatorTx) EndTime() time.Time
- func (tx *UnsignedAddValidatorTx) Execute(vm *VM, parentState MutableState, stx *Tx) (VersionedState, VersionedState, error)
- func (tx *UnsignedAddValidatorTx) InitCtx(ctx *snow.Context)
- func (tx *UnsignedAddValidatorTx) InitiallyPrefersCommit(vm *VM) bool
- func (tx *UnsignedAddValidatorTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
- func (tx *UnsignedAddValidatorTx) StartTime() time.Time
- func (tx *UnsignedAddValidatorTx) SyntacticVerify(ctx *snow.Context) error
- func (tx *UnsignedAddValidatorTx) Weight() uint64
- type UnsignedAdvanceTimeTx
- func (tx *UnsignedAdvanceTimeTx) Execute(vm *VM, parentState MutableState, stx *Tx) (VersionedState, VersionedState, error)
- func (tx *UnsignedAdvanceTimeTx) InitCtx(*snow.Context)
- func (tx *UnsignedAdvanceTimeTx) InitiallyPrefersCommit(vm *VM) bool
- func (tx *UnsignedAdvanceTimeTx) InputIDs() ids.Set
- func (tx *UnsignedAdvanceTimeTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
- func (tx *UnsignedAdvanceTimeTx) SyntacticVerify(*snow.Context) error
- func (tx *UnsignedAdvanceTimeTx) Timestamp() time.Time
- type UnsignedAtomicTx
- type UnsignedCreateChainTx
- func (tx *UnsignedCreateChainTx) AtomicOperations() (ids.ID, *atomic.Requests, error)
- func (tx *UnsignedCreateChainTx) Execute(vm *VM, vs VersionedState, stx *Tx) (func() error, error)
- func (tx *UnsignedCreateChainTx) InputUTXOs() ids.Set
- func (tx *UnsignedCreateChainTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
- func (tx *UnsignedCreateChainTx) SyntacticVerify(ctx *snow.Context) error
- type UnsignedCreateSubnetTx
- func (tx *UnsignedCreateSubnetTx) AtomicOperations() (ids.ID, *atomic.Requests, error)
- func (tx *UnsignedCreateSubnetTx) Execute(vm *VM, vs VersionedState, stx *Tx) (func() error, error)
- func (tx *UnsignedCreateSubnetTx) InitCtx(ctx *snow.Context)
- func (tx *UnsignedCreateSubnetTx) InputUTXOs() ids.Set
- func (tx *UnsignedCreateSubnetTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
- func (tx *UnsignedCreateSubnetTx) SyntacticVerify(ctx *snow.Context) error
- type UnsignedDecisionTx
- type UnsignedExportTx
- func (tx *UnsignedExportTx) AtomicAccept(ctx *snow.Context, batch database.Batch) error
- func (tx *UnsignedExportTx) AtomicExecute(vm *VM, parentState MutableState, stx *Tx) (VersionedState, error)
- func (tx *UnsignedExportTx) AtomicOperations() (ids.ID, *atomic.Requests, error)
- func (tx *UnsignedExportTx) Execute(vm *VM, vs VersionedState, stx *Tx) (func() error, error)
- func (tx *UnsignedExportTx) InitCtx(ctx *snow.Context)
- func (tx *UnsignedExportTx) InputUTXOs() ids.Set
- func (tx *UnsignedExportTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
- func (tx *UnsignedExportTx) SyntacticVerify(ctx *snow.Context) error
- type UnsignedImportTx
- func (tx *UnsignedImportTx) AtomicAccept(ctx *snow.Context, batch database.Batch) error
- func (tx *UnsignedImportTx) AtomicExecute(vm *VM, parentState MutableState, stx *Tx) (VersionedState, error)
- func (tx *UnsignedImportTx) AtomicOperations() (ids.ID, *atomic.Requests, error)
- func (tx *UnsignedImportTx) Execute(vm *VM, vs VersionedState, stx *Tx) (func() error, error)
- func (tx *UnsignedImportTx) InitCtx(ctx *snow.Context)
- func (tx *UnsignedImportTx) InputIDs() ids.Set
- func (tx *UnsignedImportTx) InputUTXOs() ids.Set
- func (tx *UnsignedImportTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
- func (tx *UnsignedImportTx) SyntacticVerify(ctx *snow.Context) error
- type UnsignedProposalTx
- type UnsignedRewardValidatorTx
- func (tx *UnsignedRewardValidatorTx) Execute(vm *VM, parentState MutableState, stx *Tx) (VersionedState, VersionedState, error)
- func (tx *UnsignedRewardValidatorTx) InitCtx(*snow.Context)
- func (tx *UnsignedRewardValidatorTx) InitiallyPrefersCommit(*VM) bool
- func (tx *UnsignedRewardValidatorTx) InputIDs() ids.Set
- func (tx *UnsignedRewardValidatorTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
- func (tx *UnsignedRewardValidatorTx) SyntacticVerify(*snow.Context) error
- type UnsignedTx
- type VM
- func (m *VM) AcceptBlock(b snowman.Block) error
- func (m *VM) AcceptTx(tx *Tx) error
- func (n VM) AppGossip(nodeID ids.ShortID, msgBytes []byte) error
- func (n VM) AppRequest(nodeID ids.ShortID, requestID uint32, deadline time.Time, msgBytes []byte) error
- func (n VM) AppRequestFailed(nodeID ids.ShortID, requestID uint32) error
- func (n VM) AppResponse(nodeID ids.ShortID, requestID uint32, msgBytes []byte) error
- func (vm *VM) BuildBlock() (snowman.Block, error)
- func (vm *VM) Clock() *mockable.Clock
- func (vm *VM) CodecRegistry() codec.Registry
- func (vm *VM) Connected(vdrID ids.ShortID, nodeVersion version.Application) error
- func (vm *VM) CreateHandlers() (map[string]*common.HTTPHandler, error)
- func (vm *VM) CreateStaticHandlers() (map[string]*common.HTTPHandler, error)
- func (vm *VM) Disconnected(vdrID ids.ShortID) error
- func (vm *VM) GetBlock(blkID ids.ID) (snowman.Block, error)
- func (vm *VM) GetCurrentHeight() (uint64, error)
- func (vm *VM) GetValidatorSet(height uint64, subnetID ids.ID) (map[ids.ShortID]uint64, error)
- func (n VM) GossipTx(tx *Tx) error
- func (vm *VM) HealthCheck() (interface{}, error)
- func (vm *VM) Initialize(ctx *snow.Context, dbManager manager.Manager, genesisBytes []byte, ...) error
- func (vm *VM) LastAccepted() (ids.ID, error)
- func (vm *VM) Logger() logging.Logger
- func (vm *VM) NotifyBlockReady()
- func (vm *VM) ParseBlock(b []byte) (snowman.Block, error)
- func (vm *VM) Preferred() (Block, error)
- func (vm *VM) SetPreference(blkID ids.ID) error
- func (vm *VM) SetState(state snow.State) error
- func (vm *VM) Shutdown() error
- func (vm *VM) Version() (string, error)
- type ValidatedByArgs
- type ValidatedByResponse
- type ValidatesArgs
- type ValidatesResponse
- type Validator
- type ValidatorState
- type ValidatorWeightDiff
- type VersionedState
Constants ¶
const (
// BatchSize is the number of decision transactions to place into a block
BatchSize = 30
)
const (
// CodecVersion is the current default codec version
CodecVersion = 0
)
const ( // MaxValidatorWeightFactor is the maximum factor of the validator stake // that is allowed to be placed on a validator. MaxValidatorWeightFactor uint64 = 5 )
Variables ¶
var ( Codec codec.Manager GenesisCodec codec.Manager )
Codecs do serialization and deserialization
Functions ¶
func CanDelegate ¶ added in v1.4.5
func CanDelegate( current, pending []*UnsignedAddDelegatorTx, new *UnsignedAddDelegatorTx, currentStake, maximumStake uint64, ) (bool, error)
CanDelegate returns if the [new] delegator can be added to a validator who has [current] and [pending] delegators. [currentStake] is the current amount of stake on the validator, include the [current] delegators. [maximumStake] is the maximum amount of stake that can be on the validator at any given time. It is assumed that the validator without adding [new] does not violate [maximumStake].
Types ¶
type APIBlockchain ¶
type APIBlockchain struct { // Blockchain's ID ID ids.ID `json:"id"` // Blockchain's (non-unique) human-readable name Name string `json:"name"` // Subnet that validates the blockchain SubnetID ids.ID `json:"subnetID"` // Virtual Machine the blockchain runs VMID ids.ID `json:"vmID"` }
APIBlockchain is the representation of a blockchain used in API calls
type APIChain ¶
type APIChain struct { GenesisData string `json:"genesisData"` VMID ids.ID `json:"vmID"` FxIDs []ids.ID `json:"fxIDs"` Name string `json:"name"` SubnetID ids.ID `json:"subnetID"` }
APIChain defines a chain that exists at the network's genesis. [GenesisData] is the initial state of the chain. [VMID] is the ID of the VM this chain runs. [FxIDs] are the IDs of the Fxs the chain supports. [Name] is a human-readable, non-unique name for the chain. [SubnetID] is the ID of the subnet that validates the chain
type APIOwner ¶ added in v0.8.0
type APIOwner struct { Locktime json.Uint64 `json:"locktime"` Threshold json.Uint32 `json:"threshold"` Addresses []string `json:"addresses"` }
APIOwner is the repr. of a reward owner sent over APIs.
type APIPrimaryDelegator ¶ added in v0.8.0
type APIPrimaryDelegator struct { APIStaker RewardOwner *APIOwner `json:"rewardOwner,omitempty"` PotentialReward *json.Uint64 `json:"potentialReward,omitempty"` }
APIPrimaryDelegator is the repr. of a primary network delegator sent over APIs.
type APIPrimaryValidator ¶ added in v0.8.0
type APIPrimaryValidator struct { APIStaker // The owner the staking reward, if applicable, will go to RewardOwner *APIOwner `json:"rewardOwner,omitempty"` PotentialReward *json.Uint64 `json:"potentialReward,omitempty"` DelegationFee json.Float32 `json:"delegationFee"` ExactDelegationFee *json.Uint32 `json:"exactDelegationFee,omitempty"` Uptime *json.Float32 `json:"uptime,omitempty"` Connected *bool `json:"connected,omitempty"` Staked []APIUTXO `json:"staked,omitempty"` // The delegators delegating to this validator Delegators []APIPrimaryDelegator `json:"delegators"` }
APIPrimaryValidator is the repr. of a primary network validator sent over APIs.
type APIStaker ¶ added in v0.8.0
type APIStaker struct { TxID ids.ID `json:"txID"` StartTime json.Uint64 `json:"startTime"` EndTime json.Uint64 `json:"endTime"` Weight *json.Uint64 `json:"weight,omitempty"` StakeAmount *json.Uint64 `json:"stakeAmount,omitempty"` NodeID string `json:"nodeID"` }
APIStaker is the representation of a staker sent via APIs. [TxID] is the txID of the transaction that added this staker. [Amount] is the amount of tokens being staked. [StartTime] is the Unix time when they start staking [Endtime] is the Unix time repr. of when they are done staking [NodeID] is the node ID of the staker
type APISubnet ¶
type APISubnet struct { // ID of the subnet ID ids.ID `json:"id"` // Each element of [ControlKeys] the address of a public key. // A transaction to add a validator to this subnet requires // signatures from [Threshold] of these keys to be valid. ControlKeys []string `json:"controlKeys"` Threshold json.Uint32 `json:"threshold"` }
APISubnet is a representation of a subnet used in API calls
type APIUTXO ¶ added in v0.8.0
type APIUTXO struct { Locktime json.Uint64 `json:"locktime"` Amount json.Uint64 `json:"amount"` Address string `json:"address"` Message string `json:"message"` }
APIUTXO is a UTXO on the Platform Chain that exists at the chain's genesis.
type AbortBlock ¶ added in v1.4.5
type AbortBlock struct { DoubleDecisionBlock `serialize:"true"` // contains filtered or unexported fields }
AbortBlock being accepted results in the proposal of its parent (which must be a proposal block) being rejected.
func (*AbortBlock) Accept ¶ added in v1.6.4
func (a *AbortBlock) Accept() error
func (*AbortBlock) Verify ¶ added in v1.4.5
func (a *AbortBlock) Verify() error
Verify this block performs a valid state transition.
The parent block must be a proposal ¶
This function also sets onAcceptState if the verification passes.
type AddDelegatorArgs ¶ added in v0.8.0
type AddDelegatorArgs struct { // User, password, from addrs, change addr api.JSONSpendHeader APIStaker RewardAddress string `json:"rewardAddress"` }
AddDelegatorArgs are the arguments to AddDelegator
type AddSubnetValidatorArgs ¶ added in v0.8.0
type AddSubnetValidatorArgs struct { // User, password, from addrs, change addr api.JSONSpendHeader APIStaker // ID of subnet to validate SubnetID string `json:"subnetID"` }
AddSubnetValidatorArgs are the arguments to AddSubnetValidator
type AddValidatorArgs ¶ added in v0.8.0
type AddValidatorArgs struct { // User, password, from addrs, change addr api.JSONSpendHeader APIStaker // The address the staking reward, if applicable, will go to RewardAddress string `json:"rewardAddress"` DelegationFeeRate json.Float32 `json:"delegationFeeRate"` }
AddValidatorArgs are the arguments to AddValidator
type AtomicBlock ¶
type AtomicBlock struct { CommonDecisionBlock `serialize:"true"` Tx Tx `serialize:"true" json:"tx"` // contains filtered or unexported fields }
AtomicBlock being accepted results in the atomic transaction contained in the block to be accepted and committed to the chain.
func (*AtomicBlock) Accept ¶
func (ab *AtomicBlock) Accept() error
func (*AtomicBlock) Reject ¶ added in v1.0.2
func (ab *AtomicBlock) Reject() error
func (*AtomicBlock) Verify ¶
func (ab *AtomicBlock) Verify() error
Verify this block performs a valid state transition.
The parent block must be a decision block ¶
This function also sets onAcceptDB database if the verification passes.
type BaseTx ¶ added in v0.8.0
type BaseTx struct { avax.BaseTx `serialize:"true" json:"inputs"` // contains filtered or unexported fields }
BaseTx contains fields common to many transaction types. It should be embedded in transaction implementations.
type BuildGenesisArgs ¶
type BuildGenesisArgs struct { AvaxAssetID ids.ID `json:"avaxAssetID"` NetworkID json.Uint32 `json:"networkID"` UTXOs []APIUTXO `json:"utxos"` Validators []APIPrimaryValidator `json:"validators"` Chains []APIChain `json:"chains"` Time json.Uint64 `json:"time"` InitialSupply json.Uint64 `json:"initialSupply"` Message string `json:"message"` Encoding formatting.Encoding `json:"encoding"` }
BuildGenesisArgs are the arguments used to create the genesis data of the Platform Chain. [NetworkID] is the ID of the network [UTXOs] are the UTXOs on the Platform Chain that exist at genesis. [Validators] are the validators of the primary network at genesis. [Chains] are the chains that exist at genesis. [Time] is the Platform Chain's time at network genesis.
type BuildGenesisReply ¶
type BuildGenesisReply struct { Bytes string `json:"bytes"` Encoding formatting.Encoding `json:"encoding"` }
BuildGenesisReply is the reply from BuildGenesis
type Client ¶ added in v1.0.6
type Client interface { // GetHeight returns the current block height of the P Chain GetHeight(ctx context.Context) (uint64, error) // ExportKey returns the private key corresponding to [address] from [user]'s account ExportKey(ctx context.Context, user api.UserPass, address string) (string, error) // ImportKey imports the specified [privateKey] to [user]'s keystore ImportKey(ctx context.Context, user api.UserPass, address string) (string, error) // GetBalance returns the balance of [address] on the P Chain GetBalance(ctx context.Context, addrs []string) (*GetBalanceResponse, error) // CreateAddress creates a new address for [user] CreateAddress(ctx context.Context, user api.UserPass) (string, error) // ListAddresses returns an array of platform addresses controlled by [user] ListAddresses(ctx context.Context, user api.UserPass) ([]string, error) // GetUTXOs returns the byte representation of the UTXOs controlled by [addrs] GetUTXOs( ctx context.Context, addrs []string, limit uint32, startAddress, startUTXOID string, ) ([][]byte, api.Index, error) // GetAtomicUTXOs returns the byte representation of the atomic UTXOs controlled by [addresses] // from [sourceChain] GetAtomicUTXOs( ctx context.Context, addrs []string, sourceChain string, limit uint32, startAddress, startUTXOID string, ) ([][]byte, api.Index, error) // GetSubnets returns information about the specified subnets GetSubnets(context.Context, []ids.ID) ([]APISubnet, error) // GetStakingAssetID returns the assetID of the asset used for staking on // subnet corresponding to [subnetID] GetStakingAssetID(context.Context, ids.ID) (ids.ID, error) // GetCurrentValidators returns the list of current validators for subnet with ID [subnetID] GetCurrentValidators(ctx context.Context, subnetID ids.ID, nodeIDs []ids.ShortID) ([]interface{}, error) // GetPendingValidators returns the list of pending validators for subnet with ID [subnetID] GetPendingValidators(ctx context.Context, subnetID ids.ID, nodeIDs []ids.ShortID) ([]interface{}, []interface{}, error) // GetCurrentSupply returns an upper bound on the supply of AVAX in the system GetCurrentSupply(ctx context.Context) (uint64, error) // SampleValidators returns the nodeIDs of a sample of [sampleSize] validators from the current validator set for subnet with ID [subnetID] SampleValidators(ctx context.Context, subnetID ids.ID, sampleSize uint16) ([]string, error) // AddValidator issues a transaction to add a validator to the primary network // and returns the txID AddValidator( ctx context.Context, user api.UserPass, from []string, changeAddr string, rewardAddress, nodeID string, stakeAmount, startTime, endTime uint64, delegationFeeRate float32, ) (ids.ID, error) // AddDelegator issues a transaction to add a delegator to the primary network // and returns the txID AddDelegator( ctx context.Context, user api.UserPass, from []string, changeAddr string, rewardAddress, nodeID string, stakeAmount, startTime, endTime uint64, ) (ids.ID, error) // AddSubnetValidator issues a transaction to add validator [nodeID] to subnet // with ID [subnetID] and returns the txID AddSubnetValidator( ctx context.Context, user api.UserPass, from []string, changeAddr string, subnetID, nodeID string, stakeAmount, startTime, endTime uint64, ) (ids.ID, error) // CreateSubnet issues a transaction to create [subnet] and returns the txID CreateSubnet( ctx context.Context, user api.UserPass, from []string, changeAddr string, controlKeys []string, threshold uint32, ) (ids.ID, error) // ExportAVAX issues an ExportTx transaction and returns the txID ExportAVAX( ctx context.Context, user api.UserPass, from []string, changeAddr string, to string, amount uint64, ) (ids.ID, error) // ImportAVAX issues an ImportTx transaction and returns the txID ImportAVAX( ctx context.Context, user api.UserPass, from []string, changeAddr, to, sourceChain string, ) (ids.ID, error) // CreateBlockchain issues a CreateBlockchain transaction and returns the txID CreateBlockchain( ctx context.Context, user api.UserPass, from []string, changeAddr string, subnetID ids.ID, vmID string, fxIDs []string, name string, genesisData []byte, ) (ids.ID, error) // GetBlockchainStatus returns the current status of blockchain with ID: [blockchainID] GetBlockchainStatus(ctx context.Context, blockchainID string) (status.BlockchainStatus, error) // ValidatedBy returns the ID of the Subnet that validates [blockchainID] ValidatedBy(ctx context.Context, blockchainID ids.ID) (ids.ID, error) // Validates returns the list of blockchains that are validated by the subnet with ID [subnetID] Validates(ctx context.Context, subnetID ids.ID) ([]ids.ID, error) // GetBlockchains returns the list of blockchains on the platform GetBlockchains(ctx context.Context) ([]APIBlockchain, error) // IssueTx issues the transaction and returns its txID IssueTx(ctx context.Context, tx []byte) (ids.ID, error) // GetTx returns the byte representation of the transaction corresponding to [txID] GetTx(ctx context.Context, txID ids.ID) ([]byte, error) // GetTxStatus returns the status of the transaction corresponding to [txID] GetTxStatus(ctx context.Context, txID ids.ID, includeReason bool) (*GetTxStatusResponse, error) // GetStake returns the amount of nAVAX that [addresses] have cumulatively // staked on the Primary Network. GetStake(ctx context.Context, addrs []string) (*GetStakeReply, error) // GetMinStake returns the minimum staking amount in nAVAX for validators // and delegators respectively GetMinStake(ctx context.Context) (uint64, uint64, error) // GetTotalStake returns the total amount (in nAVAX) staked on the network GetTotalStake(ctx context.Context) (uint64, error) // GetMaxStakeAmount returns the maximum amount of nAVAX staking to the named // node during the time period. GetMaxStakeAmount(ctx context.Context, subnetID ids.ID, nodeID string, startTime uint64, endTime uint64) (uint64, error) // GetRewardUTXOs returns the reward UTXOs for a transaction GetRewardUTXOs(context.Context, *api.GetTxArgs) ([][]byte, error) // GetTimestamp returns the current chain timestamp GetTimestamp(ctx context.Context) (time.Time, error) // GetValidatorsAt returns the weights of the validator set of a provided subnet // at the specified height. GetValidatorsAt(ctx context.Context, subnetID ids.ID, height uint64) (map[string]uint64, error) }
Client interface for interacting with the P Chain endpoint
type CommitBlock ¶ added in v1.4.5
type CommitBlock struct { DoubleDecisionBlock `serialize:"true"` // contains filtered or unexported fields }
CommitBlock being accepted results in the proposal of its parent (which must be a proposal block) being enacted.
func (*CommitBlock) Accept ¶ added in v1.6.4
func (c *CommitBlock) Accept() error
func (*CommitBlock) Verify ¶ added in v1.4.5
func (c *CommitBlock) Verify() error
Verify this block performs a valid state transition.
The parent block must be a proposal ¶
This function also sets onAcceptState if the verification passes.
type CommonBlock ¶
type CommonBlock struct { PrntID ids.ID `serialize:"true" json:"parentID"` // parent's ID Hght uint64 `serialize:"true" json:"height"` // This block's height. The genesis block is at height 0. // contains filtered or unexported fields }
CommonBlock contains fields and methods common to all blocks in this VM.
func (*CommonBlock) Accept ¶ added in v1.4.5
func (b *CommonBlock) Accept() error
func (*CommonBlock) Bytes ¶ added in v1.4.5
func (b *CommonBlock) Bytes() []byte
Bytes returns the binary representation of this block
func (*CommonBlock) Height ¶ added in v1.4.5
func (b *CommonBlock) Height() uint64
Height returns this block's height. The genesis block has height 0.
func (*CommonBlock) ID ¶ added in v1.4.5
func (b *CommonBlock) ID() ids.ID
ID returns the ID of this block
func (*CommonBlock) Parent ¶
func (b *CommonBlock) Parent() ids.ID
Parent returns this block's parent's ID
func (*CommonBlock) Reject ¶
func (b *CommonBlock) Reject() error
func (*CommonBlock) Status ¶ added in v1.4.5
func (b *CommonBlock) Status() choices.Status
Status returns the status of this block
func (*CommonBlock) Timestamp ¶ added in v1.5.3
func (b *CommonBlock) Timestamp() time.Time
Timestamp returns this block's time.
func (*CommonBlock) Verify ¶ added in v1.2.2
func (b *CommonBlock) Verify() error
type CommonDecisionBlock ¶
type CommonDecisionBlock struct { CommonBlock `serialize:"true"` // contains filtered or unexported fields }
CommonDecisionBlock contains the fields and methods common to all decision blocks
func (*CommonDecisionBlock) Reject ¶ added in v1.4.5
func (cdb *CommonDecisionBlock) Reject() error
type CreateBlockchainArgs ¶
type CreateBlockchainArgs struct { // User, password, from addrs, change addr api.JSONSpendHeader // ID of Subnet that validates the new blockchain SubnetID ids.ID `json:"subnetID"` // ID of the VM the new blockchain is running VMID string `json:"vmID"` // IDs of the FXs the VM is running FxIDs []string `json:"fxIDs"` // Human-readable name for the new blockchain, not necessarily unique Name string `json:"name"` // Genesis state of the blockchain being created GenesisData string `json:"genesisData"` // Encoding format to use for genesis data Encoding formatting.Encoding `json:"encoding"` }
CreateBlockchainArgs is the arguments for calling CreateBlockchain
type CreateSubnetArgs ¶
type CreateSubnetArgs struct { // User, password, from addrs, change addr api.JSONSpendHeader // The ID member of APISubnet is ignored APISubnet }
CreateSubnetArgs are the arguments to CreateSubnet
type DoubleDecisionBlock ¶ added in v0.8.0
type DoubleDecisionBlock struct {
CommonDecisionBlock `serialize:"true"`
}
DoubleDecisionBlock contains the accept for a pair of blocks
func (*DoubleDecisionBlock) Accept ¶ added in v0.8.0
func (ddb *DoubleDecisionBlock) Accept() error
Accept implements the snowman.Block interface
type ExportAVAXArgs ¶ added in v0.8.0
type ExportAVAXArgs struct { // User, password, from addrs, change addr api.JSONSpendHeader // Amount of AVAX to send Amount json.Uint64 `json:"amount"` // ID of the address that will receive the AVAX. This address includes the // chainID, which is used to determine what the destination chain is. To string `json:"to"` }
ExportAVAXArgs are the arguments to ExportAVAX
type ExportKeyArgs ¶ added in v0.8.0
ExportKeyArgs are arguments for ExportKey
type ExportKeyReply ¶ added in v0.8.0
type ExportKeyReply struct { // The decrypted PrivateKey for the Address provided in the arguments PrivateKey string `json:"privateKey"` }
ExportKeyReply is the response for ExportKey
type Factory ¶
type Factory struct { // The node's chain manager Chains chains.Manager // Node's validator set maps subnetID -> validators of the subnet Validators validators.Manager // Provides access to the uptime manager as a thread safe data structure UptimeLockedCalculator uptime.LockedCalculator // True if the node is being run with staking enabled StakingEnabled bool // Set of subnets that this node is validating WhitelistedSubnets ids.Set // Fee that must be burned by every create staker transaction AddStakerTxFee uint64 // Fee that is burned by every non-state creating transaction TxFee uint64 // Fee that must be burned by every state creating transaction before AP3 CreateAssetTxFee uint64 // Fee that must be burned by every subnet creating transaction after AP3 CreateSubnetTxFee uint64 // Fee that must be burned by every blockchain creating transaction after AP3 CreateBlockchainTxFee uint64 // The minimum amount of tokens one must bond to be a validator MinValidatorStake uint64 // The maximum amount of tokens that can be bonded on a validator MaxValidatorStake uint64 // Minimum stake, in nAVAX, that can be delegated on the primary network MinDelegatorStake uint64 // Minimum fee that can be charged for delegation MinDelegationFee uint32 // UptimePercentage is the minimum uptime required to be rewarded for staking UptimePercentage float64 // Minimum amount of time to allow a staker to stake MinStakeDuration time.Duration // Maximum amount of time to allow a staker to stake MaxStakeDuration time.Duration // Config for the minting function RewardConfig reward.Config // Time of the AP3 network upgrade ApricotPhase3Time time.Time // Time of the AP4 network upgrade ApricotPhase4Time time.Time // Time of the AP5 network upgrade ApricotPhase5Time time.Time }
Factory can create new instances of the Platform Chain
type Fx ¶ added in v0.8.0
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 // Notify this Fx that the VM is in bootstrapping Bootstrapping() error // Notify this Fx that the VM is bootstrapped Bootstrapped() 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 // VerifyPermission returns nil iff [cred] proves that [controlGroup] // assents to [tx] VerifyPermission(tx, in, cred, controlGroup interface{}) error // CreateOutput creates a new output with the provided control group worth // the specified amount CreateOutput(amount uint64, controlGroup interface{}) (interface{}, error) }
Fx is the interface a feature extension must implement to support the Platform Chain.
type Genesis ¶
type Genesis struct { UTXOs []*GenesisUTXO `serialize:"true"` Validators []*Tx `serialize:"true"` Chains []*Tx `serialize:"true"` Timestamp uint64 `serialize:"true"` InitialSupply uint64 `serialize:"true"` Message string `serialize:"true"` }
Genesis represents a genesis state of the platform chain
func (*Genesis) Initialize ¶
type GenesisUTXO ¶ added in v1.0.0
type GenesisUTXO struct { avax.UTXO `serialize:"true"` Message []byte `serialize:"true" json:"message"` }
GenesisUTXO adds messages to UTXOs
type GetBalanceRequest ¶ added in v1.7.4
type GetBalanceResponse ¶ added in v0.8.0
type GetBlockchainStatusArgs ¶
type GetBlockchainStatusArgs struct {
BlockchainID string `json:"blockchainID"`
}
GetBlockchainStatusArgs is the arguments for calling GetBlockchainStatus [BlockchainID] is the ID of or an alias of the blockchain to get the status of.
type GetBlockchainStatusReply ¶
type GetBlockchainStatusReply struct {
Status status.BlockchainStatus `json:"status"`
}
GetBlockchainStatusReply is the reply from calling GetBlockchainStatus [Status] is the blockchain's status.
type GetBlockchainsResponse ¶
type GetBlockchainsResponse struct { // blockchains that exist Blockchains []APIBlockchain `json:"blockchains"` }
GetBlockchainsResponse is the response from a call to GetBlockchains
type GetCurrentSupplyReply ¶ added in v0.8.0
GetCurrentSupplyReply are the results from calling GetCurrentSupply
type GetCurrentValidatorsArgs ¶
type GetCurrentValidatorsArgs struct { // Subnet we're listing the validators of // If omitted, defaults to primary network SubnetID ids.ID `json:"subnetID"` // NodeIDs of validators to request. If [NodeIDs] // is empty, it fetches all current validators. If // some nodeIDs are not currently validators, they // will be omitted from the response. NodeIDs []string `json:"nodeIDs"` }
GetCurrentValidatorsArgs are the arguments for calling GetCurrentValidators
type GetCurrentValidatorsReply ¶
type GetCurrentValidatorsReply struct {
Validators []interface{} `json:"validators"`
}
GetCurrentValidatorsReply are the results from calling GetCurrentValidators. Each validator contains a list of delegators to itself.
type GetHeightResponse ¶ added in v0.8.0
type GetMaxStakeAmountArgs ¶ added in v1.0.0
type GetMaxStakeAmountArgs struct { SubnetID ids.ID `json:"subnetID"` NodeID string `json:"nodeID"` StartTime json.Uint64 `json:"startTime"` EndTime json.Uint64 `json:"endTime"` }
GetMaxStakeAmountArgs is the request for calling GetMaxStakeAmount.
type GetMaxStakeAmountReply ¶ added in v1.0.0
GetMaxStakeAmountReply is the response from calling GetMaxStakeAmount.
type GetMinStakeReply ¶ added in v0.8.0
type GetMinStakeReply struct { // The minimum amount of tokens one must bond to be a validator MinValidatorStake json.Uint64 `json:"minValidatorStake"` // Minimum stake, in nAVAX, that can be delegated on the primary network MinDelegatorStake json.Uint64 `json:"minDelegatorStake"` }
GetMinStakeReply is the response from calling GetMinStake.
type GetPendingValidatorsArgs ¶
type GetPendingValidatorsArgs struct { // Subnet we're getting the pending validators of // If omitted, defaults to primary network SubnetID ids.ID `json:"subnetID"` // NodeIDs of validators to request. If [NodeIDs] // is empty, it fetches all pending validators. If // some requested nodeIDs are not pending validators, // they are omitted from the response. NodeIDs []string `json:"nodeIDs"` }
GetPendingValidatorsArgs are the arguments for calling GetPendingValidators
type GetPendingValidatorsReply ¶
type GetPendingValidatorsReply struct { Validators []interface{} `json:"validators"` Delegators []interface{} `json:"delegators"` }
GetPendingValidatorsReply are the results from calling GetPendingValidators. Unlike GetCurrentValidatorsReply, each validator has a null delegator list.
type GetRewardUTXOsReply ¶ added in v1.4.5
type GetRewardUTXOsReply struct { // Number of UTXOs returned NumFetched json.Uint64 `json:"numFetched"` // The UTXOs UTXOs []string `json:"utxos"` // Encoding specifies the encoding format the UTXOs are returned in Encoding formatting.Encoding `json:"encoding"` }
GetRewardUTXOsReply defines the GetRewardUTXOs replies returned from the API
type GetStakeArgs ¶ added in v1.2.1
type GetStakeArgs struct { api.JSONAddresses Encoding formatting.Encoding `json:"encoding"` }
type GetStakeReply ¶ added in v0.8.0
type GetStakeReply struct { Staked json.Uint64 `json:"staked"` // String representation of staked outputs // Each is of type avax.TransferableOutput Outputs []string `json:"stakedOutputs"` // Encoding of [Outputs] Encoding formatting.Encoding `json:"encoding"` }
GetStakeReply is the response from calling GetStake.
type GetStakingAssetIDArgs ¶ added in v0.8.0
GetStakingAssetIDArgs are the arguments to GetStakingAssetID
type GetStakingAssetIDResponse ¶ added in v0.8.0
GetStakingAssetIDResponse is the response from calling GetStakingAssetID
type GetSubnetsArgs ¶
type GetSubnetsArgs struct { // IDs of the subnets to retrieve information about // If omitted, gets all subnets IDs []ids.ID `json:"ids"` }
GetSubnetsArgs are the arguments to GetSubnet
type GetSubnetsResponse ¶
type GetSubnetsResponse struct { // Each element is a subnet that exists // Null if there are no subnets other than the primary network Subnets []APISubnet `json:"subnets"` }
GetSubnetsResponse is the response from calling GetSubnets
type GetTimestampReply ¶ added in v1.5.1
GetTimestampReply is the response from GetTimestamp
type GetTotalStakeReply ¶ added in v1.0.6
GetTotalStakeReply is the response from calling GetTotalStake.
type GetTxStatusArgs ¶ added in v0.8.0
type GetTxStatusArgs struct { TxID ids.ID `json:"txID"` // If IncludeReason is false returns a response that looks like: // { // "jsonrpc": "2.0", // "result": "Dropped", // "id": 1 // } // If IncludeReason is true returns a response that looks like this: // { // "jsonrpc": "2.0", // "result": { // "status":"[Status]", // "reason":"[Reason tx was dropped, if applicable]" // }, // "id": 1 // } // In the latter, "reason" is only present if the status is dropped IncludeReason bool `json:"includeReason"` }
type GetTxStatusResponse ¶ added in v1.0.4
type GetUTXOsArgs ¶ added in v0.8.0
type GetUTXOsArgs struct { Addresses []string `json:"addresses"` SourceChain string `json:"sourceChain"` Limit json.Uint32 `json:"limit"` StartIndex Index `json:"startIndex"` Encoding formatting.Encoding `json:"encoding"` }
GetUTXOsArgs are arguments for passing into GetUTXOs. Gets the UTXOs that reference at least one address in [Addresses]. If specified, [SourceChain] is the chain where the atomic UTXOs were exported from. If empty, or the Platform Chain ID is specified, then GetUTXOs fetches the native UTXOs. Returns at most [limit] addresses. If [limit] == 0 or > [maxUTXOsToFetch], fetches up to [maxUTXOsToFetch]. [StartIndex] defines where to start fetching UTXOs (for pagination.) UTXOs fetched are from addresses equal to or greater than [StartIndex.Address] For address [StartIndex.Address], only UTXOs with IDs greater than [StartIndex.UTXO] will be returned. If [StartIndex] is omitted, gets all UTXOs. If GetUTXOs is called multiple times, with our without [StartIndex], it is not guaranteed that returned UTXOs are unique. That is, the same UTXO may appear in the response of multiple calls. [Encoding] defines the encoding format to use for the returned UTXOs. Can be either "cb58" or "hex"
type GetUTXOsResponse ¶ added in v0.8.0
type GetUTXOsResponse struct { // Number of UTXOs returned NumFetched json.Uint64 `json:"numFetched"` // The UTXOs UTXOs []string `json:"utxos"` // The last UTXO that was returned, and the address it corresponds to. // Used for pagination. To get the rest of the UTXOs, call GetUTXOs // again and set [StartIndex] to this value. EndIndex Index `json:"endIndex"` // Encoding specifies the format the UTXOs are returned in Encoding formatting.Encoding `json:"encoding"` }
GetUTXOsResponse defines the GetUTXOs replies returned from the API
type GetValidatorsAtArgs ¶ added in v1.5.3
type GetValidatorsAtArgs struct { Height json.Uint64 `json:"height"` SubnetID ids.ID `json:"subnetID"` }
GetValidatorsAtArgs is the response from GetValidatorsAt
type GetValidatorsAtReply ¶ added in v1.5.3
GetValidatorsAtReply is the response from GetValidatorsAt
type ImportAVAXArgs ¶ added in v0.8.0
type ImportAVAXArgs struct { // User, password, from addrs, change addr api.JSONSpendHeader // Chain the funds are coming from SourceChain string `json:"sourceChain"` // The address that will receive the imported funds To string `json:"to"` }
ImportAVAXArgs are the arguments to ImportAVAX
type ImportKeyArgs ¶ added in v0.8.0
ImportKeyArgs are arguments for ImportKey
type Index ¶ added in v0.8.0
type Index struct { Address string `json:"address"` // The address as a string UTXO string `json:"utxo"` // The UTXO ID as a string }
Index is an address and an associated UTXO. Marks a starting or stopping point when fetching UTXOs. Used for pagination.
type InternalState ¶ added in v1.4.5
type InternalState interface { MutableState uptime.State avax.UTXOReader SetHeight(height uint64) AddCurrentStaker(tx *Tx, potentialReward uint64) DeleteCurrentStaker(tx *Tx) GetValidatorWeightDiffs(height uint64, subnetID ids.ID) (map[ids.ShortID]*ValidatorWeightDiff, error) AddPendingStaker(tx *Tx) DeletePendingStaker(tx *Tx) SetCurrentStakerChainState(currentStakerChainState) SetPendingStakerChainState(pendingStakerChainState) GetLastAccepted() ids.ID SetLastAccepted(ids.ID) GetBlock(blockID ids.ID) (Block, error) AddBlock(block Block) Abort() Commit() error CommitBatch() (database.Batch, error) Close() error }
func NewInternalState ¶ added in v1.4.5
func NewMeteredInternalState ¶ added in v1.4.5
func NewMeteredInternalState(vm *VM, db database.Database, genesis []byte, metrics prometheus.Registerer) (InternalState, error)
type Mempool ¶ added in v1.0.2
type Mempool interface { Add(tx *Tx) error Has(txID ids.ID) bool Get(txID ids.ID) *Tx AddDecisionTx(tx *Tx) AddProposalTx(tx *Tx) HasDecisionTxs() bool HasProposalTx() bool RemoveDecisionTxs(txs []*Tx) RemoveProposalTx(tx *Tx) PopDecisionTxs(numTxs int) []*Tx PopProposalTx() *Tx MarkDropped(txID ids.ID) WasDropped(txID ids.ID) bool }
func NewMempool ¶ added in v1.6.0
func NewMempool(namespace string, registerer prometheus.Registerer) (Mempool, error)
type MutableState ¶ added in v1.4.5
type MutableState interface { UTXOState ValidatorState AddRewardUTXO(txID ids.ID, utxo *avax.UTXO) GetRewardUTXOs(txID ids.ID) ([]*avax.UTXO, error) GetTimestamp() time.Time SetTimestamp(time.Time) GetCurrentSupply() uint64 SetCurrentSupply(uint64) GetSubnets() ([]*Tx, error) AddSubnet(createSubnetTx *Tx) GetChains(subnetID ids.ID) ([]*Tx, error) AddChain(createChainTx *Tx) GetTx(txID ids.ID) (*Tx, status.Status, error) AddTx(tx *Tx, status status.Status) }
type Owner ¶ added in v1.6.0
type Owner interface { verify.Verifiable snow.ContextInitializable }
type ProposalBlock ¶
type ProposalBlock struct { CommonBlock `serialize:"true"` Tx Tx `serialize:"true" json:"tx"` // contains filtered or unexported fields }
ProposalBlock is a proposal to change the chain's state.
A proposal may be to:
- Advance the chain's timestamp (*AdvanceTimeTx)
- Remove a staker from the staker set (*RewardStakerTx)
- Add a new staker to the set of pending (future) stakers (*AddValidatorTx, *AddDelegatorTx, *AddSubnetValidatorTx)
The proposal will be enacted (change the chain's state) if the proposal block is accepted and followed by an accepted Commit block
func (*ProposalBlock) Accept ¶ added in v0.8.0
func (pb *ProposalBlock) Accept() error
func (*ProposalBlock) Options ¶
func (pb *ProposalBlock) Options() ([2]snowman.Block, error)
Options returns the possible children of this block in preferential order.
func (*ProposalBlock) Reject ¶ added in v1.0.2
func (pb *ProposalBlock) Reject() error
Reject implements the snowman.Block interface
func (*ProposalBlock) Verify ¶
func (pb *ProposalBlock) Verify() error
Verify this block is valid.
The parent block must either be a Commit or an Abort block.
If this block is valid, this function also sets pas.onCommit and pas.onAbort.
type SampleValidatorsArgs ¶
type SampleValidatorsArgs struct { // Number of validators in the sample Size json.Uint16 `json:"size"` // ID of subnet to sample validators from // If omitted, defaults to the primary network SubnetID ids.ID `json:"subnetID"` }
SampleValidatorsArgs are the arguments for calling SampleValidators
type SampleValidatorsReply ¶
type SampleValidatorsReply struct {
Validators []string `json:"validators"`
}
SampleValidatorsReply are the results from calling Sample
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service defines the API calls that can be made to the platform chain
func (*Service) AddDelegator ¶ added in v0.8.0
func (service *Service) AddDelegator(_ *http.Request, args *AddDelegatorArgs, reply *api.JSONTxIDChangeAddr) error
AddDelegator creates and signs and issues a transaction to add a delegator to the primary network
func (*Service) AddSubnetValidator ¶ added in v0.8.0
func (service *Service) AddSubnetValidator(_ *http.Request, args *AddSubnetValidatorArgs, response *api.JSONTxIDChangeAddr) error
AddSubnetValidator creates and signs and issues a transaction to add a validator to a subnet other than the primary network
func (*Service) AddValidator ¶ added in v0.8.0
func (service *Service) AddValidator(_ *http.Request, args *AddValidatorArgs, reply *api.JSONTxIDChangeAddr) error
AddValidator creates and signs and issues a transaction to add a validator to the primary network
func (*Service) CreateAddress ¶ added in v0.8.0
func (service *Service) CreateAddress(_ *http.Request, args *api.UserPass, response *api.JSONAddress) error
CreateAddress creates an address controlled by [args.Username] Returns the newly created address
func (*Service) CreateBlockchain ¶
func (service *Service) CreateBlockchain(_ *http.Request, args *CreateBlockchainArgs, response *api.JSONTxIDChangeAddr) error
CreateBlockchain issues a transaction to create a new blockchain
func (*Service) CreateSubnet ¶
func (service *Service) CreateSubnet(_ *http.Request, args *CreateSubnetArgs, response *api.JSONTxIDChangeAddr) error
CreateSubnet creates and signs and issues a transaction to create a new subnet
func (*Service) ExportAVAX ¶ added in v0.8.0
func (service *Service) ExportAVAX(_ *http.Request, args *ExportAVAXArgs, response *api.JSONTxIDChangeAddr) error
ExportAVAX exports AVAX from the P-Chain to the X-Chain It must be imported on the X-Chain to complete the transfer
func (*Service) ExportKey ¶ added in v0.8.0
func (service *Service) ExportKey(r *http.Request, args *ExportKeyArgs, reply *ExportKeyReply) error
ExportKey returns a private key from the provided user
func (*Service) GetBalance ¶ added in v0.8.0
func (service *Service) GetBalance(_ *http.Request, args *GetBalanceRequest, response *GetBalanceResponse) error
GetBalance gets the balance of an address
func (*Service) GetBlockchainStatus ¶
func (service *Service) GetBlockchainStatus(_ *http.Request, args *GetBlockchainStatusArgs, reply *GetBlockchainStatusReply) error
GetBlockchainStatus gets the status of a blockchain with the ID [args.BlockchainID].
func (*Service) GetBlockchains ¶
func (service *Service) GetBlockchains(_ *http.Request, args *struct{}, response *GetBlockchainsResponse) error
GetBlockchains returns all of the blockchains that exist
func (*Service) GetCurrentSupply ¶ added in v0.8.0
func (service *Service) GetCurrentSupply(_ *http.Request, _ *struct{}, reply *GetCurrentSupplyReply) error
GetCurrentSupply returns an upper bound on the supply of AVAX in the system
func (*Service) GetCurrentValidators ¶
func (service *Service) GetCurrentValidators(_ *http.Request, args *GetCurrentValidatorsArgs, reply *GetCurrentValidatorsReply) error
GetCurrentValidators returns current validators and delegators
func (*Service) GetHeight ¶ added in v0.8.0
func (service *Service) GetHeight(r *http.Request, args *struct{}, response *GetHeightResponse) error
GetHeight returns the height of the last accepted block
func (*Service) GetMaxStakeAmount ¶ added in v1.0.0
func (service *Service) GetMaxStakeAmount(_ *http.Request, args *GetMaxStakeAmountArgs, reply *GetMaxStakeAmountReply) error
GetMaxStakeAmount returns the maximum amount of nAVAX staking to the named node during the time period.
func (*Service) GetMinStake ¶ added in v0.8.0
func (service *Service) GetMinStake(_ *http.Request, _ *struct{}, reply *GetMinStakeReply) error
GetMinStake returns the minimum staking amount in nAVAX.
func (*Service) GetPendingValidators ¶
func (service *Service) GetPendingValidators(_ *http.Request, args *GetPendingValidatorsArgs, reply *GetPendingValidatorsReply) error
GetPendingValidators returns the list of pending validators
func (*Service) GetRewardUTXOs ¶ added in v1.4.5
func (service *Service) GetRewardUTXOs(_ *http.Request, args *api.GetTxArgs, reply *GetRewardUTXOsReply) error
GetRewardUTXOs returns the UTXOs that were rewarded after the provided transaction's staking period ended.
func (*Service) GetStake ¶ added in v0.8.0
func (service *Service) GetStake(_ *http.Request, args *GetStakeArgs, response *GetStakeReply) error
GetStake returns the amount of nAVAX that [args.Addresses] have cumulatively staked on the Primary Network.
This method assumes that each stake output has only owner This method assumes only AVAX can be staked This method only concerns itself with the Primary Network, not subnets TODO: Improve the performance of this method by maintaining this data in a data structure rather than re-calculating it by iterating over stakers
func (*Service) GetStakingAssetID ¶ added in v0.8.0
func (service *Service) GetStakingAssetID(_ *http.Request, args *GetStakingAssetIDArgs, response *GetStakingAssetIDResponse) error
GetStakingAssetID returns the assetID of the token used to stake on the provided subnet
func (*Service) GetSubnets ¶
func (service *Service) GetSubnets(_ *http.Request, args *GetSubnetsArgs, response *GetSubnetsResponse) error
GetSubnets returns the subnets whose ID are in [args.IDs] The response will include the primary network
func (*Service) GetTimestamp ¶ added in v1.5.1
func (service *Service) GetTimestamp(_ *http.Request, args *struct{}, reply *GetTimestampReply) error
GetTimestamp returns the current timestamp on chain.
func (*Service) GetTotalStake ¶ added in v1.0.3
func (service *Service) GetTotalStake(_ *http.Request, _ *struct{}, reply *GetTotalStakeReply) error
GetTotalStake returns the total amount staked on the Primary Network
func (*Service) GetTx ¶ added in v0.8.0
func (service *Service) GetTx(_ *http.Request, args *api.GetTxArgs, response *api.FormattedTx) error
GetTx gets a tx
func (*Service) GetTxStatus ¶ added in v0.8.0
func (service *Service) GetTxStatus(_ *http.Request, args *GetTxStatusArgs, response *GetTxStatusResponse) error
GetTxStatus gets a tx's status
func (*Service) GetUTXOs ¶ added in v0.8.0
func (service *Service) GetUTXOs(_ *http.Request, args *GetUTXOsArgs, response *GetUTXOsResponse) error
GetUTXOs returns the UTXOs controlled by the given addresses
func (*Service) GetValidatorsAt ¶ added in v1.5.3
func (service *Service) GetValidatorsAt(_ *http.Request, args *GetValidatorsAtArgs, reply *GetValidatorsAtReply) error
GetValidatorsAt returns the weights of the validator set of a provided subnet at the specified height.
func (*Service) ImportAVAX ¶ added in v0.8.0
func (service *Service) ImportAVAX(_ *http.Request, args *ImportAVAXArgs, response *api.JSONTxIDChangeAddr) error
ImportAVAX issues a transaction to import AVAX from the X-chain. The AVAX must have already been exported from the X-Chain.
func (*Service) ImportKey ¶ added in v0.8.0
func (service *Service) ImportKey(r *http.Request, args *ImportKeyArgs, reply *api.JSONAddress) error
ImportKey adds a private key to the provided user
func (*Service) IssueTx ¶
func (service *Service) IssueTx(_ *http.Request, args *api.FormattedTx, response *api.JSONTxID) error
IssueTx issues a tx
func (*Service) ListAddresses ¶ added in v0.8.0
func (service *Service) ListAddresses(_ *http.Request, args *api.UserPass, response *api.JSONAddresses) error
ListAddresses returns the addresses controlled by [args.Username]
func (*Service) SampleValidators ¶
func (service *Service) SampleValidators(_ *http.Request, args *SampleValidatorsArgs, reply *SampleValidatorsReply) error
SampleValidators returns a sampling of the list of current validators
func (*Service) ValidatedBy ¶
func (service *Service) ValidatedBy(_ *http.Request, args *ValidatedByArgs, response *ValidatedByResponse) error
ValidatedBy returns the ID of the Subnet that validates [args.BlockchainID]
func (*Service) Validates ¶
func (service *Service) Validates(_ *http.Request, args *ValidatesArgs, response *ValidatesResponse) error
Validates returns the IDs of the blockchains validated by [args.SubnetID]
type StakeableLockIn ¶ added in v0.8.0
type StakeableLockIn struct { Locktime uint64 `serialize:"true" json:"locktime"` avax.TransferableIn `serialize:"true" json:"input"` }
func (*StakeableLockIn) Verify ¶ added in v0.8.0
func (s *StakeableLockIn) Verify() error
type StakeableLockOut ¶ added in v0.8.0
type StakeableLockOut struct { Locktime uint64 `serialize:"true" json:"locktime"` avax.TransferableOut `serialize:"true" json:"output"` }
func (*StakeableLockOut) Addresses ¶ added in v0.8.4
func (s *StakeableLockOut) Addresses() [][]byte
func (*StakeableLockOut) Verify ¶ added in v0.8.0
func (s *StakeableLockOut) Verify() error
type StandardBlock ¶
type StandardBlock struct { CommonDecisionBlock `serialize:"true"` Txs []*Tx `serialize:"true" json:"txs"` // contains filtered or unexported fields }
StandardBlock being accepted results in the transactions contained in the block to be accepted and committed to the chain.
func (*StandardBlock) Accept ¶ added in v1.7.0
func (sb *StandardBlock) Accept() error
func (*StandardBlock) Reject ¶ added in v1.0.2
func (sb *StandardBlock) Reject() error
func (*StandardBlock) Verify ¶
func (sb *StandardBlock) Verify() error
Verify this block performs a valid state transition.
The parent block must be a proposal ¶
This function also sets onAcceptDB database if the verification passes.
type StaticService ¶
type StaticService struct{}
StaticService defines the static API methods exposed by the platform VM
func (*StaticService) BuildGenesis ¶
func (ss *StaticService) BuildGenesis(_ *http.Request, args *BuildGenesisArgs, reply *BuildGenesisReply) error
BuildGenesis build the genesis state of the Platform Chain (and thereby the Avalanche network.)
type Subnet ¶
type Subnet interface { // ID returns this subnet's ID ID() ids.ID // Validators returns the validators that compose this subnet Validators() []validators.Validator }
A Subnet is a set of validators that are validating a set of blockchains Each blockchain is validated by one subnet; one subnet may validate many blockchains
type SubnetValidator ¶
type SubnetValidator struct { Validator `serialize:"true"` // ID of the subnet this validator is validating Subnet ids.ID `serialize:"true" json:"subnet"` }
SubnetValidator validates a subnet on the Avalanche network.
func (*SubnetValidator) SubnetID ¶
func (v *SubnetValidator) SubnetID() ids.ID
SubnetID is the ID of the subnet this validator is validating
func (*SubnetValidator) Verify ¶ added in v0.8.0
func (v *SubnetValidator) Verify() error
Verify this validator is valid
type TimedTxHeap ¶ added in v1.6.0
func NewTxHeapByStartTime ¶ added in v1.6.0
func NewTxHeapByStartTime() TimedTxHeap
type Tx ¶ added in v0.8.0
type Tx struct { // The body of this transaction UnsignedTx `serialize:"true" json:"unsignedTx"` // The credentials of this transaction Creds []verify.Verifiable `serialize:"true" json:"credentials"` }
Tx is a signed transaction
type TxHeap ¶ added in v1.6.0
type TxHeap interface { Add(tx *Tx) Get(txID ids.ID) *Tx Remove(txID ids.ID) *Tx Peek() *Tx RemoveTop() *Tx Len() int }
func NewTxHeapByAge ¶ added in v1.6.0
func NewTxHeapByAge() TxHeap
func NewTxHeapWithMetrics ¶ added in v1.6.2
func NewTxHeapWithMetrics( txHeap TxHeap, namespace string, registerer prometheus.Registerer, ) (TxHeap, error)
type UTXODeleter ¶ added in v1.4.5
type UTXOGetter ¶ added in v1.4.5
type UTXOState ¶ added in v1.4.5
type UTXOState interface { UTXOGetter UTXOAdder UTXODeleter }
type UnsignedAddDelegatorTx ¶ added in v0.8.0
type UnsignedAddDelegatorTx struct { // Metadata, inputs and outputs BaseTx `serialize:"true"` // Describes the delegatee Validator Validator `serialize:"true" json:"validator"` // Where to send staked tokens when done validating Stake []*avax.TransferableOutput `serialize:"true" json:"stake"` // Where to send staking rewards when done validating RewardsOwner Owner `serialize:"true" json:"rewardsOwner"` }
UnsignedAddDelegatorTx is an unsigned addDelegatorTx
func (*UnsignedAddDelegatorTx) EndTime ¶ added in v0.8.0
func (tx *UnsignedAddDelegatorTx) EndTime() time.Time
EndTime of this validator
func (*UnsignedAddDelegatorTx) Execute ¶ added in v1.6.0
func (tx *UnsignedAddDelegatorTx) Execute( vm *VM, parentState MutableState, stx *Tx, ) ( VersionedState, VersionedState, error, )
Execute this transaction.
func (*UnsignedAddDelegatorTx) InitCtx ¶ added in v1.6.0
func (tx *UnsignedAddDelegatorTx) InitCtx(ctx *snow.Context)
InitCtx sets the FxID fields in the inputs and outputs of this UnsignedAddDelegatorTx. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format
func (*UnsignedAddDelegatorTx) InitiallyPrefersCommit ¶ added in v0.8.0
func (tx *UnsignedAddDelegatorTx) InitiallyPrefersCommit(vm *VM) bool
InitiallyPrefersCommit returns true if the proposed validators start time is after the current wall clock time,
func (*UnsignedAddDelegatorTx) SemanticVerify ¶ added in v0.8.0
func (tx *UnsignedAddDelegatorTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
Attempts to verify this transaction with the provided state.
func (*UnsignedAddDelegatorTx) StartTime ¶ added in v0.8.0
func (tx *UnsignedAddDelegatorTx) StartTime() time.Time
StartTime of this validator
func (*UnsignedAddDelegatorTx) SyntacticVerify ¶ added in v1.6.0
func (tx *UnsignedAddDelegatorTx) SyntacticVerify(ctx *snow.Context) error
SyntacticVerify returns nil iff [tx] is valid
func (*UnsignedAddDelegatorTx) Weight ¶ added in v1.0.0
func (tx *UnsignedAddDelegatorTx) Weight() uint64
Weight of this validator
type UnsignedAddSubnetValidatorTx ¶ added in v0.8.0
type UnsignedAddSubnetValidatorTx struct { // Metadata, inputs and outputs BaseTx `serialize:"true"` // The validator Validator SubnetValidator `serialize:"true" json:"validator"` // Auth that will be allowing this validator into the network SubnetAuth verify.Verifiable `serialize:"true" json:"subnetAuthorization"` }
UnsignedAddSubnetValidatorTx is an unsigned addSubnetValidatorTx
func (*UnsignedAddSubnetValidatorTx) EndTime ¶ added in v0.8.0
func (tx *UnsignedAddSubnetValidatorTx) EndTime() time.Time
EndTime of this validator
func (*UnsignedAddSubnetValidatorTx) Execute ¶ added in v1.6.0
func (tx *UnsignedAddSubnetValidatorTx) Execute( vm *VM, parentState MutableState, stx *Tx, ) ( VersionedState, VersionedState, error, )
Execute this transaction.
func (*UnsignedAddSubnetValidatorTx) InitiallyPrefersCommit ¶ added in v0.8.0
func (tx *UnsignedAddSubnetValidatorTx) InitiallyPrefersCommit(vm *VM) bool
InitiallyPrefersCommit returns true if the proposed validators start time is after the current wall clock time,
func (*UnsignedAddSubnetValidatorTx) SemanticVerify ¶ added in v0.8.0
func (tx *UnsignedAddSubnetValidatorTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
Attempts to verify this transaction with the provided state.
func (*UnsignedAddSubnetValidatorTx) StartTime ¶ added in v0.8.0
func (tx *UnsignedAddSubnetValidatorTx) StartTime() time.Time
StartTime of this validator
func (*UnsignedAddSubnetValidatorTx) SyntacticVerify ¶ added in v1.6.0
func (tx *UnsignedAddSubnetValidatorTx) SyntacticVerify(ctx *snow.Context) error
SyntacticVerify returns nil iff [tx] is valid
func (*UnsignedAddSubnetValidatorTx) Weight ¶ added in v1.0.0
func (tx *UnsignedAddSubnetValidatorTx) Weight() uint64
Weight of this validator
type UnsignedAddValidatorTx ¶ added in v0.8.0
type UnsignedAddValidatorTx struct { // Metadata, inputs and outputs BaseTx `serialize:"true"` // Describes the delegatee Validator Validator `serialize:"true" json:"validator"` // Where to send staked tokens when done validating Stake []*avax.TransferableOutput `serialize:"true" json:"stake"` // Where to send staking rewards when done validating RewardsOwner Owner `serialize:"true" json:"rewardsOwner"` // For example, if this validator has Shares=300,000 then they take 30% of rewards from delegators Shares uint32 `serialize:"true" json:"shares"` }
UnsignedAddValidatorTx is an unsigned addValidatorTx
func (*UnsignedAddValidatorTx) EndTime ¶ added in v0.8.0
func (tx *UnsignedAddValidatorTx) EndTime() time.Time
EndTime of this validator
func (*UnsignedAddValidatorTx) Execute ¶ added in v1.6.0
func (tx *UnsignedAddValidatorTx) Execute( vm *VM, parentState MutableState, stx *Tx, ) ( VersionedState, VersionedState, error, )
Execute this transaction.
func (*UnsignedAddValidatorTx) InitCtx ¶ added in v1.6.0
func (tx *UnsignedAddValidatorTx) InitCtx(ctx *snow.Context)
InitCtx sets the FxID fields in the inputs and outputs of this UnsignedAddValidatorTx. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format
func (*UnsignedAddValidatorTx) InitiallyPrefersCommit ¶ added in v0.8.0
func (tx *UnsignedAddValidatorTx) InitiallyPrefersCommit(vm *VM) bool
InitiallyPrefersCommit returns true if the proposed validators start time is after the current wall clock time,
func (*UnsignedAddValidatorTx) SemanticVerify ¶ added in v0.8.0
func (tx *UnsignedAddValidatorTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
Attempts to verify this transaction with the provided state.
func (*UnsignedAddValidatorTx) StartTime ¶ added in v0.8.0
func (tx *UnsignedAddValidatorTx) StartTime() time.Time
StartTime of this validator
func (*UnsignedAddValidatorTx) SyntacticVerify ¶ added in v1.6.0
func (tx *UnsignedAddValidatorTx) SyntacticVerify(ctx *snow.Context) error
SyntacticVerify returns nil iff [tx] is valid
func (*UnsignedAddValidatorTx) Weight ¶ added in v1.0.0
func (tx *UnsignedAddValidatorTx) Weight() uint64
Weight of this validator
type UnsignedAdvanceTimeTx ¶ added in v0.8.0
type UnsignedAdvanceTimeTx struct { avax.Metadata // Unix time this block proposes increasing the timestamp to Time uint64 `serialize:"true" json:"time"` }
UnsignedAdvanceTimeTx is a transaction to increase the chain's timestamp. When the chain's timestamp is updated (a AdvanceTimeTx is accepted and followed by a commit block) the staker set is also updated accordingly. It must be that:
- proposed timestamp > [current chain time]
- proposed timestamp <= [time for next staker set change]
func (*UnsignedAdvanceTimeTx) Execute ¶ added in v1.6.0
func (tx *UnsignedAdvanceTimeTx) Execute( vm *VM, parentState MutableState, stx *Tx, ) ( VersionedState, VersionedState, error, )
Execute this transaction.
func (*UnsignedAdvanceTimeTx) InitCtx ¶ added in v1.6.0
func (tx *UnsignedAdvanceTimeTx) InitCtx(*snow.Context)
func (*UnsignedAdvanceTimeTx) InitiallyPrefersCommit ¶ added in v0.8.0
func (tx *UnsignedAdvanceTimeTx) InitiallyPrefersCommit(vm *VM) bool
InitiallyPrefersCommit returns true if the proposed time is at or before the current time plus the synchrony bound
func (*UnsignedAdvanceTimeTx) InputIDs ¶ added in v1.6.0
func (tx *UnsignedAdvanceTimeTx) InputIDs() ids.Set
func (*UnsignedAdvanceTimeTx) SemanticVerify ¶ added in v0.8.0
func (tx *UnsignedAdvanceTimeTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
Attempts to verify this transaction with the provided state.
func (*UnsignedAdvanceTimeTx) SyntacticVerify ¶ added in v1.6.0
func (tx *UnsignedAdvanceTimeTx) SyntacticVerify(*snow.Context) error
func (*UnsignedAdvanceTimeTx) Timestamp ¶ added in v0.8.0
func (tx *UnsignedAdvanceTimeTx) Timestamp() time.Time
Timestamp returns the time this block is proposing the chain should be set to
type UnsignedAtomicTx ¶ added in v0.8.0
type UnsignedAtomicTx interface { UnsignedDecisionTx // Execute this transaction with the provided state. AtomicExecute(vm *VM, parentState MutableState, stx *Tx) (VersionedState, error) // Accept this transaction with the additionally provided state transitions. AtomicAccept(ctx *snow.Context, batch database.Batch) error }
UnsignedAtomicTx is an unsigned operation that can be atomically accepted
type UnsignedCreateChainTx ¶
type UnsignedCreateChainTx struct { // Metadata, inputs and outputs BaseTx `serialize:"true"` // ID of the Subnet that validates this blockchain SubnetID ids.ID `serialize:"true" json:"subnetID"` // A human readable name for the chain; need not be unique ChainName string `serialize:"true" json:"chainName"` // ID of the VM running on the new chain VMID ids.ID `serialize:"true" json:"vmID"` // IDs of the feature extensions running on the new chain FxIDs []ids.ID `serialize:"true" json:"fxIDs"` // Byte representation of genesis state of the new chain GenesisData []byte `serialize:"true" json:"genesisData"` // Authorizes this blockchain to be added to this subnet SubnetAuth verify.Verifiable `serialize:"true" json:"subnetAuthorization"` }
UnsignedCreateChainTx is an unsigned CreateChainTx
func (*UnsignedCreateChainTx) AtomicOperations ¶ added in v1.7.0
func (*UnsignedCreateChainTx) Execute ¶ added in v1.6.0
func (tx *UnsignedCreateChainTx) Execute( vm *VM, vs VersionedState, stx *Tx, ) ( func() error, error, )
Execute this transaction.
func (*UnsignedCreateChainTx) InputUTXOs ¶ added in v1.7.0
func (tx *UnsignedCreateChainTx) InputUTXOs() ids.Set
func (*UnsignedCreateChainTx) SemanticVerify ¶ added in v0.8.0
func (tx *UnsignedCreateChainTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
Attempts to verify this transaction with the provided state.
func (*UnsignedCreateChainTx) SyntacticVerify ¶ added in v1.6.0
func (tx *UnsignedCreateChainTx) SyntacticVerify(ctx *snow.Context) error
type UnsignedCreateSubnetTx ¶
type UnsignedCreateSubnetTx struct { // Metadata, inputs and outputs BaseTx `serialize:"true"` // Who is authorized to manage this subnet Owner Owner `serialize:"true" json:"owner"` }
UnsignedCreateSubnetTx is an unsigned proposal to create a new subnet
func (*UnsignedCreateSubnetTx) AtomicOperations ¶ added in v1.7.0
func (*UnsignedCreateSubnetTx) Execute ¶ added in v1.6.0
func (tx *UnsignedCreateSubnetTx) Execute( vm *VM, vs VersionedState, stx *Tx, ) ( func() error, error, )
Execute this transaction.
func (*UnsignedCreateSubnetTx) InitCtx ¶ added in v1.6.0
func (tx *UnsignedCreateSubnetTx) InitCtx(ctx *snow.Context)
InitCtx sets the FxID fields in the inputs and outputs of this UnsignedCreateSubnetTx. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format
func (*UnsignedCreateSubnetTx) InputUTXOs ¶ added in v1.7.0
func (tx *UnsignedCreateSubnetTx) InputUTXOs() ids.Set
InputUTXOs for [DecisionTxs] will return an empty set to diffrentiate from the [AtomicTxs] input UTXOs
func (*UnsignedCreateSubnetTx) SemanticVerify ¶ added in v0.8.0
func (tx *UnsignedCreateSubnetTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
Attempts to verify this transaction with the provided state.
func (*UnsignedCreateSubnetTx) SyntacticVerify ¶ added in v1.6.0
func (tx *UnsignedCreateSubnetTx) SyntacticVerify(ctx *snow.Context) error
SyntacticVerify verifies that this transaction is well-formed
type UnsignedDecisionTx ¶ added in v0.8.0
type UnsignedDecisionTx interface { UnsignedTx // Execute this transaction with the provided state. Execute(vm *VM, vs VersionedState, stx *Tx) ( onAcceptFunc func() error, err error, ) // To maintain consistency with the Atomic txs InputUTXOs() ids.Set // AtomicOperations provides the requests to be written to shared memory. AtomicOperations() (ids.ID, *atomic.Requests, error) }
UnsignedDecisionTx is an unsigned operation that can be immediately decided
type UnsignedExportTx ¶
type UnsignedExportTx struct { BaseTx `serialize:"true"` // Which chain to send the funds to DestinationChain ids.ID `serialize:"true" json:"destinationChain"` // Outputs that are exported to the chain ExportedOutputs []*avax.TransferableOutput `serialize:"true" json:"exportedOutputs"` }
UnsignedExportTx is an unsigned ExportTx
func (*UnsignedExportTx) AtomicAccept ¶ added in v1.7.0
Accept this transaction.
func (*UnsignedExportTx) AtomicExecute ¶ added in v1.7.0
func (tx *UnsignedExportTx) AtomicExecute( vm *VM, parentState MutableState, stx *Tx, ) (VersionedState, error)
Execute this transaction and return the versioned state.
func (*UnsignedExportTx) AtomicOperations ¶ added in v1.7.0
AtomicOperations returns the shared memory requests
func (*UnsignedExportTx) Execute ¶ added in v1.6.0
func (tx *UnsignedExportTx) Execute( vm *VM, vs VersionedState, stx *Tx, ) (func() error, error)
Execute this transaction.
func (*UnsignedExportTx) InitCtx ¶ added in v1.6.0
func (tx *UnsignedExportTx) InitCtx(ctx *snow.Context)
InitCtx sets the FxID fields in the inputs and outputs of this UnsignedExportTx. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format
func (*UnsignedExportTx) InputUTXOs ¶ added in v0.8.0
func (tx *UnsignedExportTx) InputUTXOs() ids.Set
InputUTXOs returns an empty set
func (*UnsignedExportTx) SemanticVerify ¶ added in v0.8.0
func (tx *UnsignedExportTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
Attempts to verify this transaction with the provided state.
func (*UnsignedExportTx) SyntacticVerify ¶ added in v1.6.0
func (tx *UnsignedExportTx) SyntacticVerify(ctx *snow.Context) error
SyntacticVerify this transaction is well-formed
type UnsignedImportTx ¶
type UnsignedImportTx struct { BaseTx `serialize:"true"` // Which chain to consume the funds from SourceChain ids.ID `serialize:"true" json:"sourceChain"` // Inputs that consume UTXOs produced on the chain ImportedInputs []*avax.TransferableInput `serialize:"true" json:"importedInputs"` }
UnsignedImportTx is an unsigned ImportTx
func (*UnsignedImportTx) AtomicAccept ¶ added in v1.7.0
Accept this transaction and spend imported inputs We spend imported UTXOs here rather than in semanticVerify because we don't want to remove an imported UTXO in semanticVerify only to have the transaction not be Accepted. This would be inconsistent. Recall that imported UTXOs are not kept in a versionDB.
func (*UnsignedImportTx) AtomicExecute ¶ added in v1.7.0
func (tx *UnsignedImportTx) AtomicExecute( vm *VM, parentState MutableState, stx *Tx, ) (VersionedState, error)
[AtomicExecute] to maintain consistency for the standard block.
func (*UnsignedImportTx) AtomicOperations ¶ added in v1.7.0
AtomicOperations returns the shared memory requests
func (*UnsignedImportTx) Execute ¶ added in v1.6.0
func (tx *UnsignedImportTx) Execute( vm *VM, vs VersionedState, stx *Tx, ) (func() error, error)
Execute this transaction.
func (*UnsignedImportTx) InitCtx ¶ added in v1.6.0
func (tx *UnsignedImportTx) InitCtx(ctx *snow.Context)
InitCtx sets the FxID fields in the inputs and outputs of this UnsignedImportTx. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format
func (*UnsignedImportTx) InputIDs ¶ added in v1.6.0
func (tx *UnsignedImportTx) InputIDs() ids.Set
func (*UnsignedImportTx) InputUTXOs ¶ added in v0.8.0
func (tx *UnsignedImportTx) InputUTXOs() ids.Set
InputUTXOs returns the UTXOIDs of the imported funds
func (*UnsignedImportTx) SemanticVerify ¶ added in v0.8.0
func (tx *UnsignedImportTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
Attempts to verify this transaction with the provided state.
func (*UnsignedImportTx) SyntacticVerify ¶ added in v1.6.0
func (tx *UnsignedImportTx) SyntacticVerify(ctx *snow.Context) error
SyntacticVerify this transaction is well-formed
type UnsignedProposalTx ¶ added in v0.8.0
type UnsignedProposalTx interface { UnsignedTx // Attempts to verify this transaction with the provided state. Execute(vm *VM, state MutableState, stx *Tx) ( onCommitState VersionedState, onAbortState VersionedState, err error, ) InitiallyPrefersCommit(vm *VM) bool }
UnsignedProposalTx is an unsigned operation that can be proposed
type UnsignedRewardValidatorTx ¶ added in v0.8.0
type UnsignedRewardValidatorTx struct { avax.Metadata // ID of the tx that created the delegator/validator being removed/rewarded TxID ids.ID `serialize:"true" json:"txID"` // contains filtered or unexported fields }
UnsignedRewardValidatorTx is a transaction that represents a proposal to remove a validator that is currently validating from the validator set.
If this transaction is accepted and the next block accepted is a Commit block, the validator is removed and the address that the validator specified receives the staked AVAX as well as a validating reward.
If this transaction is accepted and the next block accepted is an Abort block, the validator is removed and the address that the validator specified receives the staked AVAX but no reward.
func (*UnsignedRewardValidatorTx) Execute ¶ added in v1.6.0
func (tx *UnsignedRewardValidatorTx) Execute( vm *VM, parentState MutableState, stx *Tx, ) ( VersionedState, VersionedState, error, )
Execute this transaction.
The current validating set must have at least one member. The next validator to be removed must be the validator specified in this block. The next validator to be removed must be have an end time equal to the current
chain timestamp.
func (*UnsignedRewardValidatorTx) InitCtx ¶ added in v1.6.0
func (tx *UnsignedRewardValidatorTx) InitCtx(*snow.Context)
func (*UnsignedRewardValidatorTx) InitiallyPrefersCommit ¶ added in v0.8.0
func (tx *UnsignedRewardValidatorTx) InitiallyPrefersCommit(*VM) bool
InitiallyPrefersCommit returns true if this node thinks the validator should receive a staking reward.
TODO: A validator should receive a reward only if they are sufficiently responsive and correct during the time they are validating. Right now they receive a reward if they're up (but not necessarily correct and responsive) for a sufficient amount of time
func (*UnsignedRewardValidatorTx) InputIDs ¶ added in v1.6.0
func (tx *UnsignedRewardValidatorTx) InputIDs() ids.Set
func (*UnsignedRewardValidatorTx) SemanticVerify ¶ added in v0.8.0
func (tx *UnsignedRewardValidatorTx) SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error
Attempts to verify this transaction with the provided state.
func (*UnsignedRewardValidatorTx) SyntacticVerify ¶ added in v1.6.0
func (tx *UnsignedRewardValidatorTx) SyntacticVerify(*snow.Context) error
type UnsignedTx ¶ added in v0.8.0
type UnsignedTx interface { // TODO: Remove this initialization pattern from both the platformvm and the // avm. snow.ContextInitializable Initialize(unsignedBytes, signedBytes []byte) ID() ids.ID UnsignedBytes() []byte Bytes() []byte // InputIDs returns the set of inputs this transaction consumes InputIDs() ids.Set // Attempts to verify this transaction without any provided state. SyntacticVerify(ctx *snow.Context) error // Attempts to verify this transaction with the provided state. SemanticVerify(vm *VM, parentState MutableState, stx *Tx) error }
UnsignedTx is an unsigned transaction
type VM ¶
type VM struct { Factory avax.AddressManager avax.AtomicUTXOManager // contains filtered or unexported fields }
VM implements the snowman.ChainVM interface
func (*VM) AcceptBlock ¶ added in v1.4.5
func (VM) AppRequest ¶ added in v1.5.3
func (VM) AppRequestFailed ¶ added in v1.5.3
func (VM) AppResponse ¶ added in v1.5.3
func (*VM) BuildBlock ¶
BuildBlock builds a block to be added to consensus
func (*VM) CodecRegistry ¶ added in v1.0.6
func (*VM) CreateHandlers ¶
func (vm *VM) CreateHandlers() (map[string]*common.HTTPHandler, error)
CreateHandlers returns a map where: * keys are API endpoint extensions * values are API handlers
func (*VM) CreateStaticHandlers ¶
func (vm *VM) CreateStaticHandlers() (map[string]*common.HTTPHandler, error)
CreateStaticHandlers returns a map where: * keys are API endpoint extensions * values are API handlers
func (*VM) Disconnected ¶ added in v0.8.0
Disconnected implements validators.Connector
func (*VM) GetCurrentHeight ¶ added in v1.6.0
GetCurrentHeight returns the height of the last accepted block
func (*VM) GetValidatorSet ¶ added in v1.5.3
GetValidatorSet returns the validator set at the specified height for the provided subnetID.
func (*VM) HealthCheck ¶ added in v1.2.1
HealthCheck implements the common.VM interface
func (*VM) Initialize ¶
func (vm *VM) Initialize( ctx *snow.Context, dbManager manager.Manager, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, msgs chan<- common.Message, _ []*common.Fx, appSender common.AppSender, ) error
Initialize this blockchain. [vm.ChainManager] and [vm.vdrMgr] must be set before this function is called.
func (*VM) LastAccepted ¶ added in v1.4.5
LastAccepted returns the block most recently accepted
func (*VM) NotifyBlockReady ¶ added in v1.4.5
func (vm *VM) NotifyBlockReady()
NotifyBlockReady tells the consensus engine that a new block is ready to be created
func (*VM) ParseBlock ¶
ParseBlock implements the snowman.ChainVM interface
func (*VM) SetPreference ¶
SetPreference sets the preferred block to be the one with ID [blkID]
type ValidatedByArgs ¶
type ValidatedByArgs struct { // ValidatedBy returns the ID of the Subnet validating the blockchain with this ID BlockchainID ids.ID `json:"blockchainID"` }
ValidatedByArgs is the arguments for calling ValidatedBy
type ValidatedByResponse ¶
type ValidatedByResponse struct { // ID of the Subnet validating the specified blockchain SubnetID ids.ID `json:"subnetID"` }
ValidatedByResponse is the reply from calling ValidatedBy
type ValidatesArgs ¶
ValidatesArgs are the arguments to Validates
type ValidatesResponse ¶
ValidatesResponse is the response from calling Validates
type Validator ¶
type Validator struct { // Node ID of the validator NodeID ids.ShortID `serialize:"true" json:"nodeID"` // Unix time this validator starts validating Start uint64 `serialize:"true" json:"start"` // Unix time this validator stops validating End uint64 `serialize:"true" json:"end"` // Weight of this validator used when sampling Wght uint64 `serialize:"true" json:"weight"` }
Validator is a validator.
func (*Validator) BoundedBy ¶ added in v0.8.0
BoundedBy returns true iff the period that [validator] validates is a (non-strict) subset of the time that [other] validates. Namely, startTime <= v.StartTime() <= v.EndTime() <= endTime
func (*Validator) Duration ¶ added in v0.8.0
Duration is the amount of time that this validator will be in the validator set
func (*Validator) EndTime ¶ added in v0.8.0
EndTime is the time that this validator will leave the validator set
func (*Validator) StartTime ¶ added in v0.8.0
StartTime is the time that this validator will enter the validator set
type ValidatorState ¶ added in v1.5.3
type ValidatorState interface { CurrentStakerChainState() currentStakerChainState PendingStakerChainState() pendingStakerChainState }
type ValidatorWeightDiff ¶ added in v1.5.3
type VersionedState ¶ added in v1.4.5
type VersionedState interface { MutableState SetBase(MutableState) Apply(InternalState) }
Source Files ¶
- abort_block.go
- add_delegator_tx.go
- add_subnet_validator_tx.go
- add_validator_tx.go
- advance_time_tx.go
- atomic_block.go
- base_tx.go
- block_builder.go
- cache_current_staker_chain_state.go
- cache_current_validator.go
- cache_internal_state.go
- cache_pending_staker_chain_state.go
- cache_validator.go
- cache_versioned_state.go
- client.go
- codec.go
- commit_block.go
- common_blocks.go
- create_chain_tx.go
- create_subnet_tx.go
- export_tx.go
- factory.go
- fx.go
- health.go
- import_tx.go
- mempool.go
- metrics.go
- network.go
- proposal_block.go
- reward_validator_tx.go
- service.go
- spend.go
- stakeable_lock.go
- standard_block.go
- static_service.go
- subnet.go
- tx.go
- tx_heap.go
- tx_heap_by_age.go
- tx_heap_by_end_time.go
- tx_heap_by_start_time.go
- tx_heap_metrics.go
- validator.go
- vm.go