go-ethereum: github.com/axiomzen/go-ethereum/mobile Index | Files

package geth

import "github.com/axiomzen/go-ethereum/mobile"

Package geth contains the simplified mobile APIs to go-ethereum.

The scope of this package is *not* to allow writing a custom Ethereum client with pieces plucked from go-ethereum, rather to allow writing native dapps on mobile platforms. Keep this in mind when using or extending this package!

API limitations

Since gomobile cannot bridge arbitrary types between Go and Android/iOS, the exposed APIs need to be manually wrapped into simplified types, with custom constructors and getters/setters to ensure that they can be meaninfully used from Java/ObjC too.

With this in mind, please try to limit the scope of this package and only add essentials without which mobile support cannot work, especially since manually syncing the code will be unwieldy otherwise. In the long term we might consider writing custom library generators, but those are out of scope now.

Content wise each file in this package corresponds to an entire Go package from the go-ethereum repository. Please adhere to this scoping to prevent this package getting unmaintainable.

Wrapping guidelines:

Every type that is to be exposed should be wrapped into its own plain struct, which internally contains a single field: the original go-ethereum version. This is needed because gomobile cannot expose named types for now.

Whenever a method argument or a return type is a custom struct, the pointer variant should always be used as value types crossing over between language boundaries might have strange behaviors.

Slices of types should be converted into a single multiplicative type wrapping a go slice with the methods `Size`, `Get` and `Set`. Further slice operations should not be provided to limit the remote code complexity. Arrays should be avoided as much as possible since they complicate bounds checking.

If a method has multiple return values (e.g. some return + an error), those are generated as output arguments in ObjC. To avoid weird generated names like ret_0 for them, please always assign names to output variables if tuples.

Note, a panic *cannot* cross over language boundaries, instead will result in an undebuggable SEGFAULT in the process. For error handling only ever use error returns, which may be the only or the second return.

Index

Package Files

accounts.go big.go bind.go common.go context.go discover.go doc.go ethclient.go ethereum.go geth.go geth_other.go init.go interface.go logger.go p2p.go params.go primitives.go shhclient.go types.go vm.go

Constants

const (
    // StandardScryptN is the N parameter of Scrypt encryption algorithm, using 256MB
    // memory and taking approximately 1s CPU time on a modern processor.
    StandardScryptN = int(keystore.StandardScryptN)

    // StandardScryptP is the P parameter of Scrypt encryption algorithm, using 256MB
    // memory and taking approximately 1s CPU time on a modern processor.
    StandardScryptP = int(keystore.StandardScryptP)

    // LightScryptN is the N parameter of Scrypt encryption algorithm, using 4MB
    // memory and taking approximately 100ms CPU time on a modern processor.
    LightScryptN = int(keystore.LightScryptN)

    // LightScryptP is the P parameter of Scrypt encryption algorithm, using 4MB
    // memory and taking approximately 100ms CPU time on a modern processor.
    LightScryptP = int(keystore.LightScryptP)
)

func DecodeFromHex Uses

func DecodeFromHex(s string) ([]byte, error)

DecodeFromHex decodes a hex string with 0x prefix.

func EncodeToHex Uses

func EncodeToHex(b []byte) string

EncodeToHex encodes b as a hex string with 0x prefix.

func MainnetGenesis Uses

func MainnetGenesis() string

MainnetGenesis returns the JSON spec to use for the main Ethereum network. It is actually empty since that defaults to the hard coded binary genesis block.

func RinkebyGenesis Uses

func RinkebyGenesis() string

RinkebyGenesis returns the JSON spec to use for the Rinkeby test network

func SetVerbosity Uses

func SetVerbosity(level int)

SetVerbosity sets the global verbosity level (between 0 and 6 - see logger/verbosity.go).

func TestnetGenesis Uses

func TestnetGenesis() string

TestnetGenesis returns the JSON spec to use for the Ethereum test network.

type Account Uses

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

Account represents a stored key.

func (*Account) GetAddress Uses

func (a *Account) GetAddress() *Address

GetAddress retrieves the address associated with the account.

func (*Account) GetURL Uses

func (a *Account) GetURL() string

GetURL retrieves the canonical URL of the account.

type Accounts Uses

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

Accounts represents a slice of accounts.

func (*Accounts) Get Uses

func (a *Accounts) Get(index int) (account *Account, _ error)

Get returns the account at the given index from the slice.

func (*Accounts) Set Uses

func (a *Accounts) Set(index int, account *Account) error

Set sets the account at the given index in the slice.

func (*Accounts) Size Uses

func (a *Accounts) Size() int

Size returns the number of accounts in the slice.

type Address Uses

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

Address represents the 20 byte address of an Ethereum account.

func NewAddressFromBytes Uses

func NewAddressFromBytes(binary []byte) (address *Address, _ error)

NewAddressFromBytes converts a slice of bytes to a hash value.

func NewAddressFromHex Uses

func NewAddressFromHex(hex string) (address *Address, _ error)

NewAddressFromHex converts a hex string to a address value.

func (*Address) GetBytes Uses

func (a *Address) GetBytes() []byte

GetBytes retrieves the byte representation of the address.

func (*Address) GetHex Uses

func (a *Address) GetHex() string

GetHex retrieves the hex string representation of the address.

func (*Address) SetBytes Uses

func (a *Address) SetBytes(address []byte) error

SetBytes sets the specified slice of bytes as the address value.

func (*Address) SetHex Uses

func (a *Address) SetHex(address string) error

SetHex sets the specified hex string as the address value.

type Addresses Uses

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

Addresses represents a slice of addresses.

func NewAddresses Uses

func NewAddresses(size int) *Addresses

NewAddresses creates a slice of uninitialized addresses.

func NewAddressesEmpty Uses

func NewAddressesEmpty() *Addresses

NewAddressesEmpty creates an empty slice of Addresses values.

func (*Addresses) Append Uses

func (a *Addresses) Append(address *Address)

Append adds a new address element to the end of the slice.

func (*Addresses) Get Uses

func (a *Addresses) Get(index int) (address *Address, _ error)

Get returns the address at the given index from the slice.

func (*Addresses) Set Uses

func (a *Addresses) Set(index int, address *Address) error

Set sets the address at the given index in the slice.

func (*Addresses) Size Uses

func (a *Addresses) Size() int

Size returns the number of addresses in the slice.

type BigInt Uses

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

A BigInt represents a signed multi-precision integer.

func NewBigInt Uses

func NewBigInt(x int64) *BigInt

NewBigInt allocates and returns a new BigInt set to x.

func (*BigInt) GetBytes Uses

func (bi *BigInt) GetBytes() []byte

GetBytes returns the absolute value of x as a big-endian byte slice.

func (*BigInt) GetInt64 Uses

func (bi *BigInt) GetInt64() int64

GetInt64 returns the int64 representation of x. If x cannot be represented in an int64, the result is undefined.

func (*BigInt) GetString Uses

func (bi *BigInt) GetString(base int) string

GetString returns the value of x as a formatted string in some number base.

func (*BigInt) SetBytes Uses

func (bi *BigInt) SetBytes(buf []byte)

SetBytes interprets buf as the bytes of a big-endian unsigned integer and sets the big int to that value.

func (*BigInt) SetInt64 Uses

func (bi *BigInt) SetInt64(x int64)

SetInt64 sets the big int to x.

func (*BigInt) SetString Uses

func (bi *BigInt) SetString(x string, base int)

SetString sets the big int to x.

The string prefix determines the actual conversion base. A prefix of "0x" or "0X" selects base 16; the "0" prefix selects base 8, and a "0b" or "0B" prefix selects base 2. Otherwise the selected base is 10.

func (*BigInt) Sign Uses

func (bi *BigInt) Sign() int

Sign returns:

-1 if x <  0
 0 if x == 0
+1 if x >  0

func (*BigInt) String Uses

func (bi *BigInt) String() string

String returns the value of x as a formatted decimal string.

type BigInts Uses

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

BigInts represents a slice of big ints.

func NewBigInts Uses

func NewBigInts(size int) *BigInts

NewBigInts creates a slice of uninitialized big numbers.

func (*BigInts) Get Uses

func (bi *BigInts) Get(index int) (bigint *BigInt, _ error)

Get returns the bigint at the given index from the slice.

func (*BigInts) Set Uses

func (bi *BigInts) Set(index int, bigint *BigInt) error

Set sets the big int at the given index in the slice.

func (*BigInts) Size Uses

func (bi *BigInts) Size() int

Size returns the number of big ints in the slice.

type Binaries Uses

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

Binaries represents a slice of byte slice

func (*Binaries) Get Uses

func (bs *Binaries) Get(index int) (binary []byte, _ error)

Get returns the byte slice at the given index from the slice.

func (*Binaries) Set Uses

