xeth

package
v0.9.34 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2015 License: LGPL-2.1-or-later Imports: 22 Imported by: 0

Documentation

Overview

eXtended ETHereum

Index

Constants

View Source
const (
	UnknownFilterTy = iota
	BlockFilterTy
	TransactionFilterTy
	LogFilterTy
)

byte will be inferred

Variables

This section is empty.

Functions

func DefaultGas added in v0.9.17

func DefaultGas() *big.Int

Types

type Block added in v0.8.4

type Block struct {
	Size         string       `json:"size"`
	Number       int          `json:"number"`
	Hash         string       `json:"hash"`
	Transactions *common.List `json:"transactions"`
	Uncles       *common.List `json:"uncles"`
	Time         int64        `json:"time"`
	Coinbase     string       `json:"coinbase"`
	Name         string       `json:"name"`
	GasLimit     string       `json:"gasLimit"`
	GasUsed      string       `json:"gasUsed"`
	PrevHash     string       `json:"prevHash"`
	Bloom        string       `json:"bloom"`
	Raw          string       `json:"raw"`
	// contains filtered or unexported fields
}

Block interface exposed to QML

func NewBlock added in v0.8.4

func NewBlock(block *types.Block) *Block

Creates a new QML Block from a chain block

func (*Block) GetTransaction added in v0.8.4

func (self *Block) GetTransaction(hash string) *Transaction

func (*Block) ToString added in v0.8.4

func (self *Block) ToString() string

type Frontend added in v0.9.17

type Frontend interface {
	// UnlockAccount is called when a transaction needs to be signed
	// but the key corresponding to the transaction's sender is
	// locked.
	//
	// It should unlock the account with the given address and return
	// true if unlocking succeeded.
	UnlockAccount(address []byte) bool

	// This is called for all transactions inititated through
	// Transact. It should prompt the user to confirm the transaction
	// and return true if the transaction was acknowledged.
	//
	// ConfirmTransaction is not used for Call transactions
	// because they cannot change any state.
	ConfirmTransaction(tx string) bool
}

Frontend should be implemented by users of XEth. Its methods are called whenever XEth makes a decision that requires user input.

type Key added in v0.8.4

type Key struct {
	Address    string `json:"address"`
	PrivateKey string `json:"privateKey"`
	PublicKey  string `json:"publicKey"`
}

func NewKey added in v0.8.4

func NewKey(key *crypto.KeyPair) *Key

type KeyVal

type KeyVal struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Object

type Object struct {
	*state.StateObject
}

func NewObject added in v0.8.4

func NewObject(state *state.StateObject) *Object

func (*Object) Storage

func (self *Object) Storage() (storage map[string]string)

func (*Object) StorageString

func (self *Object) StorageString(str string) []byte

func (*Object) StorageValue

func (self *Object) StorageValue(addr *common.Value) []byte

type PReceipt

type PReceipt struct {
	CreatedContract bool   `json:"createdContract"`
	Address         string `json:"address"`
	Hash            string `json:"hash"`
	Sender          string `json:"sender"`
}

func NewPReciept

func NewPReciept(contractCreation bool, creationAddress, hash, address []byte) *PReceipt

type Peer added in v0.8.4

type Peer struct {
	Ip      string `json:"ip"`
	Version string `json:"version"`
	Caps    string `json:"caps"`
	// contains filtered or unexported fields
}

func NewPeer added in v0.8.4

func NewPeer(peer *p2p.Peer) *Peer

type Receipt added in v0.8.4

type Receipt struct {
	CreatedContract bool   `json:"createdContract"`
	Address         string `json:"address"`
	Hash            string `json:"hash"`
	Sender          string `json:"sender"`
}

func NewReciept added in v0.8.4

func NewReciept(contractCreation bool, creationAddress, hash, address []byte) *Receipt

type State added in v0.8.4

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

func NewState added in v0.8.4

func NewState(xeth *XEth, statedb *state.StateDB) *State

func (*State) Get added in v0.8.4

func (self *State) Get(addr string) *Object

func (*State) SafeGet added in v0.8.4

func (self *State) SafeGet(addr string) *Object

func (*State) State added in v0.8.4

func (self *State) State() *state.StateDB

type Transaction added in v0.8.4

type Transaction struct {
	Value           string `json:"value"`
	Gas             string `json:"gas"`
	GasPrice        string `json:"gasPrice"`
	Hash            string `json:"hash"`
	Address         string `json:"address"`
	Sender          string `json:"sender"`
	RawData         string `json:"rawData"`
	Data            string `json:"data"`
	Contract        bool   `json:"isContract"`
	CreatesContract bool   `json:"createsContract"`
	Confirmations   int    `json:"confirmations"`
	// contains filtered or unexported fields
}

func NewTx added in v0.8.4

func NewTx(tx *types.Transaction) *Transaction

func (*Transaction) ToString added in v0.8.4

func (self *Transaction) ToString() string

type Whisper added in v0.8.4

type Whisper struct {
	*whisper.Whisper
}

Whisper represents the API wrapper around the internal whisper implementation.

func NewWhisper added in v0.8.4

func NewWhisper(w *whisper.Whisper) *Whisper

