eth

package module
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2014 License: LGPL-2.1-or-later Imports: 28 Imported by: 39

README

Bugs Stories in Ready ![Stories in Progress](https://badge.waffle.io/ethereum/go-ethereum.svg?label=in%20progress&title=In Progress)

Ethereum

Build Status master Build Status develop

Ethereum Go Client © 2014 Jeffrey Wilcke.

Current state: Proof of Concept 0.7

Ethereum is currently in its testing phase.

Build

To build Mist (GUI):

go get github.com/ethereum/go-ethereum/cmd/mist

To build the node (CLI):

go get github.com/ethereum/go-ethereum/cmd/ethereum

For further, detailed, build instruction please see the Wiki

Automated (dev) builds

  • [OS X]
  • [Windows] Coming soon™
  • [Linux] Coming soon™

Binaries

Go Ethereum comes with several binaries found in cmd:

  • mist Official Ethereum Browser
  • ethereum Ethereum CLI
  • ethtest test tool which runs with the tests suit: ethtest "cat myfile.json".
  • evm is a generic Ethereum Virtual Machine: evm -code 60ff60ff -gas 10000 -price 0 -dump. See -h for a detailed description.

General command line options

== Shared between ethereum and Mist ==

= Settings
-id      Set the custom identifier of the client (shows up on other clients)
-port    Port on which the server will accept incomming connections
-upnp    Enable UPnP
-maxpeer Desired amount of peers
-rpc     Start JSON RPC
-dir     Data directory used to store configs and databases

= Utility 
-h         This
-import    Import a private key
-genaddr   Generates a new address and private key (destructive action)
-dump      Dump a specific state of a block to stdout given the -number or -hash
-difftool  Supress all output and prints VM output to stdout
-diff      vm=only vm output, all=all output including state storage

Ethereum only
ethereum [options] [filename]
-js        Start the JavaScript REPL
filename   Load the given file and interpret as JavaScript
-m       Start mining blocks

== Mist only ==

-asset_path    absolute path to GUI assets directory

Contribution

If you'd like to contribute to Ethereum please fork, fix, commit and send a pull request. Commits who do not comply with the coding standards are ignored (use gofmt!). If you send pull requests make absolute sure that you commit on the develop branch and that you do not merge to master. Commits that are directly based on master are simply ignored.

To make life easier try git flow it sets this all up and streamlines your work flow.

Coding standards

Sources should be formatted according to the Go Formatting Style.

Unless structs fields are supposed to be directly accesible, provide Getters and hide the fields through Go's exporting facility.

When you comment put meaningfull comments. Describe in detail what you want to achieve.

wrong

// Check if the value at x is greater than y
if x > y {
    // It's greater!
}

Everyone reading the source probably know what you wanted to achieve with above code. Those are not meaningful comments.

While the project isn't 100% tested I want you to write tests non the less. I haven't got time to evaluate everyone's code in detail so I expect you to write tests for me so I don't have to test your code manually. (If you want to contribute by just writing tests that's fine too!)

Documentation

Index

Constants

View Source
const (

	// Current protocol version
	ProtocolVersion = 49
	// Current P2P version
	P2PVersion = 2
	// Ethereum network version
	NetVersion = 0
)

Variables

This section is empty.

Functions

func PastPeers added in v0.7.10

func PastPeers() []string

Types

type BlockPool added in v0.7.10

type BlockPool struct {
	ChainLength, BlocksProcessed int
	// contains filtered or unexported fields
}

func NewBlockPool added in v0.7.10

func NewBlockPool(eth *Ethereum) *BlockPool

func (*BlockPool) Add added in v0.7.10

func (self *BlockPool) Add(b *types.Block, peer *Peer)

func (*BlockPool) AddHash added in v0.7.10

func (self *BlockPool) AddHash(hash []byte, peer *Peer)

func (*BlockPool) AddNew added in v0.7.10

func (self *BlockPool) AddNew(b *types.Block, peer *Peer)

func (*BlockPool) Blocks added in v0.7.10

func (self *BlockPool) Blocks() (blocks types.Blocks)

func (*BlockPool) DistributeHashes added in v0.7.10

func (self *BlockPool) DistributeHashes()

func (*BlockPool) FetchHashes added in v0.7.10

func (self *BlockPool) FetchHashes(peer *Peer) bool

func (*BlockPool) HasCommonHash added in v0.7.10

func (self *BlockPool) HasCommonHash(hash []byte) bool

func (*BlockPool) HasLatestHash added in v0.7.10

func (self *BlockPool) HasLatestHash() bool

func (*BlockPool) Len added in v0.7.10

func (self *BlockPool) Len() int

func (*BlockPool) Remove added in v0.7.10

func (self *BlockPool) Remove(hash []byte)

func (*BlockPool) Reset added in v0.7.10

func (self *BlockPool) Reset()

func (*BlockPool) Start added in v0.7.10

func (self *BlockPool) Start()

func (*BlockPool) Stop added in v0.7.10

func (self *BlockPool) Stop()

type Caps added in v0.7.10

type Caps byte

Peer capabilities

const (
	CapPeerDiscTy Caps = 1 << iota
	CapTxTy
	CapChainTy

	CapDefault = CapChainTy | CapTxTy | CapPeerDiscTy
)

func (Caps) IsCap added in v0.7.10

func (c Caps) IsCap(cap Caps) bool

func (Caps) String added in v0.7.10

func (c Caps) String() string

type ChainSyncEvent added in v0.7.10

type ChainSyncEvent struct {
	InSync bool
}

type DiscReason added in v0.7.10

type DiscReason byte
const (
	// Values are given explicitly instead of by iota because these values are
	// defined by the wire protocol spec; it is easier for humans to ensure
	// correctness when values are explicit.
	DiscRequested DiscReason = iota
	DiscReTcpSysErr
	DiscBadProto
	DiscBadPeer
	DiscTooManyPeers
	DiscConnDup
	DiscGenesisErr
	DiscProtoErr
	DiscQuitting
)

func (DiscReason) String added in v0.7.10

func (d DiscReason) String() string

type Ethereum added in v0.7.10

type Ethereum struct {

	// Nonce
	Nonce uint64

	Addr net.Addr
	Port string

	// Specifies the desired amount of maximum peers
	MaxPeers int

	Mining bool

	RpcServer *rpc.JsonRpcServer
	// contains filtered or unexported fields
}

func New added in v0.7.10

func New(db ethutil.Database, clientIdentity wire.ClientIdentity, keyManager *crypto.KeyManager, caps Caps, usePnp bool) (*Ethereum, error)

func (*Ethereum) AddPeer added in v0.7.10

func (s *Ethereum) AddPeer(conn net.Conn)

func (*Ethereum) BlacklistPeer added in v0.7.10

func (self *Ethereum) BlacklistPeer(peer *Peer)

func (*Ethereum) BlockManager added in v0.7.10

func (s *Ethereum) BlockManager() *core.BlockManager

func (*Ethereum) BlockPool added in v0.7.10

func (s *Ethereum) BlockPool() *BlockPool

func (*Ethereum) Broadcast added in v0.7.10

func (s *Ethereum) Broadcast(msgType wire.MsgType, data []interface{})

func (*Ethereum) BroadcastMsg added in v0.7.10

func (s *Ethereum) BroadcastMsg(msg *wire.Msg)

func (*Ethereum) ChainManager added in v0.7.10

func (s *Ethereum) ChainManager() *core.ChainManager

func (*Ethereum) ClientIdentity added in v0.7.10

func (s *Ethereum) ClientIdentity() wire.ClientIdentity

func (*Ethereum) ConnectToPeer added in v0.7.10

func (s *Ethereum) ConnectToPeer(addr string) error

func (*Ethereum) Db added in v0.7.10

func (self *Ethereum) Db() ethutil.Database

func (*Ethereum) EventMux added in v0.7.10

func (s *Ethereum) EventMux() *event.TypeMux

func (*Ethereum) GetFilter added in v0.7.10

func (self *Ethereum) GetFilter(id int) *core.Filter

GetFilter retrieves a filter installed using InstallFilter. The filter may not be modified.

func (*Ethereum) HighestTDPeer added in v0.7.10

func (s *Ethereum) HighestTDPeer() (td *big.Int)

func (*Ethereum) InOutPeers added in v0.7.10

func (s *Ethereum) InOutPeers() []*Peer

func (*Ethereum) InboundPeers added in v0.7.10

func (s *Ethereum) InboundPeers() []*Peer

func (*Ethereum) InstallFilter added in v0.7.10

func (self *Ethereum) InstallFilter(filter *core.Filter) (id int)

InstallFilter adds filter for blockchain events. The filter's callbacks will run for matching blocks and messages. The filter should not be modified after it has been installed.

func (*Ethereum) IsListening added in v0.7.10

func (s *Ethereum) IsListening() bool

func (*Ethereum) IsMining added in v0.7.10

func (s *Ethereum) IsMining() bool

func (*Ethereum) IsUpToDate added in v0.7.10

func (s *Ethereum) IsUpToDate() bool

func (*Ethereum) KeyManager added in v0.7.10

func (s *Ethereum) KeyManager() *crypto.KeyManager

func (*Ethereum) OutboundPeers added in v0.7.10

func (s *Ethereum) OutboundPeers() []*Peer

func (*Ethereum) PeerCount added in v0.7.10

func (s *Ethereum) PeerCount() int

func (*Ethereum) Peers added in v0.7.10

func (s *Ethereum) Peers() *list.List

func (*Ethereum) ProcessPeerList added in v0.7.10

func (s *Ethereum) ProcessPeerList(addrs []string)

func (*Ethereum) PushPeer added in v0.7.10

func (s *Ethereum) PushPeer(peer *Peer)

func (*Ethereum) RemovePeer added in v0.7.10

func (s *Ethereum) RemovePeer(p *Peer)

func (*Ethereum) Seed added in v0.7.10

func (s *Ethereum) Seed()

func (*Ethereum) ServerCaps added in v0.7.10

func (s *Ethereum) ServerCaps() Caps

func (*Ethereum) Start added in v0.7.10

func (s *Ethereum) Start(seed bool)

Start the ethereum

func (*Ethereum) Stop added in v0.7.10

func (s *Ethereum) Stop()

func (*Ethereum) TxPool added in v0.7.10

func (s *Ethereum) TxPool() *core.TxPool

func (*Ethereum) UninstallFilter added in v0.7.10

func (self *Ethereum) UninstallFilter(id int)

func (*Ethereum) WaitForShutdown added in v0.7.10

func (s *Ethereum) WaitForShutdown()

This function will wait for a shutdown and resumes main thread execution

type NAT added in v0.7.10

type NAT interface {
	GetExternalAddress() (addr net.IP, err error)
	AddPortMapping(protocol string, externalPort, internalPort int, description string, timeout int) (mappedExternalPort int, err error)
	DeletePortMapping(protocol string, externalPort, internalPort int) (err error)
}

protocol is either "udp" or "tcp"

func Discover added in v0.7.10

func Discover() (nat NAT, err error)

func NewNatPMP added in v0.7.10

func NewNatPMP(gateway net.IP) (nat NAT)

type Peer added in v0.7.10

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

func NewOutboundPeer added in v0.7.10

func NewOutboundPeer(addr string, ethereum *Ethereum, caps Caps) *Peer

func NewPeer added in v0.7.10

func NewPeer(conn net.Conn, ethereum *Ethereum, inbound bool) *Peer

func (*Peer) Caps added in v0.7.10

func (self *Peer) Caps() *ethutil.Value

func (*Peer) Connect added in v0.7.10

func (self *Peer) Connect(addr string) (conn net.Conn, err error)

func (*Peer) Connected added in v0.7.10

func (p *Peer) Connected() *int32

func (*Peer) FetchBlocks added in v0.7.10

func (self *Peer) FetchBlocks(hashes [][]byte)

func (*Peer) FetchHashes added in v0.7.10

func (self *Peer) FetchHashes() bool

func (*Peer) FetchingHashes added in v0.7.10

func (self *Peer) FetchingHashes() bool

func (*Peer) HandleInbound added in v0.7.10

func (p *Peer) HandleInbound()

Inbound handler. Inbound messages are received here and passed to the appropriate methods

func (*Peer) HandleOutbound added in v0.7.10

func (p *Peer) HandleOutbound()

Outbound message handler. Outbound messages are handled here

func (*Peer) Host added in v0.7.10

func (p *Peer) Host() []byte

func (*Peer) Inbound added in v0.7.10

func (p *Peer) Inbound() bool

func (*Peer) IsCap added in v0.7.10

func (self *Peer) IsCap(cap string) bool

func (*Peer) LastPong added in v0.7.10

func (p *Peer) LastPong() int64

func (*Peer) LastSend added in v0.7.10

func (p *Peer) LastSend() time.Time

func (*Peer) PingTime added in v0.7.10

func (p *Peer) PingTime() string

Getters

func (*Peer) Port added in v0.7.10

func (p *Peer) Port() uint16

func (*Peer) QueueMessage added in v0.7.10

func (p *Peer) QueueMessage(msg *wire.Msg)

Outputs any RLP encoded data to the peer

func (*Peer) RlpData added in v0.7.10

func (p *Peer) RlpData() []interface{}

func (*Peer) SetVersion added in v0.7.10

func (p *Peer) SetVersion(version string)

Setters

func (*Peer) Start added in v0.7.10

func (p *Peer) Start()

func (*Peer) Stop added in v0.7.10

func (p *Peer) Stop()

func (*Peer) StopWithReason added in v0.7.10

func (p *Peer) StopWithReason(reason DiscReason)

func (*Peer) String added in v0.7.10

func (p *Peer) String() string

func (*Peer) Version added in v0.7.10

func (p *Peer) Version() string

type PeerListEvent added in v0.7.10

type PeerListEvent struct {
	Peers *list.List
}

Directories

Path Synopsis
cmd
evm
compression
rle
Package event implements an event multiplexer.
Package event implements an event multiplexer.
Package logger implements a multi-output leveled logger.
Package logger implements a multi-output leveled logger.
pow
ar
ezp
Package rlp implements the RLP serialization format.
Package rlp implements the RLP serialization format.
tests
ui
qt
Package wire provides low level access to the Ethereum network and allows you to broadcast data over the network.
Package wire provides low level access to the Ethereum network and allows you to broadcast data over the network.

Jump to

Keyboard shortcuts

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