func (bs *Binaries) Set(index int, binary []byte) error

Set sets the byte slice at the given index in the slice.

func (*Binaries) Size Uses

func (bs *Binaries) Size() int

Size returns the number of byte slice in the slice.

func (*Binaries) String Uses

func (bs *Binaries) String() string

String implements the Stringer interface.

type Block Uses

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

Block represents an entire block in the Ethereum blockchain.

func NewBlockFromJSON Uses

func NewBlockFromJSON(data string) (*Block, error)

NewBlockFromJSON parses a block from a JSON data dump.

func NewBlockFromRLP Uses

func NewBlockFromRLP(data []byte) (*Block, error)

NewBlockFromRLP parses a block from an RLP data dump.

func (*Block) EncodeJSON Uses

func (b *Block) EncodeJSON() (string, error)

EncodeJSON encodes a block into a JSON data dump.

func (*Block) EncodeRLP Uses

func (b *Block) EncodeRLP() ([]byte, error)

EncodeRLP encodes a block into an RLP data dump.

func (*Block) GetBloom Uses

func (b *Block) GetBloom() *Bloom

func (*Block) GetCoinbase Uses

func (b *Block) GetCoinbase() *Address

func (*Block) GetDifficulty Uses

func (b *Block) GetDifficulty() *BigInt

func (*Block) GetExtra Uses

func (b *Block) GetExtra() []byte

func (*Block) GetGasLimit Uses

func (b *Block) GetGasLimit() int64

func (*Block) GetGasUsed Uses

func (b *Block) GetGasUsed() int64

func (*Block) GetHash Uses

func (b *Block) GetHash() *Hash

func (*Block) GetHeader Uses

func (b *Block) GetHeader() *Header

func (*Block) GetMixDigest Uses

func (b *Block) GetMixDigest() *Hash

func (*Block) GetNonce Uses

func (b *Block) GetNonce() int64

func (*Block) GetNumber Uses

func (b *Block) GetNumber() int64

func (*Block) GetParentHash Uses

func (b *Block) GetParentHash() *Hash

func (*Block) GetReceiptHash Uses

func (b *Block) GetReceiptHash() *Hash

func (*Block) GetRoot Uses

func (b *Block) GetRoot() *Hash

func (*Block) GetTime Uses

func (b *Block) GetTime() int64

func (*Block) GetTransaction Uses

func (b *Block) GetTransaction(hash *Hash) *Transaction

func (*Block) GetTransactions Uses

func (b *Block) GetTransactions() *Transactions

func (*Block) GetTxHash Uses

func (b *Block) GetTxHash() *Hash

func (*Block) GetUncleHash Uses

func (b *Block) GetUncleHash() *Hash

func (*Block) GetUncles Uses

func (b *Block) GetUncles() *Headers

type Bloom Uses

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

Bloom represents a 256 bit bloom filter.

func (*Bloom) GetBytes Uses

func (b *Bloom) GetBytes() []byte

GetBytes retrieves the byte representation of the bloom filter.

func (*Bloom) GetHex Uses

func (b *Bloom) GetHex() string

GetHex retrieves the hex string representation of the bloom filter.

type Bools Uses

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

Bools represents a slice of bool.

func (*Bools) Get Uses

func (bs *Bools) Get(index int) (b bool, _ error)

Get returns the bool at the given index from the slice.

func (*Bools) Set Uses

func (bs *Bools) Set(index int, b bool) error

Set sets the bool at the given index in the slice.

func (*Bools) Size Uses

func (bs *Bools) Size() int

Size returns the number of bool in the slice.

func (*Bools) String Uses

func (bs *Bools) String() string

String implements the Stringer interface.

type BoundContract Uses

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

BoundContract is the base wrapper object that reflects a contract on the Ethereum network. It contains a collection of methods that are used by the higher level contract bindings to operate.

func BindContract Uses

func BindContract(address *Address, abiJSON string, client *EthereumClient) (contract *BoundContract, _ error)

BindContract creates a low level contract interface through which calls and transactions may be made through.

func DeployContract Uses

func DeployContract(opts *TransactOpts, abiJSON string, bytecode []byte, client *EthereumClient, args *Interfaces) (contract *BoundContract, _ error)

DeployContract deploys a contract onto the Ethereum blockchain and binds the deployment address with a wrapper.

func (*BoundContract) Call Uses

func (c *BoundContract) Call(opts *CallOpts, out *Interfaces, method string, args *Interfaces) error

Call invokes the (constant) contract method with params as input values and sets the output to result.

func (*BoundContract) GetAddress Uses

func (c *BoundContract) GetAddress() *Address

func (*BoundContract) GetDeployer Uses

func (c *BoundContract) GetDeployer() *Transaction

func (*BoundContract) Transact Uses

func (c *BoundContract) Transact(opts *TransactOpts, method string, args *Interfaces) (tx *Transaction, _ error)

Transact invokes the (paid) contract method with params as input values.

func (*BoundContract) Transfer Uses