NewWhisper wraps an internal whisper client into an external API version.

func (*Whisper) HasIdentity added in v0.8.4

func (self *Whisper) HasIdentity(key string) bool

HasIdentity checks if the the whisper node is configured with the private key of the specified public pair.

func (*Whisper) Messages added in v0.8.4

func (self *Whisper) Messages(id int) []WhisperMessage

Messages retrieves all the currently pooled messages matching a filter id.

func (*Whisper) NewIdentity added in v0.8.4

func (self *Whisper) NewIdentity() string

NewIdentity generates a new cryptographic identity for the client, and injects it into the known identities for message decryption.

func (*Whisper) Post added in v0.8.4

func (self *Whisper) Post(payload string, to, from string, topics []string, priority, ttl uint32) error

Post injects a message into the whisper network for distribution.

func (*Whisper) Watch added in v0.8.4

func (self *Whisper) Watch(to, from string, topics [][]string, fn func(WhisperMessage)) int

Watch installs a new message handler to run in case a matching packet arrives from the whisper network.

type WhisperMessage added in v0.8.4

type WhisperMessage struct {
	Payload string `json:"payload"`
	To      string `json:"to"`
	From    string `json:"from"`
	Sent    int64  `json:"sent"`
	TTL     int64  `json:"ttl"`
	Hash    string `json:"hash"`
	// contains filtered or unexported fields
}

WhisperMessage is the external API representation of a whisper.Message.

func NewWhisperMessage added in v0.8.4

func NewWhisperMessage(message *whisper.Message) WhisperMessage

NewWhisperMessage converts an internal message into an API version.

type XEth

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

func New

func New(ethereum *eth.Ethereum, frontend Frontend) *XEth

New creates an XEth that uses the given frontend. If a nil Frontend is provided, a default frontend which confirms all transactions will be used.

func NewTest added in v0.9.23

func NewTest(eth *eth.Ethereum, frontend Frontend) *XEth

func (*XEth) Accounts added in v0.8.4

func (self *XEth) Accounts() []string

func (*XEth) AllLogs added in v0.9.17

func (self *XEth) AllLogs(earliest, latest int64, skip, max int, address []string, topics [][]string) state.Logs

func (*XEth) ApplyTestTxs added in v0.9.17

func (self *XEth) ApplyTestTxs(statedb *state.StateDB, address common.Address, txc uint64) (uint64, *XEth)

applies queued transactions originating from address onto the latest state and creates a block only used in tests - could be removed in favour of mining on testdag (natspec e2e + networking) + filters

func (*XEth) AtStateNum added in v0.9.17

func (self *XEth) AtStateNum(num int64) *XEth

func (*XEth) BalanceAt added in v0.8.4

func (self *XEth) BalanceAt(addr string) string

func (*XEth) Block

func (self *XEth) Block(v interface{}) *Block

func (*XEth) BlockByHash added in v0.8.4

func (self *XEth) BlockByHash(strHash string) *Block

func (*XEth) BlockByNumber added in v0.8.4

func (self *XEth) BlockByNumber(num int64) *Block

func (*XEth) BlockFilterChanged added in v0.9.17

func (self *XEth) BlockFilterChanged(id int) []common.Hash

func (*XEth) Call added in v0.8.4

func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr string) (string, string, error)

func (*XEth) ClientVersion added in v0.9.17

func (self *XEth) ClientVersion() string

func (*XEth) CodeAt added in v0.8.4

func (self *XEth) CodeAt(address string) string

func (*XEth) CodeAtBytes added in v0.9.17

func (self *XEth) CodeAtBytes(address string) []byte

func (*XEth) Coinbase added in v0.8.4

func (self *XEth) Coinbase() string

func (*XEth) ConfirmTransaction added in v0.9.17

func (self *XEth) ConfirmTransaction(tx string) bool

func (*XEth) CurrentBlock added in v0.9.17

func (self *XEth) CurrentBlock() *types.Block

func (*XEth) DbGet added in v0.9.17

func (self *XEth) DbGet(key []byte) ([]byte, error)

retrieve DApp value from extra database

func (*XEth) DbPut added in v0.9.17

func (self *XEth) DbPut(key, val []byte) bool

store DApp value in extra database

func (*XEth) DefaultGasPrice added in v0.9.30

func (self *XEth) DefaultGasPrice() *big.Int

func (*XEth) EachStorage added in v0.8.4

func (self *XEth) EachStorage(addr string) string

func (*XEth) EthBlockByHash added in v0.9.17

func (self *XEth) EthBlockByHash(strHash string) *types.Block

func (*XEth) EthBlockByNumber added in v0.9.17

func (self *XEth) EthBlockByNumber(num int64) *types.Block

func (*XEth) EthTransactionByHash added in v0.9.17

func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blhash common.Hash, blnum *big.Int, txi uint64)

func (*XEth) EthVersion added in v0.9.17

func (self *XEth) EthVersion() string

func (*XEth) FromAscii added in v0.8.4

func (self *XEth) FromAscii(str string) string

func (*XEth) FromNumber added in v0.8.4

func (self *XEth) FromNumber(str string) string

