Documentation ¶
Index ¶
- Constants
- Variables
- type APIAccount
- type APIBlockchain
- type APIChain
- type APIDefaultSubnetValidator
- type APISubnet
- type APIValidator
- type Abort
- type Account
- type AddDefaultSubnetDelegatorArgs
- type AddDefaultSubnetValidatorArgs
- type AddNonDefaultSubnetValidatorArgs
- type AtomicBlock
- type AtomicTx
- type Block
- type BuildGenesisArgs
- type BuildGenesisReply
- type Commit
- type CommonBlock
- type CommonDecisionBlock
- type CreateAccountArgs
- type CreateAccountReply
- type CreateBlockchainArgs
- type CreateChainTx
- type CreateSubnetArgs
- type CreateSubnetTx
- type CreateSubnetTxList
- type CreateTxResponse
- type DecisionTx
- type DurationValidator
- type EventHeap
- func (h *EventHeap) Add(tx TimedTx)
- func (h *EventHeap) Bytes() []byte
- func (h *EventHeap) Len() int
- func (h *EventHeap) Less(i, j int) bool
- func (h *EventHeap) Peek() TimedTx
- func (h *EventHeap) Pop() interface{}
- func (h *EventHeap) Push(x interface{})
- func (h *EventHeap) Remove() TimedTx
- func (h *EventHeap) Swap(i, j int)
- func (h *EventHeap) Timestamp() time.Time
- type ExportAVAArgs
- type ExportTx
- func (tx *ExportTx) Accept(batch database.Batch) error
- func (tx *ExportTx) Bytes() []byte
- func (tx *ExportTx) ID() ids.ID
- func (tx *ExportTx) InputUTXOs() ids.Set
- func (tx *ExportTx) Key() crypto.PublicKey
- func (tx *ExportTx) SemanticVerify(db database.Database) error
- func (tx *ExportTx) SyntacticVerify() error
- type Factory
- type Genesis
- type GetAccountArgs
- type GetAccountReply
- type GetBlockchainStatusArgs
- type GetBlockchainStatusReply
- type GetBlockchainsResponse
- type GetCurrentValidatorsArgs
- type GetCurrentValidatorsReply
- type GetPendingValidatorsArgs
- type GetPendingValidatorsReply
- type GetSubnetsArgs
- type GetSubnetsResponse
- type ImportAVAArgs
- type ImportTx
- func (tx *ImportTx) Accept(batch database.Batch) error
- func (tx *ImportTx) Bytes() []byte
- func (tx *ImportTx) ID() ids.ID
- func (tx *ImportTx) InputUTXOs() ids.Set
- func (tx *ImportTx) Key() crypto.PublicKey
- func (tx *ImportTx) SemanticVerify(db database.Database) error
- func (tx *ImportTx) SyntacticVerify() error
- func (tx *ImportTx) UnsignedBytes() []byte
- type IssueTxArgs
- type IssueTxResponse
- type ListAccountsArgs
- type ListAccountsReply
- type ProposalBlock
- type ProposalTx
- type SampleValidatorsArgs
- type SampleValidatorsReply
- type Service
- func (service *Service) AddDefaultSubnetDelegator(_ *http.Request, args *AddDefaultSubnetDelegatorArgs, reply *CreateTxResponse) error
- func (service *Service) AddDefaultSubnetValidator(_ *http.Request, args *AddDefaultSubnetValidatorArgs, reply *CreateTxResponse) error
- func (service *Service) AddNonDefaultSubnetValidator(_ *http.Request, args *AddNonDefaultSubnetValidatorArgs, ...) error
- func (service *Service) CreateAccount(_ *http.Request, args *CreateAccountArgs, reply *CreateAccountReply) error
- func (service *Service) CreateBlockchain(_ *http.Request, args *CreateBlockchainArgs, response *CreateTxResponse) error
- func (service *Service) CreateSubnet(_ *http.Request, args *CreateSubnetArgs, response *CreateTxResponse) error
- func (service *Service) ExportAVA(_ *http.Request, args *ExportAVAArgs, response *CreateTxResponse) error
- func (service *Service) GetAccount(_ *http.Request, args *GetAccountArgs, reply *GetAccountReply) error
- func (service *Service) GetBlockchainStatus(_ *http.Request, args *GetBlockchainStatusArgs, ...) error
- func (service *Service) GetBlockchains(_ *http.Request, args *struct{}, response *GetBlockchainsResponse) error
- func (service *Service) GetCurrentValidators(_ *http.Request, args *GetCurrentValidatorsArgs, ...) error
- func (service *Service) GetPendingValidators(_ *http.Request, args *GetPendingValidatorsArgs, ...) error
- func (service *Service) GetSubnets(_ *http.Request, args *GetSubnetsArgs, response *GetSubnetsResponse) error
- func (service *Service) ImportAVA(_ *http.Request, args *ImportAVAArgs, response *SignResponse) error
- func (service *Service) IssueTx(_ *http.Request, args *IssueTxArgs, response *IssueTxResponse) error
- func (service *Service) ListAccounts(_ *http.Request, args *ListAccountsArgs, reply *ListAccountsReply) error
- func (service *Service) SampleValidators(_ *http.Request, args *SampleValidatorsArgs, reply *SampleValidatorsReply) error
- func (service *Service) Sign(_ *http.Request, args *SignArgs, reply *SignResponse) error
- func (service *Service) ValidatedBy(_ *http.Request, args *ValidatedByArgs, response *ValidatedByResponse) error
- func (service *Service) Validates(_ *http.Request, args *ValidatesArgs, response *ValidatesResponse) error
- type SignArgs
- type SignResponse
- type StandardBlock
- type StaticService
- type Status
- type Subnet
- type SubnetValidator
- type TimedTx
- type UnsignedAddDefaultSubnetDelegatorTx
- type UnsignedAddDefaultSubnetValidatorTx
- type UnsignedAddNonDefaultSubnetValidatorTx
- type UnsignedCreateChainTx
- type UnsignedCreateSubnetTx
- type UnsignedExportTx
- type UnsignedImportTx
- type VM
- func (vm *VM) BuildBlock() (snowman.Block, error)
- func (vm *VM) Clock() *timer.Clock
- func (vm *VM) Codec() codec.Codec
- func (vm *VM) CreateHandlers() map[string]*common.HTTPHandler
- func (vm *VM) CreateStaticHandlers() map[string]*common.HTTPHandler
- func (vm *VM) GetAtomicUTXOs(addrs ids.Set) ([]*ava.UTXO, error)
- func (vm *VM) GetBlock(blkID ids.ID) (snowman.Block, error)
- func (vm *VM) Initialize(ctx *snow.Context, db database.Database, genesisBytes []byte, ...) error
- func (vm *VM) Logger() logging.Logger
- func (vm *VM) ParseBlock(bytes []byte) (snowman.Block, error)
- func (vm *VM) SetPreference(blkID ids.ID)
- func (vm *VM) Shutdown()
- type ValidatedByArgs
- type ValidatedByResponse
- type ValidatesArgs
- type ValidatesResponse
- type Validator
Constants ¶
const ( // Delta is the synchrony bound used for safe decision making Delta = 10 * time.Second // BatchSize is the number of decision transaction to place into a block BatchSize = 30 // rewarded NumberOfShares = 1000000 // InflationRate is the maximum inflation rate of AVA from staking InflationRate = 1.04 // MinimumStakeAmount is the minimum amount of $AVA one must bond to be a staker MinimumStakeAmount = 10 * units.MicroAva // MinimumStakingDuration is the shortest amount of time a staker can bond // their funds for. MinimumStakingDuration = 24 * time.Hour // MaximumStakingDuration is the longest amount of time a staker can bond // their funds for. MaximumStakingDuration = 365 * 24 * time.Hour )
Variables ¶
var Codec codec.Codec
Codec does serialization and deserialization
var ( // DefaultSubnetID is the ID of the default subnet DefaultSubnetID = ids.Empty )
var (
ID = ids.NewID([32]byte{'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', 'v', 'm'})
)
ID of the platform VM
Functions ¶
This section is empty.
Types ¶
type APIAccount ¶
type APIAccount struct { Address ids.ShortID `json:"address"` Nonce json.Uint64 `json:"nonce"` Balance json.Uint64 `json:"balance"` }
APIAccount is an account on the Platform Chain that exists at the chain's genesis.
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 formatting.CB58 `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 APIDefaultSubnetValidator ¶
type APIDefaultSubnetValidator struct { APIValidator Destination ids.ShortID `json:"destination"` DelegationFeeRate json.Uint32 `json:"delegationFeeRate"` }
APIDefaultSubnetValidator is a validator of the default subnet
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 []ids.ShortID `json:"controlKeys"` Threshold json.Uint16 `json:"threshold"` }
APISubnet is a representation of a subnet used in API calls
type APIValidator ¶
type APIValidator struct { StartTime json.Uint64 `json:"startTime"` EndTime json.Uint64 `json:"endtime"` Weight *json.Uint64 `json:"weight,omitempty"` StakeAmount *json.Uint64 `json:"stakeAmount,omitempty"` ID ids.ShortID `json:"id"` }
APIValidator is a validator. [Amount] is the amount of $AVA being staked. [Endtime] is the Unix time repr. of when they are done staking ID is the node ID of the staker [Destination] is the address where the staked $AVA (and, if applicable, reward) is sent when this staker is done staking.
type Abort ¶
type Abort struct {
CommonDecisionBlock `serialize:"true"`
}
Abort being accepted results in the proposal of its parent (which must be a proposal block) being rejected.
type Account ¶
type Account struct { // Address of this account // Its value is [privKey].PublicKey().Address() where privKey // is the private key that controls this account Address ids.ShortID `serialize:"true"` // Nonce this account was last spent with // Initially, this is set to 0. Therefore, the first nonce a transaction should // use for a new account is 1. Nonce uint64 `serialize:"true"` // Balance of $AVA held by this account Balance uint64 `serialize:"true"` }
Account represents the Balance and nonce of a user's funds
type AddDefaultSubnetDelegatorArgs ¶
type AddDefaultSubnetDelegatorArgs struct { APIValidator Destination ids.ShortID `json:"destination"` // Next unused nonce of the account the staked $AVA and tx fee are paid from PayerNonce json.Uint64 `json:"payerNonce"` }
AddDefaultSubnetDelegatorArgs are the arguments to AddDefaultSubnetDelegator
type AddDefaultSubnetValidatorArgs ¶
type AddDefaultSubnetValidatorArgs struct { APIDefaultSubnetValidator // Next unused nonce of the account the staked $AVA and tx fee are paid from PayerNonce json.Uint64 `json:"payerNonce"` }
AddDefaultSubnetValidatorArgs are the arguments to AddDefaultSubnetValidator
type AddNonDefaultSubnetValidatorArgs ¶
type AddNonDefaultSubnetValidatorArgs struct { APIValidator // ID of subnet to validate SubnetID ids.ID `json:"subnetID"` // Next unused nonce of the account the tx fee is paid from PayerNonce json.Uint64 `json:"payerNonce"` }
AddNonDefaultSubnetValidatorArgs are the arguments to AddNonDefaultSubnetValidator
type AtomicBlock ¶
type AtomicBlock struct { CommonDecisionBlock `serialize:"true"` Tx AtomicTx `serialize:"true"` // contains filtered or unexported fields }
AtomicBlock being accepted results in the transaction contained in the block to be accepted and committed to the chain.
func (*AtomicBlock) Accept ¶
func (ab *AtomicBlock) Accept()
Accept implements the snowman.Block interface
func (*AtomicBlock) Verify ¶
func (ab *AtomicBlock) 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 AtomicTx ¶
type AtomicTx interface { ID() ids.ID // UTXOs this tx consumes InputUTXOs() ids.Set // Attempt to verify this transaction with the provided state. The provided // database can be modified arbitrarily. SemanticVerify(database.Database) error Accept(database.Batch) error // contains filtered or unexported methods }
AtomicTx is an operation that can be decided without being proposed, but must have special control over database commitment
type BuildGenesisArgs ¶
type BuildGenesisArgs struct { NetworkID json.Uint32 `json:"address"` Accounts []APIAccount `json:"accounts"` Validators []APIDefaultSubnetValidator `json:"defaultSubnetValidators"` Chains []APIChain `json:"chains"` Time json.Uint64 `json:"time"` }
BuildGenesisArgs are the arguments used to create the genesis data of the Platform Chain. [NetworkID] is the ID of the network [Accounts] are the accounts on the Platform Chain that exists at genesis. [Validators] are the validators of the default subnet 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 formatting.CB58 `json:"bytes"`
}
BuildGenesisReply is the reply from BuildGenesis
type Commit ¶
type Commit struct {
CommonDecisionBlock `serialize:"true"`
}
Commit being accepted results in the proposal of its parent (which must be a proposal block) being enacted.
type CommonBlock ¶
type CommonBlock struct { *core.Block `serialize:"true"` // contains filtered or unexported fields }
CommonBlock contains the fields common to all blocks of the Platform Chain
func (*CommonBlock) Parent ¶
func (cb *CommonBlock) Parent() snowman.Block
Parent returns this block's parent
func (*CommonBlock) Reject ¶
func (cb *CommonBlock) Reject()
Reject implements the snowman.Block interface
type CommonDecisionBlock ¶
type CommonDecisionBlock struct { CommonBlock `serialize:"true"` // contains filtered or unexported fields }
CommonDecisionBlock contains the fields and methods common to all decision blocks (ie *Commit and *Abort)
func (*CommonDecisionBlock) Accept ¶
func (cdb *CommonDecisionBlock) Accept()
Accept implements the snowman.Block interface
type CreateAccountArgs ¶
type CreateAccountArgs struct { // User that will control the newly created account Username string `json:"username"` // That user's password Password string `json:"password"` // The private key that controls the new account. // If omitted, will generate a new private key belonging // to the user. PrivateKey string `json:"privateKey"` }
CreateAccountArgs are the arguments for calling CreateAccount
type CreateAccountReply ¶
type CreateAccountReply struct { // Address of the newly created account Address ids.ShortID `json:"address"` }
CreateAccountReply are the response from calling CreateAccount
type CreateBlockchainArgs ¶
type CreateBlockchainArgs struct { // 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"` // Next unused nonce of the account paying the transaction fee PayerNonce json.Uint64 `json:"payerNonce"` // Genesis state of the blockchain being created GenesisData formatting.CB58 `json:"genesisData"` }
CreateBlockchainArgs is the arguments for calling CreateBlockchain
type CreateChainTx ¶
type CreateChainTx struct { UnsignedCreateChainTx `serialize:"true"` // Address of the account that provides the transaction fee // Set in SemanticVerify PayerAddress ids.ShortID // Signatures from Subnet's control keys // Should not empty slice, not nil, if there are no control sigs ControlSigs [][crypto.SECP256K1RSigLen]byte `serialize:"true"` // Signature of key whose account provides the transaction fee PayerSig [crypto.SECP256K1RSigLen]byte `serialize:"true"` // contains filtered or unexported fields }
CreateChainTx is a proposal to create a chain
func (*CreateChainTx) Bytes ¶
func (tx *CreateChainTx) Bytes() []byte
Bytes returns the byte representation of a CreateChainTx
func (*CreateChainTx) SemanticVerify ¶
func (tx *CreateChainTx) SemanticVerify(db database.Database) (func(), error)
SemanticVerify this transaction is valid.
func (*CreateChainTx) SyntacticVerify ¶
func (tx *CreateChainTx) SyntacticVerify() error
SyntacticVerify this transaction is well-formed Also populates [tx.Key] with the public key that signed this transaction
type CreateSubnetArgs ¶
type CreateSubnetArgs struct { // The ID member of APISubnet is ignored APISubnet // Nonce of the account that pays the transaction fee PayerNonce json.Uint64 `json:"payerNonce"` }
CreateSubnetArgs are the arguments to CreateSubnet
type CreateSubnetTx ¶
type CreateSubnetTx struct { UnsignedCreateSubnetTx `serialize:"true"` // Signature on the UnsignedCreateSubnetTx's byte repr Sig [crypto.SECP256K1RSigLen]byte `serialize:"true"` // contains filtered or unexported fields }
CreateSubnetTx is a proposal to create a new subnet
func (*CreateSubnetTx) Bytes ¶
func (tx *CreateSubnetTx) Bytes() []byte
Bytes returns the byte representation of [tx]
func (*CreateSubnetTx) ID ¶
func (tx *CreateSubnetTx) ID() ids.ID
ID returns the ID of this transaction
func (*CreateSubnetTx) SemanticVerify ¶
func (tx *CreateSubnetTx) SemanticVerify(db database.Database) (func(), error)
SemanticVerify returns nil if [tx] is valid given the state in [db]
func (*CreateSubnetTx) SyntacticVerify ¶
func (tx *CreateSubnetTx) SyntacticVerify() error
SyntacticVerify nil iff [tx] is syntactically valid. If [tx] is valid, this method sets [tx.key]
type CreateSubnetTxList ¶
type CreateSubnetTxList []*CreateSubnetTx
CreateSubnetTxList is a list of *CreateSubnetTx
func (CreateSubnetTxList) Bytes ¶
func (lst CreateSubnetTxList) Bytes() []byte
Bytes returns the binary representation of [lst]
type CreateTxResponse ¶
type CreateTxResponse struct {
UnsignedTx formatting.CB58 `json:"unsignedTx"`
}
CreateTxResponse is the response from calls to create a transaction
type DecisionTx ¶
type DecisionTx interface { ID() ids.ID // Attempt to verify this transaction with the provided state. The provided // database can be modified arbitrarily. If a nil error is returned, it is // assumped onAccept is non-nil. SemanticVerify(database.Database) (onAccept func(), err error) // contains filtered or unexported methods }
DecisionTx is an operation that can be decided without being proposed
type DurationValidator ¶
type DurationValidator struct { Validator `serialize:"true"` // Unix time this staker starts validating Start uint64 `serialize:"true"` // Unix time this staker stops validating End uint64 `serialize:"true"` }
DurationValidator ...
func (*DurationValidator) BoundedBy ¶
func (v *DurationValidator) BoundedBy(startTime, endTime time.Time) bool
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 (*DurationValidator) Duration ¶
func (v *DurationValidator) Duration() time.Duration
Duration is the amount of time that this staker will be in the validator set
func (*DurationValidator) EndTime ¶
func (v *DurationValidator) EndTime() time.Time
EndTime is the time that this staker will leave the validator set
func (*DurationValidator) StartTime ¶
func (v *DurationValidator) StartTime() time.Time
StartTime is the time that this staker will enter the validator set
type EventHeap ¶
EventHeap is a collection of timedTxs where elements are ordered by either their startTime or their endTime. If SortByStartTime == true, the first element of [Txs] is the tx in the heap with the earliest startTime. Otherwise the first element is the tx with earliest endTime. The default value of this struct will order transactions by endTime. This struct implements the heap interface.
type ExportAVAArgs ¶
type ExportAVAArgs struct { // X-Chain address (without prepended X-) that will receive the exported AVA To ids.ShortID `json:"to"` // Nonce of the account that pays the transaction fee and provides the export AVA PayerNonce json.Uint64 `json:"payerNonce"` // Amount of nAVA to send Amount json.Uint64 `json:"amount"` }
ExportAVAArgs are the arguments to ExportAVA
type ExportTx ¶
type ExportTx struct { UnsignedExportTx `serialize:"true"` Sig [crypto.SECP256K1RSigLen]byte `serialize:"true"` // contains filtered or unexported fields }
ExportTx exports funds to the AVM
func (*ExportTx) InputUTXOs ¶
InputUTXOs returns an empty set
func (*ExportTx) Key ¶
Key returns the public key of the signer of this transaction Precondition: tx.Verify() has been called and returned nil
func (*ExportTx) SemanticVerify ¶
SemanticVerify this transaction is valid.
func (*ExportTx) SyntacticVerify ¶
SyntacticVerify this transaction is well-formed Also populates [tx.Key] with the public key that signed this transaction
type Factory ¶
type Factory struct { ChainManager chains.Manager Validators validators.Manager StakingEnabled bool AVA ids.ID AVM ids.ID }
Factory can create new instances of the Platform Chain
type Genesis ¶
type Genesis struct { Accounts []Account `serialize:"true"` Validators *EventHeap `serialize:"true"` Chains []*CreateChainTx `serialize:"true"` Timestamp uint64 `serialize:"true"` }
Genesis represents a genesis state of the platform chain
type GetAccountArgs ¶
type GetAccountArgs struct { // Address of the account we want the information about Address ids.ShortID `json:"address"` }
GetAccountArgs are the arguments for calling GetAccount
type GetAccountReply ¶
type GetAccountReply struct { Address ids.ShortID `json:"address"` Nonce json.Uint64 `json:"nonce"` Balance json.Uint64 `json:"balance"` }
GetAccountReply is the response from calling GetAccount
type GetBlockchainStatusArgs ¶
type GetBlockchainStatusArgs struct {
BlockchainID string `json:"blockchainID"`
}
GetBlockchainStatusArgs is the arguments for calling GetBlockchainStatus [BlockchainID] is the blockchain to get the status of.
type GetBlockchainStatusReply ¶
type GetBlockchainStatusReply struct {
Status Status `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 GetCurrentValidatorsArgs ¶
type GetCurrentValidatorsArgs struct { // Subnet we're listing the validators of // If omitted, defaults to default subnet SubnetID ids.ID `json:"subnetID"` }
GetCurrentValidatorsArgs are the arguments for calling GetCurrentValidators
type GetCurrentValidatorsReply ¶
type GetCurrentValidatorsReply struct {
Validators []APIValidator `json:"validators"`
}
GetCurrentValidatorsReply are the results from calling GetCurrentValidators
type GetPendingValidatorsArgs ¶
type GetPendingValidatorsArgs struct { // Subnet we're getting the pending validators of // If omitted, defaults to default subnet SubnetID ids.ID `json:"subnetID"` }
GetPendingValidatorsArgs are the arguments for calling GetPendingValidators
type GetPendingValidatorsReply ¶
type GetPendingValidatorsReply struct {
Validators []APIValidator `json:"validators"`
}
GetPendingValidatorsReply are the results from calling GetPendingValidators
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 default subnet Subnets []APISubnet `json:"subnets"` }
GetSubnetsResponse is the response from calling GetSubnets
type ImportAVAArgs ¶
type ImportAVAArgs struct { // ID of the account that will receive the imported funds, and pay the transaction fee To ids.ShortID `json:"to"` // Next unused nonce of the account PayerNonce json.Uint64 `json:"payerNonce"` // User that controls the account Username string `json:"username"` Password string `json:"password"` }
ImportAVAArgs are the arguments to ImportAVA
type ImportTx ¶
type ImportTx struct { UnsignedImportTx `serialize:"true"` Sig [crypto.SECP256K1RSigLen]byte `serialize:"true"` Creds []verify.Verifiable `serialize:"true"` // The credentials of this transaction // contains filtered or unexported fields }
ImportTx imports funds from the AVM
func (*ImportTx) InputUTXOs ¶
InputUTXOs returns an empty set
func (*ImportTx) Key ¶
Key returns the public key of the signer of this transaction Precondition: tx.Verify() has been called and returned nil
func (*ImportTx) SemanticVerify ¶
SemanticVerify this transaction is valid.
func (*ImportTx) SyntacticVerify ¶
SyntacticVerify this transaction is well-formed Also populates [tx.Key] with the public key that signed this transaction
func (*ImportTx) UnsignedBytes ¶
UnsignedBytes returns the unsigned byte representation of an ImportTx
type IssueTxArgs ¶
type IssueTxArgs struct { // Tx being sent to the network Tx formatting.CB58 `json:"tx"` }
IssueTxArgs are the arguments to IssueTx
type IssueTxResponse ¶
type IssueTxResponse struct { // ID of transaction being sent to network TxID ids.ID `json:"txID"` }
IssueTxResponse is the response from IssueTx
type ListAccountsArgs ¶
type ListAccountsArgs struct { // List all of the accounts controlled by this user Username string `json:"username"` Password string `json:"password"` }
ListAccountsArgs are the arguments to ListAccounts
type ListAccountsReply ¶
type ListAccountsReply struct {
Accounts []APIAccount `json:"accounts"`
}
ListAccountsReply is the reply from ListAccounts
type ProposalBlock ¶
type ProposalBlock struct { CommonBlock `serialize:"true"` Tx ProposalTx `serialize:"true"` // 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 (*AddStakerTx)
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) Options ¶
func (pb *ProposalBlock) Options() [2]snowman.Block
Options returns the possible children of this block in preferential order.
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 ProposalTx ¶
type ProposalTx interface { // Attempts to verify this transaction with the provided state. SemanticVerify(database.Database) (onCommitDB *versiondb.Database, onAbortDB *versiondb.Database, onCommitFunc func(), onAbortFunc func(), err error) InitiallyPrefersCommit() bool // contains filtered or unexported methods }
ProposalTx is an operation that can be proposed
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 default subnet SubnetID ids.ID `json:"subnetID"` }
SampleValidatorsArgs are the arguments for calling SampleValidators
type SampleValidatorsReply ¶
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) AddDefaultSubnetDelegator ¶
func (service *Service) AddDefaultSubnetDelegator(_ *http.Request, args *AddDefaultSubnetDelegatorArgs, reply *CreateTxResponse) error
AddDefaultSubnetDelegator returns an unsigned transaction to add a delegator to the default subnet The returned unsigned transaction should be signed using Sign()
func (*Service) AddDefaultSubnetValidator ¶
func (service *Service) AddDefaultSubnetValidator(_ *http.Request, args *AddDefaultSubnetValidatorArgs, reply *CreateTxResponse) error
AddDefaultSubnetValidator returns an unsigned transaction to add a validator to the default subnet The returned unsigned transaction should be signed using Sign()
func (*Service) AddNonDefaultSubnetValidator ¶
func (service *Service) AddNonDefaultSubnetValidator(_ *http.Request, args *AddNonDefaultSubnetValidatorArgs, response *CreateTxResponse) error
AddNonDefaultSubnetValidator adds a validator to a subnet other than the default subnet Returns the unsigned transaction, which must be signed using Sign
func (*Service) CreateAccount ¶
func (service *Service) CreateAccount(_ *http.Request, args *CreateAccountArgs, reply *CreateAccountReply) error
CreateAccount creates a new account on the Platform Chain The account is controlled by [args.Username] The account's ID is [privKey].PublicKey().Address(), where [privKey] is a private key controlled by the user.
func (*Service) CreateBlockchain ¶
func (service *Service) CreateBlockchain(_ *http.Request, args *CreateBlockchainArgs, response *CreateTxResponse) error
CreateBlockchain returns an unsigned transaction to create a new blockchain Must be signed with the Subnet's control keys and with a key that pays the transaction fee before issuance
func (*Service) CreateSubnet ¶
func (service *Service) CreateSubnet(_ *http.Request, args *CreateSubnetArgs, response *CreateTxResponse) error
CreateSubnet returns an unsigned transaction to create a new subnet. The unsigned transaction must be signed with the key of [args.Payer]
func (*Service) ExportAVA ¶
func (service *Service) ExportAVA(_ *http.Request, args *ExportAVAArgs, response *CreateTxResponse) error
ExportAVA returns an unsigned transaction to export AVA from the P-Chain to the X-Chain. After this tx is accepted, the AVA must be imported on the X-Chain side. The unsigned transaction must be signed with the key of the account exporting the AVA and paying the transaction fee
func (*Service) GetAccount ¶
func (service *Service) GetAccount(_ *http.Request, args *GetAccountArgs, reply *GetAccountReply) error
GetAccount details given account ID
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) GetCurrentValidators ¶
func (service *Service) GetCurrentValidators(_ *http.Request, args *GetCurrentValidatorsArgs, reply *GetCurrentValidatorsReply) error
GetCurrentValidators returns the list of current validators
func (*Service) GetPendingValidators ¶
func (service *Service) GetPendingValidators(_ *http.Request, args *GetPendingValidatorsArgs, reply *GetPendingValidatorsReply) error
GetPendingValidators returns the list of current validators
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 not contain the default subnet
func (*Service) ImportAVA ¶
func (service *Service) ImportAVA(_ *http.Request, args *ImportAVAArgs, response *SignResponse) error
ImportAVA returns an unsigned transaction to import AVA from the X-Chain. The AVA must have already been exported from the X-Chain. The unsigned transaction must be signed with the key of the tx fee payer.
func (*Service) IssueTx ¶
func (service *Service) IssueTx(_ *http.Request, args *IssueTxArgs, response *IssueTxResponse) error
IssueTx issues the transaction [args.Tx] to the network
func (*Service) ListAccounts ¶
func (service *Service) ListAccounts(_ *http.Request, args *ListAccountsArgs, reply *ListAccountsReply) error
ListAccounts lists all of the accounts 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 SignArgs ¶
type SignArgs struct { // The bytes to sign // Must be the output of AddDefaultSubnetValidator Tx formatting.CB58 `json:"tx"` // The address of the key signing the bytes Signer ids.ShortID `json:"signer"` // User that controls Signer Username string `json:"username"` Password string `json:"password"` }
SignArgs are the arguments to Sign
type SignResponse ¶
type SignResponse struct { // The signed bytes Tx formatting.CB58 `json:"tx"` }
SignResponse is the response from Sign
type StandardBlock ¶
type StandardBlock struct { CommonDecisionBlock `serialize:"true"` Txs []DecisionTx `serialize:"true"` }
StandardBlock being accepted results in the transactions contained in the block to be accepted and committed to the chain.
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 (*StaticService) BuildGenesis(_ *http.Request, args *BuildGenesisArgs, reply *BuildGenesisReply) error
BuildGenesis build the genesis state of the Platform Chain (and thereby the AVA network.)
type Status ¶
type Status uint32
Status ...
List of possible status values Unknown Zero value, means the status is not known Preferred means the operation is known and preferred, but hasn't been decided yet Created means the operation occurred, but isn't managed locally Validating means the operation was accepted and is managed locally
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 { DurationValidator `serialize:"true"` // ID of the subnet this validator is validating Subnet ids.ID `serialize:"true"` }
SubnetValidator validates a blockchain on the AVA network.
func (*SubnetValidator) SubnetID ¶
func (v *SubnetValidator) SubnetID() ids.ID
SubnetID is the ID of the subnet this validator is validating
type TimedTx ¶
type TimedTx interface { ProposalTx Vdr() validators.Validator ID() ids.ID StartTime() time.Time EndTime() time.Time }
TimedTx ...
type UnsignedAddDefaultSubnetDelegatorTx ¶
type UnsignedAddDefaultSubnetDelegatorTx struct { DurationValidator `serialize:"true"` NetworkID uint32 `serialize:"true"` Nonce uint64 `serialize:"true"` Destination ids.ShortID `serialize:"true"` }
UnsignedAddDefaultSubnetDelegatorTx is an unsigned addDefaultSubnetDelegatorTx
type UnsignedAddDefaultSubnetValidatorTx ¶
type UnsignedAddDefaultSubnetValidatorTx struct { DurationValidator `serialize:"true"` NetworkID uint32 `serialize:"true"` Nonce uint64 `serialize:"true"` Destination ids.ShortID `serialize:"true"` }
UnsignedAddDefaultSubnetValidatorTx is an unsigned addDefaultSubnetValidatorTx
type UnsignedAddNonDefaultSubnetValidatorTx ¶
type UnsignedAddNonDefaultSubnetValidatorTx struct { // The validator SubnetValidator `serialize:"true"` // ID of the network NetworkID uint32 `serialize:"true"` // Next unused nonce of the account paying the tx fee Nonce uint64 `serialize:"true"` }
UnsignedAddNonDefaultSubnetValidatorTx is an unsigned addNonDefaultSubnetValidatorTx
type UnsignedCreateChainTx ¶
type UnsignedCreateChainTx struct { // ID of the network this blockchain exists on NetworkID uint32 `serialize:"true"` // ID of the Subnet that validates this blockchain SubnetID ids.ID `serialize:"true"` // Next unused nonce of account paying the transaction fee for this transaction. // Currently unused, as there are no tx fees. Nonce uint64 `serialize:"true"` // A human readable name for the chain; need not be unique ChainName string `serialize:"true"` // ID of the VM running on the new chain VMID ids.ID `serialize:"true"` // IDs of the feature extensions running on the new chain FxIDs []ids.ID `serialize:"true"` // Byte representation of genesis state of the new chain GenesisData []byte `serialize:"true"` }
UnsignedCreateChainTx is an unsigned CreateChainTx
type UnsignedCreateSubnetTx ¶
type UnsignedCreateSubnetTx struct { // NetworkID is the ID of the network this tx was issued on NetworkID uint32 `serialize:"true"` // Next unused nonce of account paying the transaction fee for this transaction. // Currently unused, as there are no tx fees. Nonce uint64 `serialize:"true"` // Each element in ControlKeys is the address of a public key // In order to add a validator to this subnet, a tx must be signed // with Threshold of these keys ControlKeys []ids.ShortID `serialize:"true"` Threshold uint16 `serialize:"true"` }
UnsignedCreateSubnetTx is an unsigned proposal to create a new subnet
type UnsignedExportTx ¶
type UnsignedExportTx struct { // ID of the network this blockchain exists on NetworkID uint32 `serialize:"true"` // Next unused nonce of account paying for this transaction. Nonce uint64 `serialize:"true"` Outs []*ava.TransferableOutput `serialize:"true"` // The outputs of this transaction }
UnsignedExportTx is an unsigned ExportTx
type UnsignedImportTx ¶
type UnsignedImportTx struct { // ID of the network this blockchain exists on NetworkID uint32 `serialize:"true"` // Next unused nonce of account paying the transaction fee and receiving the // inputs of this transaction. Nonce uint64 `serialize:"true"` // Account that this transaction is being sent by. This is needed to ensure the Credentials are replay safe. Account ids.ShortID `serialize:"true"` Ins []*ava.TransferableInput `serialize:"true"` // The inputs to this transaction }
UnsignedImportTx is an unsigned ImportTx
type VM ¶
VM implements the snowman.ChainVM interface
func (*VM) BuildBlock ¶
BuildBlock builds a block to be added to consensus
func (*VM) CreateHandlers ¶
func (vm *VM) CreateHandlers() map[string]*common.HTTPHandler
CreateHandlers returns a map where: * keys are API endpoint extensions * values are API handlers See API documentation for more information
func (*VM) CreateStaticHandlers ¶
func (vm *VM) CreateStaticHandlers() map[string]*common.HTTPHandler
CreateStaticHandlers implements the snowman.ChainVM interface
func (*VM) GetAtomicUTXOs ¶
GetAtomicUTXOs 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, msgs chan<- common.Message, fxs []*common.Fx, ) error
Initialize this blockchain. [vm.ChainManager] and [vm.Validators] must be set before this function is called.
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
Source Files ¶
- abort_block.go
- account.go
- add_default_subnet_delegator_tx.go
- add_default_subnet_validator_tx.go
- add_nondefault_subnet_validator_tx.go
- advance_time_tx.go
- atomic_block.go
- commit_block.go
- common_blocks.go
- create_chain_tx.go
- create_subnet_tx.go
- event_heap.go
- export_tx.go
- factory.go
- import_tx.go
- proposal_block.go
- reward.go
- reward_validator_tx.go
- service.go
- standard_block.go
- state.go
- static_service.go
- status.go
- subnet.go
- user.go
- validator.go
- vm.go