func (c *BoundContract) Transfer(opts *TransactOpts) (tx *Transaction, _ error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type CallMsg Uses

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

CallMsg contains parameters for contract calls.

func NewCallMsg Uses

func NewCallMsg() *CallMsg

NewCallMsg creates an empty contract call parameter list.

func (*CallMsg) GetData Uses

func (msg *CallMsg) GetData() []byte

func (*CallMsg) GetFrom Uses

func (msg *CallMsg) GetFrom() *Address

func (*CallMsg) GetGas Uses

func (msg *CallMsg) GetGas() int64

func (*CallMsg) GetGasPrice Uses

func (msg *CallMsg) GetGasPrice() *BigInt

func (*CallMsg) GetTo Uses

func (msg *CallMsg) GetTo() *Address

func (*CallMsg) GetValue Uses

func (msg *CallMsg) GetValue() *BigInt

func (*CallMsg) SetData Uses

func (msg *CallMsg) SetData(data []byte)

func (*CallMsg) SetFrom Uses

func (msg *CallMsg) SetFrom(address *Address)

func (*CallMsg) SetGas Uses

func (msg *CallMsg) SetGas(gas int64)

func (*CallMsg) SetGasPrice Uses

func (msg *CallMsg) SetGasPrice(price *BigInt)

func (*CallMsg) SetTo Uses

func (msg *CallMsg) SetTo(address *Address)

func (*CallMsg) SetValue Uses

func (msg *CallMsg) SetValue(value *BigInt)

type CallOpts Uses

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

CallOpts is the collection of options to fine tune a contract call request.

func NewCallOpts Uses

func NewCallOpts() *CallOpts

NewCallOpts creates a new option set for contract calls.

func (*CallOpts) GetGasLimit Uses

func (opts *CallOpts) GetGasLimit() int64

func (*CallOpts) IsPending Uses

func (opts *CallOpts) IsPending() bool

func (*CallOpts) SetContext Uses

func (opts *CallOpts) SetContext(context *Context)

func (*CallOpts) SetGasLimit Uses

func (opts *CallOpts) SetGasLimit(limit int64)

func (*CallOpts) SetPending Uses

func (opts *CallOpts) SetPending(pending bool)

type Context Uses

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

Context carries a deadline, a cancellation signal, and other values across API boundaries.

func NewContext Uses

func NewContext() *Context

NewContext returns a non-nil, empty Context. It is never canceled, has no values, and has no deadline. It is typically used by the main function, initialization, and tests, and as the top-level Context for incoming requests.

func (*Context) WithCancel Uses

func (c *Context) WithCancel() *Context

WithCancel returns a copy of the original context with cancellation mechanism included.

Canceling this context releases resources associated with it, so code should call cancel as soon as the operations running in this Context complete.

func (*Context) WithDeadline Uses

func (c *Context) WithDeadline(sec int64, nsec int64) *Context

WithDeadline returns a copy of the original context with the deadline adjusted to be no later than the specified time.

Canceling this context releases resources associated with it, so code should call cancel as soon as the operations running in this Context complete.

func (*Context) WithTimeout Uses

func (c *Context) WithTimeout(nsec int64) *Context

WithTimeout returns a copy of the original context with the deadline adjusted to be no later than now + the duration specified.

Canceling this context releases resources associated with it, so code should call cancel as soon as the operations running in this Context complete.

type Criteria Uses

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

Criteria holds various filter options for inbound messages.

func NewCriteria Uses

func NewCriteria(topic []byte) *Criteria

func (*Criteria) GetMinPow Uses

func (c *Criteria) GetMinPow() float64

func (*Criteria) GetPrivateKeyID Uses

func (c *Criteria) GetPrivateKeyID() string

func (*Criteria) GetSig Uses

func (c *Criteria) GetSig() []byte

func (*Criteria) GetSymKeyID Uses

func (c *Criteria) GetSymKeyID() string

func (*Criteria) SetMinPow Uses

func (c *Criteria) SetMinPow(pow float64)

func (*Criteria) SetPrivateKeyID Uses

func (c *Criteria) SetPrivateKeyID(privateKeyID string)

func (*Criteria) SetSig Uses

func (c *Criteria) SetSig(sig []byte)

func (*Criteria) SetSymKeyID Uses

func (c *Criteria) SetSymKeyID(symKeyID string)

type Enode Uses

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

Enode represents a host on the network.

func NewEnode Uses

func NewEnode(rawurl string) (enode *Enode, _ error)

NewEnode parses a node designator.

There are two basic forms of node designators

- incomplete nodes, which only have the public key (node ID)
- complete nodes, which contain the public key and IP/Port information

For incomplete nodes, the designator must look like one of these

enode://<hex node id>
<hex node id>

For complete nodes, the node ID is encoded in the username portion of the URL, separated from the host by an @ sign. The hostname can only be given as an IP address, DNS domain names are not allowed. The port in the host name section is the TCP listening port. If the TCP and UDP (discovery) ports differ, the UDP port is specified as query parameter "discport".

In the following example, the node URL describes a node with IP address 10.3.58.6, TCP listening port 30303 and UDP discovery port 30301.

enode://<hex node id>@10.3.58.6:30303?discport=30301

type Enodes Uses

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

Enodes represents a slice of accounts.

func FoundationBootnodes Uses

func FoundationBootnodes() *Enodes

FoundationBootnodes returns the enode URLs of the P2P bootstrap nodes operated by the foundation running the V5 discovery protocol.

func NewEnodes Uses

func NewEnodes(size int) *Enodes

NewEnodes creates a slice of uninitialized enodes.

func NewEnodesEmpty Uses

func NewEnodesEmpty() *Enodes

NewEnodesEmpty creates an empty slice of Enode values.

func (*Enodes) Append Uses

func (e *Enodes) Append(enode *Enode)

Append adds a new enode element to the end of the slice.

func (*Enodes) Get Uses

func (e *Enodes) Get(index int) (enode *Enode, _ error)

Get returns the enode at the given index from the slice.

func (*Enodes) Set Uses

func (e *Enodes) Set(index int, enode *Enode) error

Set sets the enode at the given index in the slice.

func (*Enodes) Size Uses

func (e *Enodes) Size() int

Size returns the number of enodes in the slice.

type EthereumClient Uses

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

EthereumClient provides access to the Ethereum APIs.

func NewEthereumClient Uses

func NewEthereumClient(rawurl string) (client *EthereumClient, _ error)

NewEthereumClient connects a client to the given URL.

func (*EthereumClient) CallContract Uses

func (ec *EthereumClient) CallContract(ctx *Context, msg *CallMsg, number int64) (output []byte, _ error)

CallContract executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain.

blockNumber selects the block height at which the call runs. It can be <0, in which case the code is taken from the latest known block. Note that state from very old blocks might not be available.

func (*EthereumClient) EstimateGas Uses

func (ec *EthereumClient) EstimateGas(ctx *Context, msg *CallMsg) (gas int64, _ error)

EstimateGas tries to estimate the gas needed to execute a specific transaction based on the current pending state of the backend blockchain. There is no guarantee that this is the true gas limit requirement as other transactions may be added or removed by miners, but it should provide a basis for setting a reasonable default.

func (*EthereumClient) FilterLogs Uses

func (ec *EthereumClient) FilterLogs(ctx *Context, query *FilterQuery) (logs *Logs, _ error)

FilterLogs executes a filter query.

func (*EthereumClient) GetBalanceAt Uses

func (ec *EthereumClient) GetBalanceAt(ctx *Context, account *Address, number int64) (balance *BigInt, _ error)

GetBalanceAt returns the wei balance of the given account. The block number can be <0, in which case the balance is taken from the latest known block.

func (*EthereumClient) GetBlockByHash Uses

func (ec *EthereumClient) GetBlockByHash(ctx *Context, hash *Hash) (block *Block, _ error)

GetBlockByHash returns the given full block.

func (*EthereumClient) GetBlockByNumber Uses

func (ec *EthereumClient) GetBlockByNumber(ctx *Context, number int64) (block *Block, _ error)

GetBlockByNumber returns a block from the current canonical chain. If number is <0, the latest known block is returned.

func (*EthereumClient) GetCodeAt Uses

func (ec *EthereumClient) GetCodeAt(ctx *Context, account *Address, number int64) (code []byte, _ error)

GetCodeAt returns the contract code of the given account. The block number can be <0, in which case the code is taken from the latest known block.

func (*EthereumClient) GetHeaderByHash Uses

func (ec *EthereumClient) GetHeaderByHash(ctx *Context, hash *Hash) (header *Header, _ error)

GetHeaderByHash returns the block header with the given hash.

func (*EthereumClient) GetHeaderByNumber Uses

func (ec *EthereumClient) GetHeaderByNumber(ctx *Context, number int64) (header *Header, _ error)

GetHeaderByNumber returns a block header from the current canonical chain. If number is <0, the latest known header is returned.

func (*EthereumClient) GetNonceAt Uses

func (ec *EthereumClient) GetNonceAt(ctx *Context, account *Address, number int64) (nonce int64, _ error)

GetNonceAt returns the account nonce of the given account. The block number can be <0, in which case the nonce is taken from the latest known block.

func (*EthereumClient) GetPendingBalanceAt Uses

func (ec *EthereumClient) GetPendingBalanceAt(ctx *Context, account *Address) (balance *BigInt, _ error)

GetPendingBalanceAt returns the wei balance of the given account in the pending state.

func (*EthereumClient) GetPendingCodeAt Uses

func (ec *EthereumClient) GetPendingCodeAt(ctx *Context, account *Address) (code []byte, _ error)

GetPendingCodeAt returns the contract code of the given account in the pending state.

func (*EthereumClient) GetPendingNonceAt Uses

func (ec *EthereumClient) GetPendingNonceAt(ctx *Context, account *Address) (nonce int64, _ error)

GetPendingNonceAt returns the account nonce of the given account in the pending state. This is the nonce that should be used for the next transaction.

func (*EthereumClient) GetPendingStorageAt Uses

func (ec *EthereumClient) GetPendingStorageAt(ctx *Context, account *Address, key *Hash) (storage []byte, _ error)

GetPendingStorageAt returns the value of key in the contract storage of the given account in the pending state.

func (*EthereumClient) GetPendingTransactionCount Uses

func (ec *EthereumClient) GetPendingTransactionCount(ctx *Context) (count int, _ error)

GetPendingTransactionCount returns the total number of transactions in the pending state.

func (*EthereumClient) GetStorageAt Uses

func (ec *EthereumClient) GetStorageAt(ctx *Context, account *Address, key *Hash, number int64) (storage []byte, _ error)

GetStorageAt returns the value of key in the contract storage of the given account. The block number can be <0, in which case the value is taken from the latest known block.

func (*EthereumClient) GetTransactionByHash Uses

func (ec *EthereumClient) GetTransactionByHash(ctx *Context, hash *Hash) (tx *Transaction, _ error)

GetTransactionByHash returns the transaction with the given hash.

func (*EthereumClient) GetTransactionCount Uses

func (ec *EthereumClient) GetTransactionCount(ctx *Context, hash *Hash) (count int, _ error)

GetTransactionCount returns the total number of transactions in the given block.

func (*EthereumClient) GetTransactionInBlock Uses

func (ec *EthereumClient) GetTransactionInBlock(ctx *Context, hash *Hash, index int) (tx *Transaction, _ error)

GetTransactionInBlock returns a single transaction at index in the given block.

func (*EthereumClient) GetTransactionReceipt Uses

func (ec *EthereumClient) GetTransactionReceipt(ctx *Context, hash *Hash) (receipt *Receipt, _ error)

GetTransactionReceipt returns the receipt of a transaction by transaction hash. Note that the receipt is not available for pending transactions.

func (*EthereumClient) GetTransactionSender Uses

func (ec *EthereumClient) GetTransactionSender(ctx *Context, tx *Transaction, blockhash *Hash, index int) (sender *Address, _ error)

GetTransactionSender returns the sender address of a transaction. The transaction must be included in blockchain at the given block and index.

func (*EthereumClient) PendingCallContract Uses

func (ec *EthereumClient) PendingCallContract(ctx *Context, msg *CallMsg) (output []byte, _ error)

PendingCallContract executes a message call transaction using the EVM. The state seen by the contract call is the pending state.

func (*EthereumClient) SendTransaction Uses

func (ec *EthereumClient) SendTransaction(ctx *Context, tx *Transaction) error

SendTransaction injects a signed transaction into the pending pool for execution.

If the transaction was a contract creation use the TransactionReceipt method to get the contract address after the transaction has been mined.

func (*EthereumClient) SubscribeFilterLogs Uses

func (ec *EthereumClient) SubscribeFilterLogs(ctx *Context, query *FilterQuery, handler FilterLogsHandler, buffer int) (sub *Subscription, _ error)

SubscribeFilterLogs subscribes to the results of a streaming filter query.

func (*EthereumClient) SubscribeNewHead Uses

func (ec *EthereumClient) SubscribeNewHead(ctx *Context, handler NewHeadHandler, buffer int) (sub *Subscription, _ error)

SubscribeNewHead subscribes to notifications about the current blockchain head on the given channel.

func (*EthereumClient) SuggestGasPrice Uses

func (ec *EthereumClient) SuggestGasPrice(ctx *Context) (price *BigInt, _ error)

SuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.

func (*EthereumClient) SyncProgress Uses

func (ec *EthereumClient) SyncProgress(ctx *Context) (progress *SyncProgress, _ error)

SyncProgress retrieves the current progress of the sync algorithm. If there's no sync currently running, it returns nil.

type FilterLogsHandler Uses

type FilterLogsHandler interface {
    OnFilterLogs(log *Log)
    OnError(failure string)
}

FilterLogsHandler is a client-side subscription callback to invoke on events and subscription failure.

type FilterQuery Uses

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

FilterQuery contains options for contract log filtering.

func NewFilterQuery Uses

func NewFilterQuery() *FilterQuery

NewFilterQuery creates an empty filter query for contract log filtering.

func (*FilterQuery) GetAddresses Uses

func (fq *FilterQuery) GetAddresses() *Addresses

func (*FilterQuery) GetFromBlock Uses

func (fq *FilterQuery) GetFromBlock() *BigInt

func (*FilterQuery) GetToBlock Uses

func (fq *FilterQuery) GetToBlock() *BigInt

func (*FilterQuery) GetTopics Uses

func (fq *FilterQuery) GetTopics() *Topics

func (*FilterQuery) SetAddresses Uses

func (fq *FilterQuery) SetAddresses(addresses *Addresses)

func (*FilterQuery) SetFromBlock Uses

func (fq *FilterQuery) SetFromBlock(fromBlock *BigInt)

func (*FilterQuery) SetToBlock Uses

func (fq *FilterQuery) SetToBlock(toBlock *BigInt)

func (*FilterQuery) SetTopics Uses

func (fq *FilterQuery) SetTopics(topics *Topics)

type Hash Uses

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

Hash represents the 32 byte Keccak256 hash of arbitrary data.

func NewHashFromBytes Uses

func NewHashFromBytes(binary []byte) (hash *Hash, _ error)

NewHashFromBytes converts a slice of bytes to a hash value.

func NewHashFromHex Uses

func NewHashFromHex(hex string) (hash *Hash, _ error)

NewHashFromHex converts a hex string to a hash value.

func (*Hash) GetBytes Uses

func (h *Hash) GetBytes() []byte

GetBytes retrieves the byte representation of the hash.

func (*Hash) GetHex Uses

func (h *Hash) GetHex() string

GetHex retrieves the hex string representation of the hash.

func (*Hash) SetBytes Uses

func (h *Hash) SetBytes(hash []byte) error

SetBytes sets the specified slice of bytes as the hash value.

func (*Hash) SetHex Uses

func (h *Hash) SetHex(hash string) error

SetHex sets the specified hex string as the hash value.

type Hashes Uses

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

Hashes represents a slice of hashes.

func NewHashes Uses

func NewHashes(size int) *Hashes

NewHashes creates a slice of uninitialized Hashes.

func NewHashesEmpty Uses

func NewHashesEmpty() *Hashes

NewHashesEmpty creates an empty slice of Hashes values.

func (*Hashes) Append Uses

func (h *Hashes) Append(hash *Hash)

Append adds a new Hash element to the end of the slice.

func (*Hashes) Get Uses

func (h *Hashes) Get(index int) (hash *Hash, _ error)

Get returns the hash at the given index from the slice.

func (*Hashes) Set Uses

func (h *Hashes) Set(index int, hash *Hash) error

Set sets the Hash at the given index in the slice.

func (*Hashes) Size Uses

func (h *Hashes) Size() int

Size returns the number of hashes in the slice.

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

Header represents a block header in the Ethereum blockchain.

func NewHeaderFromJSON Uses

func NewHeaderFromJSON(data string) (*Header, error)

NewHeaderFromJSON parses a header from a JSON data dump.

func NewHeaderFromRLP Uses

func NewHeaderFromRLP(data []byte) (*Header, error)

NewHeaderFromRLP parses a header from an RLP data dump.

func (*Header) EncodeJSON Uses

func (h *Header) EncodeJSON() (string, error)

EncodeJSON encodes a header into a JSON data dump.

func (*Header) EncodeRLP Uses

func (h *Header) EncodeRLP() ([]byte, error)

EncodeRLP encodes a header into an RLP data dump.

func (*Header) GetBloom Uses

func (h *Header) GetBloom() *Bloom

func (*Header) GetCoinbase Uses

func (h *Header) GetCoinbase() *Address

func (*Header) GetDifficulty Uses

func (h *Header) GetDifficulty() *BigInt

func (*Header) GetExtra Uses

func (h *Header) GetExtra() []byte

func (*Header) GetGasLimit Uses

func (h *Header) GetGasLimit() int64

func (*Header) GetGasUsed Uses

func (h *Header) GetGasUsed() int64

func (*Header) GetHash Uses

func (h *Header) GetHash() *Hash

func (*Header) GetMixDigest Uses

func (h *Header) GetMixDigest() *Hash

func (*Header) GetNonce Uses

func (h *Header) GetNonce() *Nonce

func (*Header) GetNumber Uses

func (h *Header) GetNumber() int64

func (*Header) GetParentHash Uses

func (h *Header) GetParentHash() *Hash

func (*Header) GetReceiptHash Uses

func (h *Header) GetReceiptHash() *Hash

func (*Header) GetRoot Uses

func (h *Header) GetRoot() *Hash

func (*Header) GetTime Uses

func (h *Header) GetTime() int64

func (*Header) GetTxHash Uses

func (h *Header) GetTxHash() *Hash

func (*Header) GetUncleHash Uses

func (h *Header) GetUncleHash() *Hash

type Headers Uses

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

Headers represents a slice of headers.

func (*Headers) Get Uses

func (h *Headers) Get(index int) (header *Header, _ error)

Get returns the header at the given index from the slice.

func (*Headers) Size Uses

func (h *Headers) Size() int

Size returns the number of headers in the slice.

type Info Uses

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

Info represents a diagnostic information about the whisper node.

type Interface Uses

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

Interface represents a wrapped version of Go's interface{}, with the capacity to store arbitrary data types.

Since it's impossible to get the arbitrary-ness converted between Go and mobile platforms, we're using explicit getters and setters for the conversions. There is of course no point in enumerating everything, just enough to support the contract bindins requiring client side generated code.

func NewInterface Uses

func NewInterface() *Interface

NewInterface creates a new empty interface that can be used to pass around generic types.

func (*Interface) GetAddress Uses

func (i *Interface) GetAddress() *Address

func (*Interface) GetAddresses Uses

func (i *Interface) GetAddresses() *Addresses

func (*Interface) GetBigInt Uses

func (i *Interface) GetBigInt() *BigInt

func (*Interface) GetBigInts Uses

func (i *Interface) GetBigInts() *BigInts

func (*Interface) GetBinaries Uses

func (i *Interface) GetBinaries() *Binaries

func (*Interface) GetBinary Uses

func (i *Interface) GetBinary() []byte

func (*Interface) GetBool Uses

func (i *Interface) GetBool() bool

func (*Interface) GetBools Uses

func (i *Interface) GetBools() *Bools

func (*Interface) GetHash Uses

func (i *Interface) GetHash() *Hash

func (*Interface) GetHashes Uses

func (i *Interface) GetHashes() *Hashes

func (*Interface) GetInt16 Uses

func (i *Interface) GetInt16() int16

func (*Interface) GetInt16s Uses

func (i *Interface) GetInt16s() *BigInts

func (*Interface) GetInt32 Uses

func (i *Interface) GetInt32() int32

func (*Interface) GetInt32s Uses

func (i *Interface) GetInt32s() *BigInts

func (*Interface) GetInt64 Uses

func (i *Interface) GetInt64() int64

func (*Interface) GetInt64s Uses

func (i *Interface) GetInt64s() *BigInts

func (*Interface) GetInt8 Uses

func (i *Interface) GetInt8() int8

func (*Interface) GetInt8s Uses

func (i *Interface) GetInt8s() *BigInts

func (*Interface) GetString Uses

func (i *Interface) GetString() string

func (*Interface) GetStrings Uses

func (i *Interface) GetStrings() *Strings

func (*Interface) GetUint16 Uses

func (i *Interface) GetUint16() *BigInt

func (*Interface) GetUint16s Uses

func (i *Interface) GetUint16s() *BigInts

func (*Interface) GetUint32 Uses

func (i *Interface) GetUint32() *BigInt

func (*Interface) GetUint32s Uses

func (i *Interface) GetUint32s() *BigInts

func (*Interface) GetUint64 Uses

func (i *Interface) GetUint64() *BigInt

func (*Interface) GetUint64s Uses

func (i *Interface) GetUint64s() *BigInts

func (*Interface) GetUint8 Uses

func (i *Interface) GetUint8() *BigInt

func (*Interface) GetUint8s Uses

func (i *Interface) GetUint8s() *BigInts

func (*Interface) SetAddress Uses

func (i *Interface) SetAddress(address *Address)

func (*Interface) SetAddresses Uses

func (i *Interface) SetAddresses(addrs *Addresses)

func (*Interface) SetBigInt Uses

func (i *Interface) SetBigInt(bigint *BigInt)

func (*Interface) SetBigInts Uses

func (i *Interface) SetBigInts(bigints *BigInts)

func (*Interface) SetBinaries Uses

func (i *Interface) SetBinaries(binaries *Binaries)

func (*Interface) SetBinary Uses

func (i *Interface) SetBinary(binary []byte)

func (*Interface) SetBool Uses

func (i *Interface) SetBool(b bool)

func (*Interface) SetBools Uses

func (i *Interface) SetBools(bs *Bools)

func (*Interface) SetDefaultAddress Uses

func (i *Interface) SetDefaultAddress()

func (*Interface) SetDefaultAddresses Uses

func (i *Interface) SetDefaultAddresses()

func (*Interface) SetDefaultBigInt Uses

func (i *Interface) SetDefaultBigInt()

func (*Interface) SetDefaultBigInts Uses

func (i *Interface) SetDefaultBigInts()

func (*Interface) SetDefaultBinaries Uses

func (i *Interface) SetDefaultBinaries()

func (*Interface) SetDefaultBinary Uses

func (i *Interface) SetDefaultBinary()

func (*Interface) SetDefaultBool Uses

func (i *Interface) SetDefaultBool()

func (*Interface) SetDefaultBools Uses

func (i *Interface) SetDefaultBools()

func (*Interface) SetDefaultHash Uses

func (i *Interface) SetDefaultHash()

func (*Interface) SetDefaultHashes Uses

func (i *Interface) SetDefaultHashes()

func (*Interface) SetDefaultInt16 Uses

func (i *Interface) SetDefaultInt16()

func (*Interface) SetDefaultInt16s Uses

func (i *Interface) SetDefaultInt16s()

func (*Interface) SetDefaultInt32 Uses

func (i *Interface) SetDefaultInt32()

func (*Interface) SetDefaultInt32s Uses

func (i *Interface) SetDefaultInt32s()

func (*Interface) SetDefaultInt64 Uses

func (i *Interface) SetDefaultInt64()

func (*Interface) SetDefaultInt64s Uses

func (i *Interface) SetDefaultInt64s()

func (*Interface) SetDefaultInt8 Uses

func (i *Interface) SetDefaultInt8()

func (*Interface) SetDefaultInt8s Uses

func (i *Interface) SetDefaultInt8s()

func (*Interface) SetDefaultString Uses

func (i *Interface) SetDefaultString()

func (*Interface) SetDefaultStrings Uses

func (i *Interface) SetDefaultStrings()

func (*Interface) SetDefaultUint16 Uses

func (i *Interface) SetDefaultUint16()

func (*Interface) SetDefaultUint16s Uses

func (i *Interface) SetDefaultUint16s()

func (*Interface) SetDefaultUint32 Uses

func (i *Interface) SetDefaultUint32()

func (*Interface) SetDefaultUint32s Uses

func (i *Interface) SetDefaultUint32s()

func (*Interface) SetDefaultUint64 Uses

func (i *Interface) SetDefaultUint64()

func (*Interface) SetDefaultUint64s Uses

func (i *Interface) SetDefaultUint64s()

func (*Interface) SetDefaultUint8 Uses

func (i *Interface) SetDefaultUint8()

func (*Interface) SetDefaultUint8s Uses

func (i *Interface) SetDefaultUint8s()

func (*Interface) SetHash Uses

func (i *Interface) SetHash(hash *Hash)

func (*Interface) SetHashes Uses

func (i *Interface) SetHashes(hashes *Hashes)

func (*Interface) SetInt16 Uses

func (i *Interface) SetInt16(n int16)

func (*Interface) SetInt16s Uses

func (i *Interface) SetInt16s(bigints *BigInts)

func (*Interface) SetInt32 Uses

func (i *Interface) SetInt32(n int32)

func (*Interface) SetInt32s Uses

func (i *Interface) SetInt32s(bigints *BigInts)

func (*Interface) SetInt64 Uses

func (i *Interface) SetInt64(n int64)

func (*Interface) SetInt64s Uses

func (i *Interface) SetInt64s(bigints *BigInts)

func (*Interface) SetInt8 Uses

func (i *Interface) SetInt8(n int8)

func (*Interface) SetInt8s Uses

func (i *Interface) SetInt8s(bigints *BigInts)

func (*Interface) SetString Uses

func (i *Interface) SetString(str string)

func (*Interface) SetStrings Uses

func (i *Interface) SetStrings(strs *Strings)

func (*Interface) SetUint16 Uses

func (i *Interface) SetUint16(bigint *BigInt)

func (*Interface) SetUint16s Uses

func (i *Interface) SetUint16s(bigints *BigInts)

func (*Interface) SetUint32 Uses

func (i *Interface) SetUint32(bigint *BigInt)

func (*Interface) SetUint32s Uses

func (i *Interface) SetUint32s(bigints *BigInts)

func (*Interface) SetUint64 Uses

func (i *Interface) SetUint64(bigint *BigInt)

func (*Interface) SetUint64s Uses

func (i *Interface) SetUint64s(bigints *BigInts)

func (*Interface) SetUint8 Uses

func (i *Interface) SetUint8(bigint *BigInt)

func (*Interface) SetUint8s Uses

func (i *Interface) SetUint8s(bigints *BigInts)

type Interfaces Uses

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

Interfaces is a slices of wrapped generic objects.

func NewInterfaces Uses

func NewInterfaces(size int) *Interfaces

NewInterfaces creates a slice of uninitialized interfaces.

func (*Interfaces) Get Uses

func (i *Interfaces) Get(index int) (iface *Interface, _ error)

Get returns the bigint at the given index from the slice. Notably the returned value can be changed without affecting the interfaces itself.

func (*Interfaces) Set Uses

func (i *Interfaces) Set(index int, object *Interface) error

Set sets the big int at the given index in the slice.

func (*Interfaces) Size Uses

func (i *Interfaces) Size() int

Size returns the number of interfaces in the slice.

type KeyStore Uses

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

KeyStore manages a key storage directory on disk.

func NewKeyStore Uses

func NewKeyStore(keydir string, scryptN, scryptP int) *KeyStore

NewKeyStore creates a keystore for the given directory.

func (*KeyStore) DeleteAccount Uses

func (ks *KeyStore) DeleteAccount(account *Account, passphrase string) error

DeleteAccount deletes the key matched by account if the passphrase is correct. If a contains no filename, the address must match a unique key.

func (*KeyStore) ExportKey Uses

func (ks *KeyStore) ExportKey(account *Account, passphrase, newPassphrase string) (key []byte, _ error)

ExportKey exports as a JSON key, encrypted with newPassphrase.

func (*KeyStore) GetAccounts Uses

func (ks *KeyStore) GetAccounts() *Accounts

GetAccounts returns all key files present in the directory.

func (*KeyStore) HasAddress Uses

func (ks *KeyStore) HasAddress(address *Address) bool

HasAddress reports whether a key with the given address is present.

func (*KeyStore) ImportECDSAKey Uses

func (ks *KeyStore) ImportECDSAKey(key []byte, passphrase string) (account *Account, _ error)

ImportECDSAKey stores the given encrypted JSON key into the key directory.

func (*KeyStore) ImportKey Uses

func (ks *KeyStore) ImportKey(keyJSON []byte, passphrase, newPassphrase string) (account *Account, _ error)

ImportKey stores the given encrypted JSON key into the key directory.

func (*KeyStore) ImportPreSaleKey Uses

func (ks *KeyStore) ImportPreSaleKey(keyJSON []byte, passphrase string) (ccount *Account, _ error)

ImportPreSaleKey decrypts the given Ethereum presale wallet and stores a key file in the key directory. The key file is encrypted with the same passphrase.

func (*KeyStore) Lock Uses

func (ks *KeyStore) Lock(address *Address) error

Lock removes the private key with the given address from memory.

func (*KeyStore) NewAccount Uses

func (ks *KeyStore) NewAccount(passphrase string) (*Account, error)

NewAccount generates a new key and stores it into the key directory, encrypting it with the passphrase.

func (*KeyStore) SignHash Uses

func (ks *KeyStore) SignHash(address *Address, hash []byte) (signature []byte, _ error)

SignHash calculates a ECDSA signature for the given hash. The produced signature is in the [R || S || V] format where V is 0 or 1.

func (*KeyStore) SignHashPassphrase Uses

func (ks *KeyStore) SignHashPassphrase(account *Account, passphrase string, hash []byte) (signature []byte, _ error)

SignHashPassphrase signs hash if the private key matching the given address can be decrypted with the given passphrase. The produced signature is in the [R || S || V] format where V is 0 or 1.

func (*KeyStore) SignTx Uses

func (ks *KeyStore) SignTx(account *Account, tx *Transaction, chainID *BigInt) (*Transaction, error)

SignTx signs the given transaction with the requested account.

func (*KeyStore) SignTxPassphrase Uses

func (ks *KeyStore) SignTxPassphrase(account *Account, passphrase string, tx *Transaction, chainID *BigInt) (*Transaction, error)

SignTxPassphrase signs the transaction if the private key matching the given address can be decrypted with the given passphrase.

func (*KeyStore) TimedUnlock Uses

func (ks *KeyStore) TimedUnlock(account *Account, passphrase string, timeout int64) error

TimedUnlock unlocks the given account with the passphrase. The account stays unlocked for the duration of timeout (nanoseconds). A timeout of 0 unlocks the account until the program exits. The account must match a unique key file.

If the account address is already unlocked for a duration, TimedUnlock extends or shortens the active unlock timeout. If the address was previously unlocked indefinitely the timeout is not altered.

func (*KeyStore) Unlock Uses

func (ks *KeyStore) Unlock(account *Account, passphrase string) error

Unlock unlocks the given account indefinitely.

func (*KeyStore) UpdateAccount Uses

func (ks *KeyStore) UpdateAccount(account *Account, passphrase, newPassphrase string) error

UpdateAccount changes the passphrase of an existing account.

type Log Uses

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

Log represents a contract log event. These events are generated by the LOG opcode and stored/indexed by the node.

func (*Log) GetAddress Uses

func (l *Log) GetAddress() *Address

func (*Log) GetBlockHash Uses

func (l *Log) GetBlockHash() *Hash

func (*Log) GetBlockNumber Uses

func (l *Log) GetBlockNumber() int64

func (*Log) GetData Uses

func (l *Log) GetData() []byte

func (*Log) GetIndex Uses

func (l *Log) GetIndex() int

func (*Log) GetTopics Uses

func (l *Log) GetTopics() *Hashes

func (*Log) GetTxHash Uses

func (l *Log) GetTxHash() *Hash

func (*Log) GetTxIndex Uses

func (l *Log) GetTxIndex() int

type Logs Uses

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

Logs represents a slice of VM logs.

func (*Logs) Get Uses

func (l *Logs) Get(index int) (log *Log, _ error)

Get returns the log at the given index from the slice.

func (*Logs) Size Uses

func (l *Logs) Size() int

Size returns the number of logs in the slice.

type Message Uses

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

Message represents a whisper message.

func (*Message) GetDst Uses

func (m *Message) GetDst() []byte

func (*Message) GetHash Uses

func (m *Message) GetHash() []byte

func (*Message) GetPayload Uses

func (m *Message) GetPayload() []byte

func (*Message) GetPoW Uses

func (m *Message) GetPoW() float64

func (*Message) GetSig Uses

func (m *Message) GetSig() []byte

func (*Message) GetTTL Uses

func (m *Message) GetTTL() int64

func (*Message) GetTimestamp Uses

func (m *Message) GetTimestamp() int64

type Messages Uses

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

Messages represents an array of messages.

func (*Messages) Get Uses

func (m *Messages) Get(index int) (message *Message, _ error)

Get returns the message at the given index from the slice.

func (*Messages) Size Uses

func (m *Messages) Size() int

Size returns the number of messages in the slice.

type MobileSigner Uses

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

func (*MobileSigner) Sign Uses

func (s *MobileSigner) Sign(addr *Address, unsignedTx *Transaction) (signedTx *Transaction, _ error)

type NewHeadHandler Uses

type NewHeadHandler interface {
    OnNewHead(header *Header)
    OnError(failure string)
}

NewHeadHandler is a client-side subscription callback to invoke on events and subscription failure.

type NewMessage Uses

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

NewMessage represents a new whisper message that is posted through the RPC.

func NewNewMessage Uses

func NewNewMessage() *NewMessage

func (*NewMessage) GetPayload Uses

func (nm *NewMessage) GetPayload() []byte

func (*NewMessage) GetPowTarget Uses

func (nm *NewMessage) GetPowTarget() float64

func (*NewMessage) GetPowTime Uses

func (nm *NewMessage) GetPowTime() int64

func (*NewMessage) GetPublicKey Uses

func (nm *NewMessage) GetPublicKey() []byte

func (*NewMessage) GetSig Uses

func (nm *NewMessage) GetSig() string

func (*NewMessage) GetSymKeyID Uses

func (nm *NewMessage) GetSymKeyID() string

func (*NewMessage) GetTTL Uses

func (nm *NewMessage) GetTTL() int64

func (*NewMessage) GetTargetPeer Uses

func (nm *NewMessage) GetTargetPeer() string

func (*NewMessage) GetTopic Uses

func (nm *NewMessage) GetTopic() []byte

func (*NewMessage) SetPayload Uses

func (nm *NewMessage) SetPayload(payload []byte)

func (*NewMessage) SetPowTarget Uses

func (nm *NewMessage) SetPowTarget(powTarget float64)

func (*NewMessage) SetPowTime Uses

func (nm *NewMessage) SetPowTime(powTime int64)

func (*NewMessage) SetPublicKey Uses

func (nm *NewMessage) SetPublicKey(publicKey []byte)

func (*NewMessage) SetSig Uses

func (nm *NewMessage) SetSig(sig string)

func (*NewMessage) SetSymKeyID Uses

func (nm *NewMessage) SetSymKeyID(symKeyID string)

func (*NewMessage) SetTTL Uses

func (nm *NewMessage) SetTTL(ttl int64)

func (*NewMessage) SetTargetPeer Uses

func (nm *NewMessage) SetTargetPeer(targetPeer string)

func (*NewMessage) SetTopic Uses

func (nm *NewMessage) SetTopic(topic []byte)

type NewMessageHandler Uses

type NewMessageHandler interface {
    OnNewMessage(message *Message)
    OnError(failure string)
}

NewHeadHandler is a client-side subscription callback to invoke on events and subscription failure.

type Node Uses

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

Node represents a Geth Ethereum node instance.

func NewNode Uses

func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error)