func (*XEth) GasLimit added in v0.9.17

func (self *XEth) GasLimit() *big.Int

func (*XEth) GetBlockReceipts added in v0.9.23

func (self *XEth) GetBlockReceipts(bhash common.Hash) (receipts types.Receipts, err error)

func (*XEth) GetFilterType added in v0.9.17

func (self *XEth) GetFilterType(id int) byte

func (*XEth) GetTxReceipt added in v0.9.23

func (self *XEth) GetTxReceipt(txhash common.Hash) (receipt *types.Receipt, err error)

func (*XEth) HashRate added in v0.9.17

func (self *XEth) HashRate() int64

func (*XEth) IsContract added in v0.8.4

func (self *XEth) IsContract(address string) bool

func (*XEth) IsListening added in v0.8.4

func (self *XEth) IsListening() bool

func (*XEth) IsMining added in v0.8.4

func (self *XEth) IsMining() bool

func (*XEth) LogFilterChanged added in v0.9.17

func (self *XEth) LogFilterChanged(id int) state.Logs

func (*XEth) Logs added in v0.9.17

func (self *XEth) Logs(id int) state.Logs

func (*XEth) NetworkVersion added in v0.9.17

func (self *XEth) NetworkVersion() string

func (*XEth) NewBlockFilter added in v0.9.17

func (self *XEth) NewBlockFilter() int

func (*XEth) NewLogFilter added in v0.9.17

func (self *XEth) NewLogFilter(earliest, latest int64, skip, max int, address []string, topics [][]string) int

func (*XEth) NewTransactionFilter added in v0.9.17

func (self *XEth) NewTransactionFilter() int

func (*XEth) NewWhisperFilter added in v0.9.17

func (p *XEth) NewWhisperFilter(to, from string, topics [][]string) int

NewWhisperFilter creates and registers a new message filter to watch for inbound whisper messages. All parameters at this point are assumed to be HEX encoded.

func (*XEth) NumberToHuman added in v0.8.4

func (self *XEth) NumberToHuman(balance string) string

func (*XEth) PeerCount added in v0.8.4

func (self *XEth) PeerCount() int

func (*XEth) PushTx

func (self *XEth) PushTx(encodedTx string) (string, error)

func (*XEth) RemoteMining added in v0.9.17

func (self *XEth) RemoteMining() *miner.RemoteAgent

func (*XEth) SecretToAddress added in v0.8.4

func (self *XEth) SecretToAddress(key string) string

func (*XEth) SetMining added in v0.8.4

func (self *XEth) SetMining(shouldmine bool, threads int) bool

func (*XEth) SetSolc added in v0.9.17

func (self *XEth) SetSolc(solcPath string) (*compiler.Solidity, error)

set in js console via admin interface or wrapper from cli flags

func (*XEth) Sign added in v0.9.20

func (self *XEth) Sign(fromStr, hashStr string, didUnlock bool) (string, error)

func (*XEth) Solc added in v0.9.17

func (self *XEth) Solc() (*compiler.Solidity, error)

accessor for solidity compiler. memoized if available, retried on-demand if not

func (*XEth) State added in v0.8.4

func (self *XEth) State() *State

func (*XEth) StorageAt added in v0.8.4

func (self *XEth) StorageAt(addr, storageAddr string) string

func (*XEth) ToAscii added in v0.8.4

func (self *XEth) ToAscii(str string) string

func (*XEth) Transact

func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceStr, codeStr string) (string, error)

func (*XEth) TransactionFilterChanged added in v0.9.17

func (self *XEth) TransactionFilterChanged(id int) []common.Hash

func (*XEth) TxCountAt added in v0.8.4

func (self *XEth) TxCountAt(address string) int

func (*XEth) UninstallFilter added in v0.9.17

func (self *XEth) UninstallFilter(id int) bool

func (*XEth) UninstallWhisperFilter added in v0.9.17

func (p *XEth) UninstallWhisperFilter(id int) bool

UninstallWhisperFilter disables and removes an existing filter.

func (*XEth) UpdateState added in v0.9.17

func (self *XEth) UpdateState() (wait chan *big.Int)

subscribes to new head block events and waits until blockchain height is greater n at any time given the current head, waits for the next chain event sets the state to the current head loop is async and quit by closing the channel used in tests and JS console debug module to control advancing private chain manually Note: this is not threadsafe, only called in JS single process and tests

func (*XEth) Whisper added in v0.8.4

func (self *XEth) Whisper() *Whisper

func (*XEth) WhisperMessages added in v0.9.17

func (self *XEth) WhisperMessages(id int) []WhisperMessage

WhisperMessages retrieves all the known messages that match a specific filter.

func (*XEth) WhisperMessagesChanged added in v0.9.17

func (self *XEth) WhisperMessagesChanged(id int) []WhisperMessage

WhisperMessagesChanged retrieves all the new messages matched by a filter since the last retrieval

func (*XEth) WhisperVersion added in v0.9.17

func (self *XEth) WhisperVersion() string

func (*XEth) WithState added in v0.9.17

func (self *XEth) WithState(statedb *state.StateDB) *XEth

Jump to

Keyboard shortcuts

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