geth

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2016 License: GPL-3.0 Imports: 19 Imported by: 1

Documentation

Overview

Package geth implements the wrapper around to go-ethereum client

Index

Constants

View Source
const (
	NodeName     = "Geth/EtherAPIs" // Client name to advertise on the Ethereum network
	NodeVersion  = "0.0.1"          // Client version to advertise on the Ethereum network
	NodePort     = 30303            // Listener port of the Ethereum P2P network
	NodeMaxPeers = 25               // Maximum number of peers connections to accept
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API is a Go wrapper around the JSON RPC API exposed by a Geth node.

In theory implements:

In practice it implements the bare essentials needed for this hackathon :D

func (*API) Accounts

func (api *API) Accounts() ([]common.Address, error)

Accounts retrieves the currently available Ethereum accounts.

func (*API) BlockNumber

func (api *API) BlockNumber() (uint64, error)

BlockNumber retrieves the current head number of the blockchain.

func (*API) GetBlockTime

func (api *API) GetBlockTime(num uint64) (time.Time, error)

GetBlockTime retrieves the block of the given number from the canonical chain.

func (*API) Syncing

func (api *API) Syncing() (*SyncStatus, error)

Syncing returns the current sync status of the node, or nil if the node is not currently synchronizing with the network.

type EthereumNetwork

type EthereumNetwork int

EthereumNetwork is the variant of the Ethereum network to join.

const (
	MainNet EthereumNetwork = 0 // Frontier live network
	TestNet                 = 2 // Morden test network
)

type Geth

type Geth struct {
	// contains filtered or unexported fields
}

Geth is a wrapper around the Ethereum Go client.

func New

func New(datadir string, network EthereumNetwork) (*Geth, error)

New creates a Ethereum client, pre-configured to one of the supported networks.

func (*Geth) Attach

func (g *Geth) Attach() (*API, error)

Attach connects to the running node's IPC exposed APIs, and returns an Go API interface.

func (*Geth) Keystore

func (g *Geth) Keystore() crypto.KeyStore

Keystore is a quick hack to expose the internal Ethereum keystore. We should

remove this after the API interface is implemented, but until then it makes

things simpler.

func (*Geth) Stack

func (g *Geth) Stack() *node.Node

Stack is a quick hack to expose the internal Ethereum node implementation. We should probably remove this after the API interface is implemented, but until then it makes things simpler.

func (*Geth) Start

func (g *Geth) Start() error

Start boots up the Ethereum protocol, starts interacting with the P2P network and opens up the IPC based JSOn RPC API for accessing the exposed APIs.

func (*Geth) Stop

func (g *Geth) Stop() error

Stop closes down the Ethereum client, along with any other resouces it might be keeping around.

type SyncStatus

type SyncStatus struct {
	StartingBlock uint64
	CurrentBlock  uint64
	HighestBlock  uint64
}

SyncStatus is the current state the network sync is in.

Jump to

Keyboard shortcuts

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