NewNode creates and configures a new Geth node.

func (*Node) Close Uses

func (n *Node) Close() error

Close terminates a running node along with all it's services, tearing internal state doen too. It's not possible to restart a closed node.

func (*Node) GetEthereumClient Uses

func (n *Node) GetEthereumClient() (client *EthereumClient, _ error)

GetEthereumClient retrieves a client to access the Ethereum subsystem.

func (*Node) GetNodeInfo Uses

func (n *Node) GetNodeInfo() *NodeInfo

GetNodeInfo gathers and returns a collection of metadata known about the host.

func (*Node) GetPeersInfo Uses

func (n *Node) GetPeersInfo() *PeerInfos

GetPeersInfo returns an array of metadata objects describing connected peers.

func (*Node) Start Uses

func (n *Node) Start() error

Start creates a live P2P node and starts running it.

func (*Node) Stop Uses

func (n *Node) Stop() error

Stop terminates a running node along with all it's services. If the node was not started, an error is returned.

type NodeConfig Uses

type NodeConfig struct {
    // Bootstrap nodes used to establish connectivity with the rest of the network.
    BootstrapNodes *Enodes

    // MaxPeers is the maximum number of peers that can be connected. If this is
    // set to zero, then only the configured static and trusted peers can connect.
    MaxPeers int

    // EthereumEnabled specifies whether the node should run the Ethereum protocol.
    EthereumEnabled bool

    // EthereumNetworkID is the network identifier used by the Ethereum protocol to
    // decide if remote peers should be accepted or not.
    EthereumNetworkID int64 // uint64 in truth, but Java can't handle that...

    // EthereumGenesis is the genesis JSON to use to seed the blockchain with. An
    // empty genesis state is equivalent to using the mainnet's state.
    EthereumGenesis string

    // EthereumDatabaseCache is the system memory in MB to allocate for database caching.
    // A minimum of 16MB is always reserved.
    EthereumDatabaseCache int

    // EthereumNetStats is a netstats connection string to use to report various
    // chain, transaction and node stats to a monitoring server.
    //
    // It has the form "nodename:secret@host:port"
    EthereumNetStats string

    // WhisperEnabled specifies whether the node should run the Whisper protocol.
    WhisperEnabled bool

    // Listening address of pprof server.
    PprofAddress string

    // Ultra Light client options
    ULC *eth.ULCConfig
}

