go-ethereum: github.com/ethereum/go-ethereum/eth/gasprice Index | Files

package gasprice

import "github.com/ethereum/go-ethereum/eth/gasprice"


Package Files



var DefaultMaxPrice = big.NewInt(500 * params.GWei)

type Config Uses

type Config struct {
    Blocks     int
    Percentile int
    Default    *big.Int `toml:",omitempty"`
    MaxPrice   *big.Int `toml:",omitempty"`

type Oracle Uses

type Oracle struct {
    // contains filtered or unexported fields

Oracle recommends gas prices based on the content of recent blocks. Suitable for both light and full clients.

func NewOracle Uses

func NewOracle(backend OracleBackend, params Config) *Oracle

NewOracle returns a new gasprice oracle which can recommend suitable gasprice for newly created transaction.

func (*Oracle) SuggestPrice Uses

func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error)

SuggestPrice returns a gasprice so that newly created transaction can have a very high chance to be included in the following blocks.

type OracleBackend Uses

type OracleBackend interface {
    HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
    BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)
    ChainConfig() *params.ChainConfig

OracleBackend includes all necessary background APIs for oracle.

Package gasprice imports 9 packages (graph) and is imported by 348 packages. Updated 2020-10-01. Refresh now. Tools for package owners.