Documentation ¶
Index ¶
- Constants
- Variables
- func FormatEthAddress(addr common.Address) string
- func GetEthAddress(privKey *crypto.PrivateKeySECP256K1R) common.Address
- func IsSortedAndUniqueEVMInputs(inputs []EVMInput) bool
- func IsSortedAndUniqueEVMOutputs(outputs []EVMOutput) bool
- func IsSortedEVMOutputs(outputs []EVMOutput) bool
- func ParseEthAddress(addrStr string) (common.Address, error)
- func PublicKeyToEthAddress(pubKey *crypto.PublicKeySECP256K1R) common.Address
- func SortEVMInputsAndSigners(inputs []EVMInput, signers [][]*crypto.PrivateKeySECP256K1R)
- func SortEVMOutputs(outputs []EVMOutput)
- type Admin
- func (p *Admin) LockProfile(r *http.Request, args *struct{}, reply *api.SuccessResponse) error
- func (p *Admin) MemoryProfile(r *http.Request, args *struct{}, reply *api.SuccessResponse) error
- func (p *Admin) SetLogLevel(r *http.Request, args *SetLogLevelArgs, reply *api.SuccessResponse) error
- func (p *Admin) StartCPUProfiler(r *http.Request, args *struct{}, reply *api.SuccessResponse) error
- func (p *Admin) StopCPUProfiler(r *http.Request, args *struct{}, reply *api.SuccessResponse) error
- type AvaxAPI
- func (service *AvaxAPI) Export(_ *http.Request, args *ExportArgs, response *api.JSONTxID) error
- func (service *AvaxAPI) ExportAVAX(_ *http.Request, args *ExportAVAXArgs, response *api.JSONTxID) error
- func (service *AvaxAPI) ExportKey(r *http.Request, args *ExportKeyArgs, reply *ExportKeyReply) error
- func (service *AvaxAPI) GetAtomicTx(r *http.Request, args *api.GetTxArgs, reply *FormattedTx) error
- func (service *AvaxAPI) GetAtomicTxStatus(r *http.Request, args *api.JSONTxID, reply *GetAtomicTxStatusReply) error
- func (service *AvaxAPI) GetUTXOs(r *http.Request, args *api.GetUTXOsArgs, reply *api.GetUTXOsReply) error
- func (service *AvaxAPI) Import(_ *http.Request, args *ImportArgs, response *api.JSONTxID) error
- func (service *AvaxAPI) ImportAVAX(_ *http.Request, args *ImportArgs, response *api.JSONTxID) error
- func (service *AvaxAPI) ImportKey(r *http.Request, args *ImportKeyArgs, reply *api.JSONAddress) error
- func (service *AvaxAPI) IssueTx(r *http.Request, args *api.FormattedTx, response *api.JSONTxID) error
- func (service *AvaxAPI) Version(r *http.Request, args *struct{}, reply *VersionReply) error
- type Batch
- type Block
- func (b *Block) Accept() error
- func (b *Block) Bytes() []byte
- func (b *Block) Height() uint64
- func (b *Block) ID() ids.ID
- func (b *Block) Parent() ids.ID
- func (b *Block) Reject() error
- func (b *Block) SetStatus(status choices.Status)
- func (b *Block) Status() choices.Status
- func (b *Block) String() string
- func (b *Block) Timestamp() time.Time
- func (b *Block) Verify() error
- type BlockValidator
- type BuildGenesisReply
- type Client
- func (c *Client) Export(user api.UserPass, amount uint64, to string, assetID string) (ids.ID, error)
- func (c *Client) ExportAVAX(user api.UserPass, amount uint64, to string) (ids.ID, error)
- func (c *Client) ExportKey(user api.UserPass, addr string) (string, string, error)
- func (c *Client) GetAtomicTx(txID ids.ID) ([]byte, error)
- func (c *Client) GetAtomicTxStatus(txID ids.ID) (Status, error)
- func (c *Client) GetAtomicUTXOs(addrs []string, sourceChain string, limit uint32, ...) ([][]byte, api.Index, error)
- func (c *Client) Import(user api.UserPass, to, sourceChain string) (ids.ID, error)
- func (c *Client) ImportKey(user api.UserPass, privateKey string) (string, error)
- func (c *Client) IssueTx(txBytes []byte) (ids.ID, error)
- func (c *Client) ListAddresses(user api.UserPass) ([]string, error)
- func (c *Client) LockProfile() (bool, error)
- func (c *Client) MemoryProfile() (bool, error)
- func (c *Client) SetLogLevel(level log.Lvl) (bool, error)
- func (c *Client) StartCPUProfiler() (bool, error)
- func (c *Client) StopCPUProfiler() (bool, error)
- type Config
- type Database
- type Duration
- type EVMInput
- type EVMOutput
- type ExportAVAXArgs
- type ExportArgs
- type ExportKeyArgs
- type ExportKeyReply
- type Factory
- type FormattedTx
- type GetAcceptedFrontReply
- type GetAtomicTxStatusReply
- type GossipHandler
- type ImportArgs
- type ImportKeyArgs
- type Mempool
- func (m *Mempool) AddTx(tx *Tx) error
- func (m *Mempool) CancelCurrentTx(txID ids.ID)
- func (m *Mempool) CancelCurrentTxs()
- func (m *Mempool) DiscardCurrentTx(txID ids.ID)
- func (m *Mempool) DiscardCurrentTxs()
- func (m *Mempool) ForceAddTx(tx *Tx) error
- func (m *Mempool) GetNewTxs() []*Tx
- func (m *Mempool) GetPendingTx(txID ids.ID) (*Tx, bool)
- func (m *Mempool) GetTx(txID ids.ID) (*Tx, bool, bool)
- func (m *Mempool) IssueCurrentTxs()
- func (m *Mempool) Len() int
- func (m *Mempool) NextTx() (*Tx, bool)
- func (m *Mempool) RemoveTx(txID ids.ID)
- type NetAPI
- type Network
- type SetLogLevelArgs
- type SnowmanAPI
- type StaticService
- type Status
- type Tx
- type UnsignedAtomicTx
- type UnsignedExportTx
- func (tx *UnsignedExportTx) Accept() (ids.ID, *atomic.Requests, error)
- func (tx *UnsignedExportTx) Burned(assetID ids.ID) (uint64, error)
- func (tx *UnsignedExportTx) EVMStateTransfer(ctx *snow.Context, state *state.StateDB) error
- func (tx *UnsignedExportTx) GasUsed(fixedFee bool) (uint64, error)
- func (tx *UnsignedExportTx) InputUTXOs() ids.Set
- func (tx *UnsignedExportTx) SemanticVerify(vm *VM, stx *Tx, _ *Block, baseFee *big.Int, rules params.Rules) error
- func (tx *UnsignedExportTx) Verify(ctx *snow.Context, rules params.Rules) error
- type UnsignedImportTx
- func (tx *UnsignedImportTx) Accept() (ids.ID, *atomic.Requests, error)
- func (tx *UnsignedImportTx) Burned(assetID ids.ID) (uint64, error)
- func (tx *UnsignedImportTx) EVMStateTransfer(ctx *snow.Context, state *state.StateDB) error
- func (tx *UnsignedImportTx) GasUsed(fixedFee bool) (uint64, error)
- func (tx *UnsignedImportTx) InputUTXOs() ids.Set
- func (tx *UnsignedImportTx) SemanticVerify(vm *VM, stx *Tx, parent *Block, baseFee *big.Int, rules params.Rules) error
- func (tx *UnsignedImportTx) Verify(ctx *snow.Context, rules params.Rules) error
- type UnsignedTx
- type VM
- func (vm *VM) AppGossip(nodeID ids.ShortID, msg []byte) error
- func (vm *VM) AppRequest(nodeID ids.ShortID, requestID uint32, deadline time.Time, request []byte) error
- func (vm *VM) AppRequestFailed(nodeID ids.ShortID, requestID uint32) error
- func (vm *VM) AppResponse(nodeID ids.ShortID, requestID uint32, response []byte) error
- func (vm *VM) Bootstrapped() error
- func (vm *VM) Bootstrapping() error
- func (vm *VM) Clock() *mockable.Clock
- func (vm *VM) Codec() codec.Manager
- func (vm *VM) CodecRegistry() codec.Registry
- func (vm *VM) Connected(nodeID ids.ShortID) error
- func (vm *VM) CreateHandlers() (map[string]*commonEng.HTTPHandler, error)
- func (vm *VM) CreateStaticHandlers() (map[string]*commonEng.HTTPHandler, error)
- func (vm *VM) Disconnected(nodeID ids.ShortID) error
- func (vm *VM) FormatAddress(chainID ids.ID, addr ids.ShortID) (string, error)
- func (vm *VM) FormatLocalAddress(addr ids.ShortID) (string, error)
- func (vm *VM) GetActivationTime() time.Time
- func (vm *VM) GetAtomicUTXOs(chainID ids.ID, addrs ids.ShortSet, startAddr ids.ShortID, startUTXOID ids.ID, ...) ([]*avax.UTXO, ids.ShortID, ids.ID, error)
- func (vm *VM) GetCurrentNonce(address common.Address) (uint64, error)
- func (vm *VM) GetSpendableAVAXWithFee(keys []*crypto.PrivateKeySECP256K1R, amount uint64, cost uint64, ...) ([]EVMInput, [][]*crypto.PrivateKeySECP256K1R, error)
- func (vm *VM) GetSpendableFunds(keys []*crypto.PrivateKeySECP256K1R, assetID ids.ID, amount uint64) ([]EVMInput, [][]*crypto.PrivateKeySECP256K1R, error)
- func (vm *VM) HealthCheck() (interface{}, error)
- func (vm *VM) Initialize(ctx *snow.Context, dbManager manager.Manager, genesisBytes []byte, ...) error
- func (vm *VM) Logger() logging.Logger
- func (vm *VM) NewBlockBuilder(notifyBuildBlockChan chan<- commonEng.Message) *blockBuilder
- func (vm *VM) NewNetwork(appSender commonEng.AppSender) Network
- func (vm *VM) ParseAddress(addrStr string) (ids.ID, ids.ShortID, error)
- func (vm *VM) ParseLocalAddress(addrStr string) (ids.ShortID, error)
- func (vm *VM) SetPreference(blkID ids.ID) error
- func (vm *VM) Shutdown() error
- func (vm *VM) Version() (string, error)
- type VersionReply
- type Web3API
Constants ¶
const ( GenesisTestAddr = "0x751a0b96e1042bee789452ecb20253fba40dbe85" GenesisTestKey = "0xabd71b35d559563fea757f0f5edbde286fb8c043105b15abb7cd57189306d7d1" )
test constants
Variables ¶
var ( TxBytesGas uint64 = 1 EVMOutputGas uint64 = (common.AddressLength + wrappers.LongLen + hashing.HashLen) * TxBytesGas EVMInputGas uint64 = (common.AddressLength+wrappers.LongLen+hashing.HashLen+wrappers.LongLen)*TxBytesGas + secp256k1fx.CostPerSignature )
Constants for calculating the gas consumed by atomic transactions
var ( // GitCommit is set by the build script GitCommit string // Version is the version of Coreth Version string )
var Codec codec.Manager
Codec does serialization and deserialization
var ( // ID this VM should be referenced by ID = ids.ID{'e', 'v', 'm'} )
Functions ¶
func FormatEthAddress ¶ added in v0.3.5
FormatEthAddress formats [addr] into a string
func GetEthAddress ¶ added in v0.2.12
func GetEthAddress(privKey *crypto.PrivateKeySECP256K1R) common.Address
GetEthAddress returns the ethereum address derived from [privKey]
func IsSortedAndUniqueEVMInputs ¶ added in v0.3.5
IsSortedAndUniqueEVMInputs returns true if the EVM Inputs are sorted and unique based on the account addresses
func IsSortedAndUniqueEVMOutputs ¶ added in v0.3.5
IsSortedAndUniqueEVMOutputs returns true if the EVMOutputs are sorted and unique based on the account addresses and assetIDs
func IsSortedEVMOutputs ¶ added in v0.4.0
IsSortedEVMOutputs returns true if the EVMOutputs are sorted based on the account addresses and assetIDs
func ParseEthAddress ¶ added in v0.3.5
ParseEthAddress parses [addrStr] and returns an Ethereum address
func PublicKeyToEthAddress ¶ added in v0.2.12
func PublicKeyToEthAddress(pubKey *crypto.PublicKeySECP256K1R) common.Address
PublicKeyToEthAddress returns the ethereum address derived from [pubKey]
func SortEVMInputsAndSigners ¶ added in v0.3.5
func SortEVMInputsAndSigners(inputs []EVMInput, signers [][]*crypto.PrivateKeySECP256K1R)
SortEVMInputsAndSigners sorts the list of EVMInputs based on the addresses and assetIDs
func SortEVMOutputs ¶ added in v0.3.5
func SortEVMOutputs(outputs []EVMOutput)
SortEVMOutputs sorts the list of EVMOutputs based on the addresses and assetIDs of the outputs
Types ¶
type Admin ¶ added in v0.7.4
type Admin struct {
// contains filtered or unexported fields
}
Admin is the API service for admin API calls
func NewAdminService ¶ added in v0.7.4
func (*Admin) LockProfile ¶ added in v0.7.4
LockProfile runs a mutex profile writing to the specified file
func (*Admin) MemoryProfile ¶ added in v0.7.4
MemoryProfile runs a memory profile writing to the specified file
func (*Admin) SetLogLevel ¶ added in v0.7.4
func (p *Admin) SetLogLevel(r *http.Request, args *SetLogLevelArgs, reply *api.SuccessResponse) error
func (*Admin) StartCPUProfiler ¶ added in v0.7.4
StartCPUProfiler starts a cpu profile writing to the specified file
func (*Admin) StopCPUProfiler ¶ added in v0.7.4
StopCPUProfiler stops the cpu profile
type AvaxAPI ¶ added in v0.2.15
type AvaxAPI struct {
// contains filtered or unexported fields
}
AvaxAPI offers Avalanche network related API methods
func (*AvaxAPI) Export ¶ added in v0.3.1
Export exports an asset from the C-Chain to the X-Chain It must be imported on the X-Chain to complete the transfer
func (*AvaxAPI) ExportAVAX ¶ added in v0.2.15
func (service *AvaxAPI) ExportAVAX(_ *http.Request, args *ExportAVAXArgs, response *api.JSONTxID) error
ExportAVAX exports AVAX from the C-Chain to the X-Chain It must be imported on the X-Chain to complete the transfer
func (*AvaxAPI) ExportKey ¶ added in v0.2.15
func (service *AvaxAPI) ExportKey(r *http.Request, args *ExportKeyArgs, reply *ExportKeyReply) error
ExportKey returns a private key from the provided user
func (*AvaxAPI) GetAtomicTx ¶ added in v0.5.2
GetAtomicTx returns the specified transaction
func (*AvaxAPI) GetAtomicTxStatus ¶ added in v0.5.2
func (service *AvaxAPI) GetAtomicTxStatus(r *http.Request, args *api.JSONTxID, reply *GetAtomicTxStatusReply) error
GetAtomicTxStatus returns the status of the specified transaction
func (*AvaxAPI) GetUTXOs ¶ added in v0.3.14
func (service *AvaxAPI) GetUTXOs(r *http.Request, args *api.GetUTXOsArgs, reply *api.GetUTXOsReply) error
GetUTXOs gets all utxos for passed in addresses
func (*AvaxAPI) Import ¶ added in v0.3.1
Import issues a transaction to import AVAX from the X-chain. The AVAX must have already been exported from the X-Chain.
func (*AvaxAPI) ImportAVAX ¶ added in v0.2.15
ImportAVAX is a deprecated name for Import.
func (*AvaxAPI) ImportKey ¶ added in v0.2.15
func (service *AvaxAPI) ImportKey(r *http.Request, args *ImportKeyArgs, reply *api.JSONAddress) error
ImportKey adds a private key to the provided user
type Batch ¶
Batch implements ethdb.Batch
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block implements the snowman.Block interface
func (*Block) Reject ¶
Reject implements the snowman.Block interface If [b] contains an atomic transaction, attempt to re-issue it
func (*Block) SetStatus ¶ added in v0.5.2
SetStatus implements the InternalBlock interface allowing ChainState to set the status on an existing block
type BlockValidator ¶ added in v0.4.0
type BuildGenesisReply ¶ added in v0.3.15
type BuildGenesisReply struct { Bytes string `json:"bytes"` Encoding formatting.Encoding `json:"encoding"` }
BuildGenesisReply is the reply from BuildGenesis
type Client ¶ added in v0.3.15
type Client struct {
// contains filtered or unexported fields
}
Client ...
func NewCChainClient ¶ added in v0.3.15
NewCChainClient returns a Client for interacting with the C Chain
func (*Client) Export ¶ added in v0.3.15
func (c *Client) Export( user api.UserPass, amount uint64, to string, assetID string, ) (ids.ID, error)
Export sends an asset from this chain to the P/C-Chain. After this tx is accepted, the AVAX must be imported to the P/C-chain with an importTx. Returns the ID of the newly created atomic transaction
func (*Client) ExportAVAX ¶ added in v0.3.15
ExportAVAX sends AVAX from this chain to the address specified by [to]. Returns the ID of the newly created atomic transaction
func (*Client) ExportKey ¶ added in v0.3.15
ExportKey returns the private key corresponding to [addr] controlled by [user] in both Avalanche standard format and hex format
func (*Client) GetAtomicTx ¶ added in v0.5.2
GetAtomicTx returns the byte representation of [txID]
func (*Client) GetAtomicTxStatus ¶ added in v0.5.2
GetAtomicTxStatus returns the status of [txID]
func (*Client) GetAtomicUTXOs ¶ added in v0.5.2
func (c *Client) GetAtomicUTXOs(addrs []string, sourceChain string, limit uint32, startAddress, startUTXOID string) ([][]byte, api.Index, error)
GetAtomicUTXOs returns the byte representation of the atomic UTXOs controlled by [addresses] from [sourceChain]
func (*Client) Import ¶ added in v0.3.15
Import sends an import transaction to import funds from [sourceChain] and returns the ID of the newly created transaction
func (*Client) IssueTx ¶ added in v0.3.15
IssueTx issues a transaction to a node and returns the TxID
func (*Client) ListAddresses ¶ added in v0.3.15
ListAddresses returns all addresses on this chain controlled by [user]
func (*Client) LockProfile ¶ added in v0.7.4
func (*Client) MemoryProfile ¶ added in v0.7.4
func (*Client) SetLogLevel ¶ added in v0.7.4
SetLogLevel dynamically sets the log level for the C Chain
func (*Client) StartCPUProfiler ¶ added in v0.7.4
func (*Client) StopCPUProfiler ¶ added in v0.7.4
type Config ¶ added in v0.5.4
type Config struct { // Coreth APIs SnowmanAPIEnabled bool `json:"snowman-api-enabled"` CorethAdminAPIEnabled bool `json:"coreth-admin-api-enabled"` CorethAdminAPIDir string `json:"coreth-admin-api-dir"` NetAPIEnabled bool `json:"net-api-enabled"` // Continuous Profiler ContinuousProfilerDir string `json:"continuous-profiler-dir"` // If set to non-empty string creates a continuous profiler ContinuousProfilerFrequency Duration `json:"continuous-profiler-frequency"` // Frequency to run continuous profiler if enabled ContinuousProfilerMaxFiles int `json:"continuous-profiler-max-files"` // Maximum number of files to maintain // Coreth API Gas/Price Caps RPCGasCap uint64 `json:"rpc-gas-cap"` RPCTxFeeCap float64 `json:"rpc-tx-fee-cap"` // Eth APIs EthAPIEnabled bool `json:"eth-api-enabled"` PersonalAPIEnabled bool `json:"personal-api-enabled"` TxPoolAPIEnabled bool `json:"tx-pool-api-enabled"` DebugAPIEnabled bool `json:"debug-api-enabled"` Web3APIEnabled bool `json:"web3-api-enabled"` // Eth Settings Preimages bool `json:"preimages-enabled"` Pruning bool `json:"pruning-enabled"` SnapshotAsync bool `json:"snapshot-async"` SnapshotVerify bool `json:"snapshot-verification-enabled"` // Metric Settings MetricsEnabled bool `json:"metrics-enabled"` MetricsExpensiveEnabled bool `json:"metrics-expensive-enabled"` // API Settings LocalTxsEnabled bool `json:"local-txs-enabled"` APIMaxDuration Duration `json:"api-max-duration"` WSCPURefillRate Duration `json:"ws-cpu-refill-rate"` WSCPUMaxStored Duration `json:"ws-cpu-max-stored"` MaxBlocksPerRequest int64 `json:"api-max-blocks-per-request"` AllowUnfinalizedQueries bool `json:"allow-unfinalized-queries"` AllowUnprotectedTxs bool `json:"allow-unprotected-txs"` // Keystore Settings KeystoreDirectory string `json:"keystore-directory"` // both absolute and relative supported KeystoreExternalSigner string `json:"keystore-external-signer"` KeystoreInsecureUnlockAllowed bool `json:"keystore-insecure-unlock-allowed"` // Gossip Settings RemoteTxGossipOnlyEnabled bool `json:"remote-tx-gossip-only-enabled"` TxRegossipFrequency Duration `json:"tx-regossip-frequency"` TxRegossipMaxSize int `json:"tx-regossip-max-size"` // Log level LogLevel string `json:"log-level"` }
Config ...
func (Config) EthAPIs ¶ added in v0.5.4
EthAPIs returns an array of strings representing the Eth APIs that should be enabled
func (Config) EthBackendSettings ¶ added in v0.5.4
func (*Config) SetDefaults ¶ added in v0.5.4
func (c *Config) SetDefaults()
type Database ¶
Database implements ethdb.Database
func (Database) NewIterator ¶
NewIterator implements ethdb.Database
Note: This method assumes that the prefix is NOT part of the start, so there's no need for the caller to prepend the prefix to the start.
type Duration ¶ added in v0.5.4
func (*Duration) UnmarshalJSON ¶ added in v0.5.4
type EVMInput ¶ added in v0.2.12
type EVMInput struct { Address common.Address `serialize:"true" json:"address"` Amount uint64 `serialize:"true" json:"amount"` AssetID ids.ID `serialize:"true" json:"assetID"` Nonce uint64 `serialize:"true" json:"nonce"` }
EVMInput defines an input created from the EVM state to fund export transactions
type EVMOutput ¶ added in v0.2.12
type EVMOutput struct { Address common.Address `serialize:"true" json:"address"` Amount uint64 `serialize:"true" json:"amount"` AssetID ids.ID `serialize:"true" json:"assetID"` }
EVMOutput defines an output that is added to the EVM state created by import transactions
type ExportAVAXArgs ¶ added in v0.2.12
type ExportAVAXArgs struct { api.UserPass // Fee that should be used when creating the tx BaseFee *hexutil.Big `json:"baseFee"` // Amount of asset 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 ExportArgs ¶ added in v0.3.1
type ExportArgs struct { ExportAVAXArgs // AssetID of the tokens AssetID string `json:"assetID"` }
ExportArgs are the arguments to Export
type ExportKeyArgs ¶ added in v0.2.12
ExportKeyArgs are arguments for ExportKey
type ExportKeyReply ¶ added in v0.2.12
type ExportKeyReply struct { // The decrypted PrivateKey for the Address provided in the arguments PrivateKey string `json:"privateKey"` PrivateKeyHex string `json:"privateKeyHex"` }
ExportKeyReply is the response for ExportKey
type FormattedTx ¶ added in v0.5.2
type FormattedTx struct { api.FormattedTx BlockHeight *json.Uint64 `json:"blockHeight,omitempty"` }
type GetAcceptedFrontReply ¶
type GetAcceptedFrontReply struct { Hash common.Hash `json:"hash"` Number *big.Int `json:"number"` }
GetAcceptedFrontReply defines the reply that will be sent from the GetAcceptedFront API call
type GetAtomicTxStatusReply ¶ added in v0.5.2
type GetAtomicTxStatusReply struct { Status Status `json:"status"` BlockHeight *json.Uint64 `json:"blockHeight,omitempty"` }
GetAtomicTxStatusReply defines the GetAtomicTxStatus replies returned from the API
type GossipHandler ¶ added in v0.7.0
type GossipHandler struct { message.NoopHandler // contains filtered or unexported fields }
func (*GossipHandler) HandleAtomicTx ¶ added in v0.7.0
func (*GossipHandler) HandleEthTxs ¶ added in v0.7.0
type ImportArgs ¶ added in v0.3.1
type ImportArgs struct { api.UserPass // Fee that should be used when creating the tx BaseFee *hexutil.Big `json:"baseFee"` // Chain the funds are coming from SourceChain string `json:"sourceChain"` // The address that will receive the imported funds To string `json:"to"` }
ImportArgs are arguments for passing into Import requests
type ImportKeyArgs ¶ added in v0.2.12
ImportKeyArgs are arguments for ImportKey
type Mempool ¶ added in v0.5.2
type Mempool struct { // AVAXAssetID is the fee paying currency of any atomic transaction AVAXAssetID ids.ID // Pending is a channel of length one, which the mempool ensures has an item on // it as long as there is an unissued transaction remaining in [txs] Pending chan struct{} // contains filtered or unexported fields }
Mempool is a simple mempool for atomic transactions
func NewMempool ¶ added in v0.5.2
NewMempool returns a Mempool with [maxSize]
func (*Mempool) AddTx ¶ added in v0.5.2
Add attempts to add [tx] to the mempool and returns an error if it could not be addeed to the mempool.
func (*Mempool) CancelCurrentTx ¶ added in v0.5.2
CancelCurrentTx marks the attempt to issue [txID] as being aborted. This should be called after NextTx returns [txID] and the transaction [txID] cannot be included in the block, but should not be discarded. For example, CancelCurrentTx should be called if including the transaction will put the block above the atomic tx gas limit.
func (*Mempool) CancelCurrentTxs ¶ added in v0.8.0
func (m *Mempool) CancelCurrentTxs()
[CancelCurrentTxs] marks the attempt to issue [currentTxs] as being aborted. If this is called after a buildBlock error caused by the atomic transaction, then DiscardCurrentTx should have been called such that this call will have no effect and should not re-issue the invalid tx.
func (*Mempool) DiscardCurrentTx ¶ added in v0.5.2
DiscardCurrentTx marks a [tx] in the [currentTxs] map as invalid and aborts the attempt to issue it since it failed verification.
func (*Mempool) DiscardCurrentTxs ¶ added in v0.8.0
func (m *Mempool) DiscardCurrentTxs()
DiscardCurrentTxs marks all txs in [currentTxs] as discarded.
func (*Mempool) ForceAddTx ¶ added in v0.7.1
forceAddTx forcibly adds a *Tx to the mempool and bypasses all verification.
func (*Mempool) GetNewTxs ¶ added in v0.7.0
GetNewTxs returns the array of [newTxs] and replaces it with a new array.
func (*Mempool) GetPendingTx ¶ added in v0.7.0
GetPendingTx returns the transaction [txID] and true if it is currently in the [txHeap] waiting to be issued into a block. Returns nil, false otherwise.
func (*Mempool) GetTx ¶ added in v0.5.2
GetTx returns the transaction [txID] if it was issued by this node and returns whether it was dropped and whether it exists.
func (*Mempool) IssueCurrentTxs ¶ added in v0.8.0
func (m *Mempool) IssueCurrentTxs()
IssueCurrentTx marks [currentTx] as issued if there is one
type NetAPI ¶
type NetAPI struct {
// contains filtered or unexported fields
}
NetAPI offers network related API methods
func (*NetAPI) Listening ¶
Listening returns an indication if the node is listening for network connections.
type Network ¶ added in v0.7.0
type Network interface { // Message handling AppRequestFailed(nodeID ids.ShortID, requestID uint32) error AppRequest(nodeID ids.ShortID, requestID uint32, deadline time.Time, msgBytes []byte) error AppResponse(nodeID ids.ShortID, requestID uint32, msgBytes []byte) error AppGossip(nodeID ids.ShortID, msgBytes []byte) error // Gossip entrypoints GossipAtomicTxs(txs []*Tx) error GossipEthTxs(txs []*types.Transaction) error }
type SetLogLevelArgs ¶ added in v0.7.4
type SetLogLevelArgs struct {
Level string `json:"level"`
}
type SnowmanAPI ¶
type SnowmanAPI struct {
// contains filtered or unexported fields
}
SnowmanAPI introduces snowman specific functionality to the evm
func (*SnowmanAPI) GetAcceptedFront ¶
func (api *SnowmanAPI) GetAcceptedFront(ctx context.Context) (*GetAcceptedFrontReply, error)
GetAcceptedFront returns the last accepted block's hash and height
func (*SnowmanAPI) IssueBlock ¶ added in v0.3.7
func (api *SnowmanAPI) IssueBlock(ctx context.Context) error
IssueBlock to the chain
type StaticService ¶
type StaticService struct{}
StaticService defines the static API services exposed by the evm
func (*StaticService) BuildGenesis ¶
func (*StaticService) BuildGenesis(_ context.Context, args *core.Genesis) (*BuildGenesisReply, error)
BuildGenesis returns the UTXOs such that at least one address in [args.Addresses] is referenced in the UTXO.
type Status ¶ added in v0.5.2
type Status uint32
Status ...
List of possible status values Unknown Zero value, means the status is not known Dropped means the transaction was in the mempool, but was dropped because it failed verification Processing means the transaction is in the mempool Accepted means the transaction was accepted
func (Status) MarshalJSON ¶ added in v0.5.2
MarshalJSON ...
func (*Status) UnmarshalJSON ¶ added in v0.5.2
UnmarshalJSON ...
type Tx ¶ added in v0.2.12
type Tx struct { // The body of this transaction UnsignedAtomicTx `serialize:"true" json:"unsignedTx"` // The credentials of this transaction Creds []verify.Verifiable `serialize:"true" json:"credentials"` }
Tx is a signed transaction
func ExtractAtomicTxs ¶ added in v0.8.2
extractAtomicTxs returns the atomic transactions in [atomicTxBytes] if they exist.
func ExtractAtomicTxsPostApricotPhase5 ¶ added in v0.8.2
ExtractAtomicTxsPostApricotPhase5 extracts a slice of atomic transactions from [atomicTxBytes]. Note: this function assumes [atomicTxBytes] is non-empty.
func ExtractAtomicTxsPreApricotPhase5 ¶ added in v0.8.2
ExtractAtomicTxsPreApricotPhase5 extracts a singular atomic transaction from [atomicTxBytes] and returns a slice of atomic transactions for compatibility with the type returned post ApricotPhase5. Note: this function assumes [atomicTxBytes] is non-empty.
func (*Tx) BlockFeeContribution ¶ added in v0.7.0
func (tx *Tx) BlockFeeContribution(fixedFee bool, avaxAssetID ids.ID, baseFee *big.Int) (*big.Int, *big.Int, error)
BlockFeeContribution calculates how much AVAX towards the block fee contribution was paid for via this transaction denominated in [avaxAssetID] with [baseFee] used to calculate the cost of this transaction. This function also returns the [gasUsed] by the transaction for inclusion in the [baseFee] algorithm.
type UnsignedAtomicTx ¶ added in v0.2.12
type UnsignedAtomicTx interface { UnsignedTx // UTXOs this tx consumes InputUTXOs() ids.Set // Verify attempts to verify that the transaction is well formed Verify(ctx *snow.Context, rules params.Rules) error // Attempts to verify this transaction with the provided state. SemanticVerify(vm *VM, stx *Tx, parent *Block, baseFee *big.Int, rules params.Rules) error // Accept this transaction with the additionally provided state transitions. Accept() (ids.ID, *atomic.Requests, error) EVMStateTransfer(ctx *snow.Context, state *state.StateDB) error }
UnsignedAtomicTx is an unsigned operation that can be atomically accepted
type UnsignedExportTx ¶ added in v0.2.12
type UnsignedExportTx struct { avax.Metadata // ID of the network on which this tx was issued NetworkID uint32 `serialize:"true" json:"networkID"` // ID of this blockchain. BlockchainID ids.ID `serialize:"true" json:"blockchainID"` // Which chain to send the funds to DestinationChain ids.ID `serialize:"true" json:"destinationChain"` // Inputs Ins []EVMInput `serialize:"true" json:"inputs"` // Outputs that are exported to the chain ExportedOutputs []*avax.TransferableOutput `serialize:"true" json:"exportedOutputs"` }
UnsignedExportTx is an unsigned ExportTx
func (*UnsignedExportTx) Burned ¶ added in v0.6.0
func (tx *UnsignedExportTx) Burned(assetID ids.ID) (uint64, error)
Amount of [assetID] burned by this transaction
func (*UnsignedExportTx) EVMStateTransfer ¶ added in v0.2.12
EVMStateTransfer executes the state update from the atomic export transaction
func (*UnsignedExportTx) GasUsed ¶ added in v0.7.0
func (tx *UnsignedExportTx) GasUsed(fixedFee bool) (uint64, error)
func (*UnsignedExportTx) InputUTXOs ¶ added in v0.2.12
func (tx *UnsignedExportTx) InputUTXOs() ids.Set
InputUTXOs returns a set of all the hash(address:nonce) exporting funds.
type UnsignedImportTx ¶ added in v0.2.12
type UnsignedImportTx struct { avax.Metadata // ID of the network on which this tx was issued NetworkID uint32 `serialize:"true" json:"networkID"` // ID of this blockchain. BlockchainID ids.ID `serialize:"true" json:"blockchainID"` // 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"` // Outputs Outs []EVMOutput `serialize:"true" json:"outputs"` }
UnsignedImportTx is an unsigned ImportTx
func (*UnsignedImportTx) Accept ¶ added in v0.2.12
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) Burned ¶ added in v0.6.0
func (tx *UnsignedImportTx) Burned(assetID ids.ID) (uint64, error)
Amount of [assetID] burned by this transaction
func (*UnsignedImportTx) EVMStateTransfer ¶ added in v0.2.12
EVMStateTransfer performs the state transfer to increase the balances of accounts accordingly with the imported EVMOutputs
func (*UnsignedImportTx) GasUsed ¶ added in v0.7.0
func (tx *UnsignedImportTx) GasUsed(fixedFee bool) (uint64, error)
func (*UnsignedImportTx) InputUTXOs ¶ added in v0.2.12
func (tx *UnsignedImportTx) InputUTXOs() ids.Set
InputUTXOs returns the UTXOIDs of the imported funds
type UnsignedTx ¶ added in v0.2.12
type UnsignedTx interface { Initialize(unsignedBytes, signedBytes []byte) ID() ids.ID GasUsed(fixedFee bool) (uint64, error) Burned(assetID ids.ID) (uint64, error) UnsignedBytes() []byte Bytes() []byte }
UnsignedTx is an unsigned transaction
type VM ¶
type VM struct { // *chain.State helps to implement the VM interface by wrapping blocks // with an efficient caching layer. *chain.State // contains filtered or unexported fields }
VM implements the snowman.ChainVM interface
func (*VM) AppRequest ¶ added in v0.6.3
func (*VM) AppRequestFailed ¶ added in v0.6.3
func (*VM) AppResponse ¶ added in v0.6.3
func (*VM) Bootstrapped ¶ added in v0.2.4
Bootstrapped notifies this VM that the consensus engine has finished bootstrapping
func (*VM) Bootstrapping ¶ added in v0.2.4
Bootstrapping notifies this VM that the consensus engine is performing bootstrapping
func (*VM) CodecRegistry ¶ added in v0.3.15
CodecRegistry implements the secp256k1fx interface
func (*VM) CreateHandlers ¶
func (vm *VM) CreateHandlers() (map[string]*commonEng.HTTPHandler, error)
CreateHandlers makes new http handlers that can handle API calls
func (*VM) CreateStaticHandlers ¶
func (vm *VM) CreateStaticHandlers() (map[string]*commonEng.HTTPHandler, error)
CreateStaticHandlers makes new http handlers that can handle API calls
func (*VM) FormatAddress ¶ added in v0.3.14
FormatAddress takes in a chainID and a raw address and produces the formatted address
func (*VM) FormatLocalAddress ¶ added in v0.3.14
FormatLocalAddress takes in a raw address and produces the formatted address
func (*VM) GetActivationTime ¶ added in v0.7.0
implements SnowmanPlusPlusVM interface
func (*VM) GetAtomicUTXOs ¶ added in v0.2.12
func (vm *VM) GetAtomicUTXOs( chainID ids.ID, addrs ids.ShortSet, startAddr ids.ShortID, startUTXOID ids.ID, limit int, ) ([]*avax.UTXO, ids.ShortID, ids.ID, error)
GetAtomicUTXOs returns the utxos that at least one of the provided addresses is referenced in.
func (*VM) GetCurrentNonce ¶ added in v0.4.2
GetCurrentNonce returns the nonce associated with the address at the preferred block
func (*VM) GetSpendableAVAXWithFee ¶ added in v0.6.0
func (vm *VM) GetSpendableAVAXWithFee( keys []*crypto.PrivateKeySECP256K1R, amount uint64, cost uint64, baseFee *big.Int, ) ([]EVMInput, [][]*crypto.PrivateKeySECP256K1R, error)
GetSpendableAVAXWithFee returns a list of EVMInputs and keys (in corresponding order) to total [amount] + [fee] of [AVAX] owned by [keys]. This function accounts for the added cost of the additional inputs needed to create the transaction and makes sure to skip any keys with a balance that is insufficient to cover the additional fee. Note: we return [][]*crypto.PrivateKeySECP256K1R even though each input corresponds to a single key, so that the signers can be passed in to [tx.Sign] which supports multiple keys on a single input.
func (*VM) GetSpendableFunds ¶ added in v0.3.5
func (vm *VM) GetSpendableFunds( keys []*crypto.PrivateKeySECP256K1R, assetID ids.ID, amount uint64, ) ([]EVMInput, [][]*crypto.PrivateKeySECP256K1R, error)
GetSpendableFunds returns a list of EVMInputs and keys (in corresponding order) to total [amount] of [assetID] owned by [keys]. Note: we return [][]*crypto.PrivateKeySECP256K1R even though each input corresponds to a single key, so that the signers can be passed in to [tx.Sign] which supports multiple keys on a single input.
func (*VM) HealthCheck ¶ added in v0.3.25
Health returns nil if this chain is healthy. Also returns details, which should be one of: string, []byte, map[string]string
func (*VM) Initialize ¶
func (*VM) NewBlockBuilder ¶ added in v0.7.0
func (*VM) NewNetwork ¶ added in v0.7.0
NewNetwork creates a new Network based on the [vm.chainConfig].
func (*VM) ParseAddress ¶ added in v0.2.12
ParseAddress takes in an address and produces the ID of the chain it's for the ID of the address
func (*VM) ParseLocalAddress ¶ added in v0.3.14
ParseLocalAddress takes in an address for this chain and produces the ID
func (*VM) SetPreference ¶
SetPreference sets what the current tail of the chain is
type VersionReply ¶ added in v0.5.4
type VersionReply struct {
Version string `json:"version"`
}
type Web3API ¶
type Web3API struct{}
Web3API offers helper API methods
func (*Web3API) ClientVersion ¶
ClientVersion returns the version of the vm running