NodeConfig represents the collection of configuration values to fine tune the Geth node embedded into a mobile process. The available values are a subset of the entire API provided by go-ethereum to reduce the maintenance surface and dev complexity.

func NewNodeConfig Uses

func NewNodeConfig() *NodeConfig

NewNodeConfig creates a new node option set, initialized to the default values.

type NodeInfo Uses

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

NodeInfo represents pi short summary of the information known about the host.

func (*NodeInfo) GetDiscoveryPort Uses

func (ni *NodeInfo) GetDiscoveryPort() int

func (*NodeInfo) GetEnode Uses

func (ni *NodeInfo) GetEnode() string

func (*NodeInfo) GetID Uses

func (ni *NodeInfo) GetID() string

func (*NodeInfo) GetIP Uses

func (ni *NodeInfo) GetIP() string

func (*NodeInfo) GetListenerAddress Uses

func (ni *NodeInfo) GetListenerAddress() string

func (*NodeInfo) GetListenerPort Uses

func (ni *NodeInfo) GetListenerPort() int

func (*NodeInfo) GetName Uses

func (ni *NodeInfo) GetName() string

func (*NodeInfo) GetProtocols Uses

func (ni *NodeInfo) GetProtocols() *Strings

type Nonce Uses

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

A Nonce is a 64-bit hash which proves (combined with the mix-hash) that a sufficient amount of computation has been carried out on a block.

