Documentation ¶
Index ¶
- Constants
- Variables
- func AESCTRXOR(key, inText, iv []byte) ([]byte, error)
- func AESCTRXOREmptyOnError(key, inText, iv []byte) []byte
- func AddPrivKeys(curve int, key1 []byte, key2 []byte) []byte
- func AddPubKeys(curve int, key1 []byte, key2 []byte) []byte
- func CompressedPubKey(curve int, priv []byte) []byte
- func Hash(data []byte, hashFn int) []byte
- func HashData(kh KeccakState, data []byte) []byte
- func HashFunc(h int) func() hash.Hash
- func HmacSha512(key []byte, data []byte) []byte
- func IsBip44ValidPrv(curve int, key []byte) bool
- func IsBip44ValidPub(curve int, key []byte) bool
- func Keccak256(data []byte) []byte
- func Keccak512(data []byte) []byte
- func Pbkdf2(password, salt []byte, iter, keyLen, hashFn int) []byte
- func ScryptKey(pswd, salt []byte, N, r, p, keyLen int) []byte
- func SecureRand(size int) ([]byte, error)
- func SecureRandFatal(size int) []byte
- func Sign(digestHash []byte, prv []byte, curve int) (sig []byte, err error)
- func SignEmptyOnError(digestHash []byte, prv []byte, curve int) []byte
- func UncompressedPubKey(curve int, pubKey []byte) []byte
- type Enode
- type Enodes
- type KeccakState
- type Node
- type NodeConfig
- func (nc *NodeConfig) AddBootstrapNode(node *Enode)
- func (nc *NodeConfig) BootstrapNodes() *Enodes
- func (nc *NodeConfig) EthereumDatabaseCache() int
- func (nc *NodeConfig) EthereumEnabled() bool
- func (nc *NodeConfig) EthereumGenesis() string
- func (nc *NodeConfig) EthereumNetStats() string
- func (nc *NodeConfig) EthereumNetworkID() int64
- func (nc *NodeConfig) MaxPeers() int
- func (nc *NodeConfig) PprofAddress() string
- func (nc *NodeConfig) SetEthereumDatabaseCache(databaseCache int)
- func (nc *NodeConfig) SetEthereumEnabled(ethereumEnabled bool)
- func (nc *NodeConfig) SetEthereumGenesis(genesis string)
- func (nc *NodeConfig) SetEthereumNetStats(netStats string)
- func (nc *NodeConfig) SetEthereumNetworkID(networkID int64)
- func (nc *NodeConfig) SetMaxPeers(maxPeers int)
- func (nc *NodeConfig) SetPprofAddress(pprofAddress string)
- type NodeInfo
- type PeerInfos
Constants ¶
const ( HashFnSha256 = iota HashFnSha512 = iota HashFnKeccak256 = iota HashFnKeccak512 = iota HashFnRipemd160 = iota )
HashFn is `int`, not type due to `go bind` support (it does not support enums)
const ( SecretStorageHeaderKDF = "scrypt" SecretStorageCipherAes128Crt = "aes-128-ctr" SecretStorageScryptN = 1 << 18 SecretStorageScryptP = 1 SecretStorageScryptR = 8 SecretStorageScryptDKLen = 32 SecretStoragePrivateKeyMinLen = 32 )
Secret storage constants
const (
CurveSecp256k1 = iota
)
CurveSecp256k1 is `int`, not type due to `go bind` support (it does not support enums)
const DigestLength = 32
DigestLength sets the signature digest exact length
Variables ¶
var (
ErrDecrypt = errors.New("could not decrypt key with given password")
)
Functions ¶
func AESCTRXOREmptyOnError ¶
func AddPrivKeys ¶
AddPrivKeys Add key to key on a curve
func AddPubKeys ¶
AddPubKeys Add key to key on a curve
func CompressedPubKey ¶
CompressedPubKey for given curve, user CurveXYZ constants above. (Not type due to `go bind` interop)
func Hash ¶
Hash pass one of the hash constants from top of the file. (`HashFnSha256`, `HashFnSha512`, ...) Enum not used due to `go bind` (does not support enums)
func HashData ¶
func HashData(kh KeccakState, data []byte) []byte
HashData hashes the provided data using the KeccakState and returns a 32 byte hash
func HmacSha512 ¶
HmacSha512 return hmacSha512 of data, using key
func IsBip44ValidPrv ¶
IsBip44ValidPrv checks that key bip44 compliant
func IsBip44ValidPub ¶
IsBip44Compliant checks that key bip44 compliant
func Pbkdf2 ¶
Pbkdf2 pass one of the hash constants from top of the file. (`HashFnSha256`, `HashFnSha512`, ...) Enum not used due to `go bind` (does not support enums)
func SecureRand ¶
SecureRand cryptographically secure random bytes of size or error
func SecureRandFatal ¶
SecureRandFatal cryptographically secure random bytes of size crashes if err
func UncompressedPubKey ¶
UncompressedPubKey for given curve, decompresses compressed put key Returns empty byte array on error. (Not type due to `go bind` interop)
Types ¶
type Enode ¶
type Enode struct {
// contains filtered or unexported fields
}
Enode represents a host on the network.
type Enodes ¶
type Enodes struct {
// contains filtered or unexported fields
}
Enodes represents a slice of accounts.
type KeccakState ¶
KeccakState wraps sha3.state. In addition to the usual hash methods, it also supports Read to get a variable amount of data from the hash state. Read is faster than Sum because it doesn't copy the internal state, but also modifies the internal state.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func NewGethNode ¶
func NewGethNode(datadir string, config *NodeConfig) (stack *Node, _ error)
NewGethNode creates and configures a new Geth node.
func NewGethNodeFataln ¶
func NewGethNodeFataln(datadir string, config *NodeConfig) (stack *Node)
NewGethNodeFataln creates and configures a new Geth node.
func (*Node) Close ¶
Close terminates a running node along with all it's services, tearing internal state down. It is not possible to restart a closed node.
func (*Node) GetNodeInfo ¶
GetNodeInfo gathers and returns a collection of metadata known about the host.
func (*Node) GetPeersInfo ¶
GetPeersInfo returns an array of metadata objects describing connected peers.
type NodeConfig ¶
type NodeConfig struct {
// contains filtered or unexported fields
}
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 ¶
func NewNodeConfig() *NodeConfig
NewNodeConfig creates a new node option set, initialized to the default values.
func (*NodeConfig) AddBootstrapNode ¶
func (nc *NodeConfig) AddBootstrapNode(node *Enode)
AddBootstrapNode adds a bootstrap node to the node config.
func (*NodeConfig) BootstrapNodes ¶
func (nc *NodeConfig) BootstrapNodes() *Enodes
BootstrapNodes used to establish connectivity with the rest of the network.
func (*NodeConfig) EthereumDatabaseCache ¶
func (nc *NodeConfig) EthereumDatabaseCache() int
EthereumDatabaseCache is the system memory in MB to allocate for database caching. A minimum of 16MB is always reserved.
func (*NodeConfig) EthereumEnabled ¶
func (nc *NodeConfig) EthereumEnabled() bool
EthereumEnabled specifies whether the node should run the Ethereum protocol.
func (*NodeConfig) EthereumGenesis ¶
func (nc *NodeConfig) EthereumGenesis() string
EthereumGenesis is the genesis JSON to use to seed the blockchain with. An empty genesis state is equivalent to using the mainnet's state.
func (*NodeConfig) EthereumNetStats ¶
func (nc *NodeConfig) EthereumNetStats() string
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"
func (*NodeConfig) EthereumNetworkID ¶
func (nc *NodeConfig) EthereumNetworkID() int64
EthereumNetworkID is the network identifier used by the Ethereum protocol to decide if remote peers should be accepted or not.
func (*NodeConfig) MaxPeers ¶
func (nc *NodeConfig) MaxPeers() int
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.
func (*NodeConfig) PprofAddress ¶
func (nc *NodeConfig) PprofAddress() string
PprofAddress listening address of pprof server.
func (*NodeConfig) SetEthereumDatabaseCache ¶
func (nc *NodeConfig) SetEthereumDatabaseCache(databaseCache int)
SetEthereumDatabaseCache is the system memory in MB to allocate for database caching. A minimum of 16MB is always reserved.
func (*NodeConfig) SetEthereumEnabled ¶
func (nc *NodeConfig) SetEthereumEnabled(ethereumEnabled bool)
SetEthereumEnabled specifies whether the node should run the Ethereum protocol.
func (*NodeConfig) SetEthereumGenesis ¶
func (nc *NodeConfig) SetEthereumGenesis(genesis string)
SetEthereumGenesis is the genesis JSON to use to seed the blockchain with. An empty genesis state is equivalent to using the mainnet's state.
func (*NodeConfig) SetEthereumNetStats ¶
func (nc *NodeConfig) SetEthereumNetStats(netStats string)
SetEthereumNetStats 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"
func (*NodeConfig) SetEthereumNetworkID ¶
func (nc *NodeConfig) SetEthereumNetworkID(networkID int64)
SetEthereumNetworkID is the network identifier used by the Ethereum protocol to decide if remote peers should be accepted or not.
func (*NodeConfig) SetMaxPeers ¶
func (nc *NodeConfig) SetMaxPeers(maxPeers int)
SetMaxPeers 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.
func (*NodeConfig) SetPprofAddress ¶
func (nc *NodeConfig) SetPprofAddress(pprofAddress string)
SetPprofAddress listening address of pprof server.