nodeapi

package
v0.0.0-...-031fc53 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Number       string   `json:"number"`
	Hash         string   `json:"hash"`
	Nonce        string   `json:"nonce"`
	Difficulty   string   `json:"difficulty"`
	Timestamp    string   `json:"timestamp"`
	Transactions []string `json:"transactions"`
}

Block is a block body representation

type Node

type Node struct {
	Type types.NodeType
	// contains filtered or unexported fields
}

Node is the base OpenEthereum API struct

func NewNode

func NewNode(httpRPCEndpoint string) (*Node, error)

NewNode creates a new Node instance

func (*Node) Balance

func (n *Node) Balance(address string) (*big.Int, error)

Balance delegates to `eth_getBalance` API method, and returns the address's balance

func (*Node) BlockNumber

func (n *Node) BlockNumber() (uint64, error)

BlockNumber delegates to `eth_blockNumber` API method, and returns the current block number

func (*Node) ChainID

func (n *Node) ChainID() (uint64, error)

ChainID delegates to `eth_chainId` API method, and returns the network's chain id

func (*Node) ClientVersion

func (n *Node) ClientVersion() (string, error)

ClientVersion delegates to `eth_blockNumber` API method, and returns the current block number

func (*Node) Coinbase

func (n *Node) Coinbase() (string, error)

Coinbase delegates to `eth_coinbase` API method, and returns the miner's coinbase address

func (*Node) GetBlockByHash

func (n *Node) GetBlockByHash(blockHash string) (Block, error)

GetBlockByHash delegates to `eth_getBlockByHash` RPC method, and returns block by number

func (*Node) GetBlockByNumber

func (n *Node) GetBlockByNumber(blockNumber uint64) (Block, error)

GetBlockByNumber delegates to `eth_getBlockByNumber` RPC method, and returns block by number

func (*Node) GetUncleByBlockNumberAndIndex

func (n *Node) GetUncleByBlockNumberAndIndex(blockNumber uint64, uncleIndex int) (Block, error)

GetUncleByBlockNumberAndIndex delegates to `eth_getUncleByBlockNumberAndIndex` RPC method, and returns uncle by block number and index

func (*Node) GetUncleCountByBlockNumber

func (n *Node) GetUncleCountByBlockNumber(blockNumber uint64) (uint64, error)

GetUncleCountByBlockNumber delegates to `eth_getUncleCountByBlockNumber` RPC method, and returns amount of uncles by given block number

func (*Node) HarvestBlockByNonce

func (n *Node) HarvestBlockByNonce(givenNonceHex string, givenNumber uint64) (block Block, uncleParent uint64, err error)

HarvestBlockByNonce is the most compatible way to find out the block hash

func (*Node) SubmitWork

func (n *Node) SubmitWork(work []string) (bool, error)

SubmitWork delegates to `eth_submitWork` API method, and submits work

Jump to

Keyboard shortcuts

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