func (*Nonce) GetBytes Uses

func (n *Nonce) GetBytes() []byte

GetBytes retrieves the byte representation of the block nonce.

func (*Nonce) GetHex Uses

func (n *Nonce) GetHex() string

GetHex retrieves the hex string representation of the block nonce.

type PeerInfo Uses

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

PeerInfo represents pi short summary of the information known about pi connected peer.

func (*PeerInfo) GetCaps Uses

func (pi *PeerInfo) GetCaps() *Strings

func (*PeerInfo) GetID Uses

func (pi *PeerInfo) GetID() string

func (*PeerInfo) GetLocalAddress Uses

func (pi *PeerInfo) GetLocalAddress() string

func (*PeerInfo) GetName Uses

func (pi *PeerInfo) GetName() string

func (*PeerInfo) GetRemoteAddress Uses

func (pi *PeerInfo) GetRemoteAddress() string

type PeerInfos Uses

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

PeerInfos represents a slice of infos about remote peers.

func (*PeerInfos) Get Uses

func (pi *PeerInfos) Get(index int) (info *PeerInfo, _ error)

Get returns the peer info at the given index from the slice.

func (*PeerInfos) Size Uses

func (pi *PeerInfos) Size() int

Size returns the number of peer info entries in the slice.

type Receipt Uses

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

Receipt represents the results of a transaction.

func NewReceiptFromJSON Uses

func NewReceiptFromJSON(data string) (*Receipt, error)

NewReceiptFromJSON parses a transaction receipt from a JSON data dump.

func NewReceiptFromRLP Uses

func NewReceiptFromRLP(data []byte) (*Receipt, error)

NewReceiptFromRLP parses a transaction receipt from an RLP data dump.

func (*Receipt) EncodeJSON Uses

func (r *Receipt) EncodeJSON() (string, error)

EncodeJSON encodes a transaction receipt into a JSON data dump.

func (*Receipt) EncodeRLP Uses

func (r *Receipt) EncodeRLP() ([]byte, error)

EncodeRLP encodes a transaction receipt into an RLP data dump.

func (*Receipt) GetBloom Uses

func (r *Receipt) GetBloom() *Bloom

func (*Receipt) GetContractAddress Uses

func (r *Receipt) GetContractAddress() *Address

func (*Receipt) GetCumulativeGasUsed Uses

func (r *Receipt) GetCumulativeGasUsed() int64

func (*Receipt) GetGasUsed Uses

func (r *Receipt) GetGasUsed() int64

func (*Receipt) GetLogs Uses

func (r *Receipt) GetLogs() *Logs

func (*Receipt) GetPostState Uses

func (r *Receipt) GetPostState() []byte

func (*Receipt) GetStatus Uses

func (r *Receipt) GetStatus() int

func (*Receipt) GetTxHash Uses

func (r *Receipt) GetTxHash() *Hash

type Signer Uses

type Signer interface {
    Sign(*Address, *Transaction) (tx *Transaction, _ error)
}

Signer is an interface defining the callback when a contract requires a method to sign the transaction before submission.

type Strings Uses

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

Strings represents s slice of strs.

func (*Strings) Get Uses

func (s *Strings) Get(index int) (str string, _ error)

Get returns the string at the given index from the slice.

func (*Strings) Set Uses

func (s *Strings) Set(index int, str string) error

Set sets the string at the given index in the slice.

func (*Strings) Size Uses

func (s *Strings) Size() int

Size returns the number of strs in the slice.

func (*Strings) String Uses

func (s *Strings) String() string

String implements the Stringer interface.

type Subscription Uses

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

Subscription represents an event subscription where events are delivered on a data channel.

func (*Subscription) Unsubscribe Uses

func (s *Subscription) Unsubscribe()

Unsubscribe cancels the sending of events to the data channel and closes the error channel.

type SyncProgress Uses

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

SyncProgress gives progress indications when the node is synchronising with the Ethereum network.

func (*SyncProgress) GetCurrentBlock Uses

func (p *SyncProgress) GetCurrentBlock() int64

func (*SyncProgress) GetHighestBlock Uses

func (p *SyncProgress) GetHighestBlock() int64

func (*SyncProgress) GetKnownStates Uses

func (p *SyncProgress) GetKnownStates() int64

func (*SyncProgress) GetPulledStates Uses

func (p *SyncProgress) GetPulledStates() int64

func (*SyncProgress) GetStartingBlock Uses

func (p *SyncProgress) GetStartingBlock() int64

type Topics Uses

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

Topics is a set of topic lists to filter events with.

func NewTopics Uses

func NewTopics(size int) *Topics

NewTopics creates a slice of uninitialized Topics.

func NewTopicsEmpty Uses

func NewTopicsEmpty() *Topics

NewTopicsEmpty creates an empty slice of Topics values.

func (*Topics) Append Uses

func (t *Topics) Append(topics *Hashes)

Append adds a new topic list to the end of the slice.

func (*Topics) Get Uses

func (t *Topics) Get(index int) (hashes *Hashes, _ error)

Get returns the topic list at the given index from the slice.

func (*Topics) Set Uses

func (t *Topics) Set(index int, topics *Hashes) error

Set sets the topic list at the given index in the slice.

func (*Topics) Size Uses

func (t *Topics) Size() int

Size returns the number of topic lists inside the set

type TransactOpts Uses

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

TransactOpts is the collection of authorization data required to create a valid Ethereum transaction.

func NewKeyedTransactOpts Uses

func NewKeyedTransactOpts(keyJson []byte, passphrase string) (*TransactOpts, error)

NewKeyedTransactor is a utility method to easily create a transaction signer from a single private key.

func NewTransactOpts Uses

func NewTransactOpts() *TransactOpts

NewTransactOpts creates a new option set for contract transaction.

func (*TransactOpts) GetFrom Uses

func (opts *TransactOpts) GetFrom() *Address

func (*TransactOpts) GetGasLimit Uses

func (opts *TransactOpts) GetGasLimit() int64

func (*TransactOpts) GetGasPrice Uses

func (opts *TransactOpts) GetGasPrice() *BigInt

func (*TransactOpts) GetNonce Uses

func (opts *TransactOpts) GetNonce() int64

func (*TransactOpts) GetValue Uses

func (opts *TransactOpts) GetValue() *BigInt

func (*TransactOpts) SetContext Uses

func (opts *TransactOpts) SetContext(context *Context)

func (*TransactOpts) SetFrom Uses

func (opts *TransactOpts) SetFrom(from *Address)

func (*TransactOpts) SetGasLimit Uses

func (opts *TransactOpts) SetGasLimit(limit int64)

func (*TransactOpts) SetGasPrice Uses

func (opts *TransactOpts) SetGasPrice(price *BigInt)

func (*TransactOpts) SetNonce Uses

func (opts *TransactOpts) SetNonce(nonce int64)

func (*TransactOpts) SetSigner Uses

func (opts *TransactOpts) SetSigner(s Signer)

func (*TransactOpts) SetValue Uses

func (opts *TransactOpts) SetValue(value *BigInt)

type Transaction Uses

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

Transaction represents a single Ethereum transaction.

func NewContractCreation Uses

func NewContractCreation(nonce int64, amount *BigInt, gasLimit int64, gasPrice *BigInt, data []byte) *Transaction

NewContractCreation creates a new transaction for deploying a new contract with the given properties.

func NewTransaction Uses

func NewTransaction(nonce int64, to *Address, amount *BigInt, gasLimit int64, gasPrice *BigInt, data []byte) *Transaction

NewTransaction creates a new transaction with the given properties. Contracts can be created by transacting with a nil recipient.

func NewTransactionFromJSON Uses

func NewTransactionFromJSON(data string) (*Transaction, error)

NewTransactionFromJSON parses a transaction from a JSON data dump.

func NewTransactionFromRLP Uses

func NewTransactionFromRLP(data []byte) (*Transaction, error)

NewTransactionFromRLP parses a transaction from an RLP data dump.

func (*Transaction) EncodeJSON Uses

func (tx *Transaction) EncodeJSON() (string, error)

EncodeJSON encodes a transaction into a JSON data dump.

func (*Transaction) EncodeRLP Uses

func (tx *Transaction) EncodeRLP() ([]byte, error)

EncodeRLP encodes a transaction into an RLP data dump.

func (*Transaction) GetCost Uses

func (tx *Transaction) GetCost() *BigInt

func (*Transaction) GetData Uses

func (tx *Transaction) GetData() []byte

func (*Transaction) GetFrom Uses

func (tx *Transaction) GetFrom(chainID *BigInt) (address *Address, _ error)

Deprecated: use EthereumClient.TransactionSender

func (*Transaction) GetGas Uses

func (tx *Transaction) GetGas() int64

func (*Transaction) GetGasPrice Uses

func (tx *Transaction) GetGasPrice() *BigInt

func (*Transaction) GetHash Uses

func (tx *Transaction) GetHash() *Hash

func (*Transaction) GetNonce Uses

func (tx *Transaction) GetNonce() int64

func (*Transaction) GetSigHash Uses

func (tx *Transaction) GetSigHash() *Hash

Deprecated: GetSigHash cannot know which signer to use.

func (*Transaction) GetTo Uses

func (tx *Transaction) GetTo() *Address

func (*Transaction) GetValue Uses

func (tx *Transaction) GetValue() *BigInt

func (*Transaction) WithSignature Uses

func (tx *Transaction) WithSignature(sig []byte, chainID *BigInt) (signedTx *Transaction, _ error)

type Transactions Uses

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

Transactions represents a slice of transactions.

func (*Transactions) Get Uses

func (txs *Transactions) Get(index int) (tx *Transaction, _ error)

Get returns the transaction at the given index from the slice.

func (*Transactions) Size Uses

func (txs *Transactions) Size() int

Size returns the number of transactions in the slice.

type WhisperClient Uses

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

WhisperClient provides access to the Ethereum APIs.

func NewWhisperClient Uses

func NewWhisperClient(rawurl string) (client *WhisperClient, _ error)

NewWhisperClient connects a client to the given URL.

func (*WhisperClient) AddPrivateKey Uses

func (wc *WhisperClient) AddPrivateKey(ctx *Context, key []byte) (string, error)

AddPrivateKey stored the key pair, and returns its ID.

func (*WhisperClient) AddSymmetricKey Uses

func (wc *WhisperClient) AddSymmetricKey(ctx *Context, key []byte) (string, error)

AddSymmetricKey stores the key, and returns its identifier.

func (*WhisperClient) DeleteKeyPair Uses

func (wc *WhisperClient) DeleteKeyPair(ctx *Context, id string) (string, error)

DeleteKeyPair delete the specifies key.

func (*WhisperClient) DeleteMessageFilter Uses

func (wc *WhisperClient) DeleteMessageFilter(ctx *Context, id string) error

DeleteMessageFilter removes the filter associated with the given id.

func (*WhisperClient) DeleteSymmetricKey Uses

func (wc *WhisperClient) DeleteSymmetricKey(ctx *Context, id string) error

DeleteSymmetricKey deletes the symmetric key associated with the given identifier.

func (*WhisperClient) GenerateSymmetricKeyFromPassword Uses

func (wc *WhisperClient) GenerateSymmetricKeyFromPassword(ctx *Context, passwd string) (string, error)

GenerateSymmetricKeyFromPassword generates the key from password, stores it, and returns its identifier.

func (*WhisperClient) GetFilterMessages Uses

func (wc *WhisperClient) GetFilterMessages(ctx *Context, id string) (*Messages, error)

GetFilterMessages retrieves all messages that are received between the last call to this function and match the criteria that where given when the filter was created.

func (*WhisperClient) GetInfo Uses

func (wc *WhisperClient) GetInfo(ctx *Context) (info *Info, _ error)

Info returns diagnostic information about the whisper node.

func (*WhisperClient) GetPrivateKey Uses

func (wc *WhisperClient) GetPrivateKey(ctx *Context, id string) ([]byte, error)

GetPrivateKey return the private key for a key ID.

func (*WhisperClient) GetPublicKey Uses

func (wc *WhisperClient) GetPublicKey(ctx *Context, id string) ([]byte, error)

GetPublicKey return the public key for a key ID.

func (*WhisperClient) GetSymmetricKey Uses

func (wc *WhisperClient) GetSymmetricKey(ctx *Context, id string) ([]byte, error)

GetSymmetricKey returns the symmetric key associated with the given identifier.

func (*WhisperClient) GetVersion Uses

func (wc *WhisperClient) GetVersion(ctx *Context) (version string, _ error)

GetVersion returns the Whisper sub-protocol version.

func (*WhisperClient) HasKeyPair Uses

func (wc *WhisperClient) HasKeyPair(ctx *Context, id string) (bool, error)

HasKeyPair returns an indication if the node has a private key or key pair matching the given ID.

func (*WhisperClient) HasSymmetricKey Uses

func (wc *WhisperClient) HasSymmetricKey(ctx *Context, id string) (bool, error)

HasSymmetricKey returns an indication if the key associated with the given id is stored in the node.

func (*WhisperClient) MarkTrustedPeer Uses

func (wc *WhisperClient) MarkTrustedPeer(ctx *Context, enode string) error

Marks specific peer trusted, which will allow it to send historic (expired) messages. Note This function is not adding new nodes, the node needs to exists as a peer.

func (*WhisperClient) NewKeyPair Uses

func (wc *WhisperClient) NewKeyPair(ctx *Context) (string, error)

NewKeyPair generates a new public and private key pair for message decryption and encryption. It returns an identifier that can be used to refer to the key.

func (*WhisperClient) NewMessageFilter Uses

func (wc *WhisperClient) NewMessageFilter(ctx *Context, criteria *Criteria) (string, error)

NewMessageFilter creates a filter within the node. This filter can be used to poll for new messages (see FilterMessages) that satisfy the given criteria. A filter can timeout when it was polled for in whisper.filterTimeout.

func (*WhisperClient) NewSymmetricKey Uses

func (wc *WhisperClient) NewSymmetricKey(ctx *Context) (string, error)

NewSymmetricKey generates a random symmetric key and returns its identifier. Can be used encrypting and decrypting messages where the key is known to both parties.

func (*WhisperClient) Post Uses

func (wc *WhisperClient) Post(ctx *Context, message *NewMessage) (string, error)

Post a message onto the network.

func (*WhisperClient) SetMaxMessageSize Uses

func (wc *WhisperClient) SetMaxMessageSize(ctx *Context, size int32) error

SetMaxMessageSize sets the maximal message size allowed by this node. Incoming and outgoing messages with a larger size will be rejected. Whisper message size can never exceed the limit imposed by the underlying P2P protocol (10 Mb).

func (*WhisperClient) SetMinimumPoW Uses

func (wc *WhisperClient) SetMinimumPoW(ctx *Context, pow float64) error

SetMinimumPoW (experimental) sets the minimal PoW required by this node. This experimental function was introduced for the future dynamic adjustment of PoW requirement. If the node is overwhelmed with messages, it should raise the PoW requirement and notify the peers. The new value should be set relative to the old value (e.g. double). The old value could be obtained via shh_info call.

func (*WhisperClient) SubscribeMessages Uses

func (wc *WhisperClient) SubscribeMessages(ctx *Context, criteria *Criteria, handler NewMessageHandler, buffer int) (*Subscription, error)

SubscribeMessages subscribes to messages that match the given criteria. This method is only supported on bi-directional connections such as websockets and IPC. NewMessageFilter uses polling and is supported over HTTP.

Package geth imports 36 packages (graph). Updated 2019-07-06. Refresh now. Tools for package owners.