Documentation
¶
Index ¶
- Constants
- func Clean(path string, arg int) error
- func CreateKeyStore(path, passwd string, ScryptN, ScryptP int) (string, error)
- func DefaultDataDir() string
- func PathExists(path string) (bool, error)
- type Account
- type Accounts
- type ActivatePost
- type Address
- type BigInt
- func (bi *BigInt) GetBytes() []byte
- func (bi *BigInt) GetInt64() int64
- func (bi *BigInt) GetString(base int) string
- func (bi *BigInt) SetBytes(buf []byte)
- func (bi *BigInt) SetInt64(x int64)
- func (bi *BigInt) SetString(x string, base int)
- func (bi *BigInt) Sign() int
- func (bi *BigInt) String() string
- type BigInts
- type Enodesv4
- type Enodev4
- type KeyStore
- func (ks *KeyStore) DeleteAccount(account *Account, passphrase string) error
- func (ks *KeyStore) ExportKey(account *Account, passphrase, newPassphrase string) (key []byte, _ error)
- func (ks *KeyStore) GetAccounts() *Accounts
- func (ks *KeyStore) HasAddress(address *Address) bool
- func (ks *KeyStore) ImportKey(keyJSON []byte, passphrase, newPassphrase string) (account *Account, _ error)
- func (ks *KeyStore) Lock(address *Address) error
- func (ks *KeyStore) NewAccount(passphrase string) (*Account, error)
- func (ks *KeyStore) SignHash(address *Address, hash []byte) (signature []byte, _ error)
- func (ks *KeyStore) SignHashPassphrase(account *Account, passphrase string, hash []byte) (signature []byte, _ error)
- func (ks *KeyStore) TimedUnlock(account *Account, passphrase string, timeout int64) error
- func (ks *KeyStore) Unlock(account *Account, passphrase string) error
- func (ks *KeyStore) UpdateAccount(account *Account, passphrase, newPassphrase string) error
- type Node
- func (n *Node) AddBootnode(enodeStr string) error
- func (n *Node) AddPeer(peer *Enodev4)
- func (n *Node) Close() error
- func (n *Node) GetFileBaseUrl() string
- func (n *Node) GetFileUrl(cdnUrl string, hash string) string
- func (n *Node) GetHttpPort() string
- func (n *Node) GetM3U8BaseUrl() string
- func (n *Node) GetM3U8Url(cdnUrl string, hash string) string
- func (n *Node) GetNodeInfo() *NodeInfo
- func (n *Node) GetPeersInfo() *PeerInfos
- func (n *Node) SetHttpPort(port string)
- func (n *Node) Start() error
- func (n *Node) Stop() error
- type NodeConfig
- type NodeInfo
- func (ni *NodeInfo) GetDiscoveryPort() int
- func (ni *NodeInfo) GetEnode() string
- func (ni *NodeInfo) GetID() string
- func (ni *NodeInfo) GetIP() string
- func (ni *NodeInfo) GetListenerAddress() string
- func (ni *NodeInfo) GetListenerPort() int
- func (ni *NodeInfo) GetName() string
- func (ni *NodeInfo) GetProtocols() *Strings
- type PeerInfo
- type PeerInfos
- type RespData
- func Activate(path string, appId string, credential string, addr string, newAccount bool, ...) (*RespData, error)
- func ActivateR(path string, appId string, clientId string, credential string, addr string, ...) (*RespData, error)
- func PostToServer(urlStr string, timeout time.Duration, data *ActivatePost) (*RespData, error)
- type Strings
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) )
Variables ¶
This section is empty.
Functions ¶
func CreateKeyStore ¶
func DefaultDataDir ¶
func DefaultDataDir() string
func PathExists ¶
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account represents a stored key.
func (*Account) GetAddress ¶
GetAddress retrieves the address associated with the account.
type Accounts ¶
type Accounts struct {
// contains filtered or unexported fields
}
Accounts represents a slice of accounts.
type ActivatePost ¶
type BigInt ¶
type BigInt struct {
// contains filtered or unexported fields
}
A BigInt represents a signed multi-precision integer.
func (*BigInt) GetInt64 ¶
GetInt64 returns the int64 representation of x. If x cannot be represented in an int64, the result is undefined.
func (*BigInt) GetString ¶
GetString returns the value of x as a formatted string in some number base.
func (*BigInt) SetBytes ¶
SetBytes interprets buf as the bytes of a big-endian unsigned integer and sets the big int to that value.
func (*BigInt) SetString ¶
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.
type BigInts ¶
type BigInts struct {
// contains filtered or unexported fields
}
BigInts represents a slice of big ints.
func NewBigInts ¶
NewBigInts creates a slice of uninitialized big numbers.
type Enodesv4 ¶
type Enodesv4 struct {
// contains filtered or unexported fields
}
Enodes represents a slice of accounts.
func NewEnodesEmptyv4 ¶
func NewEnodesEmptyv4() *Enodesv4
NewEnodesEmpty creates an empty slice of Enode values.
func NewEnodesv4 ¶
NewEnodes creates a slice of uninitialized enodes.
type Enodev4 ¶
type Enodev4 struct {
// contains filtered or unexported fields
}
Enode represents a host on the network.
func NewEnodev4 ¶
type KeyStore ¶
type KeyStore struct {
// contains filtered or unexported fields
}
KeyStore manages a key storage directory on disk.
func NewKeyStore ¶
NewKeyStore creates a keystore for the given directory.
func (*KeyStore) DeleteAccount ¶
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 ¶
func (ks *KeyStore) ExportKey(account *Account, passphrase, newPassphrase string) (key []byte, _ error)
ExportKey exports as a JSON key, encrypted with newPassphrase.
func (*KeyStore) GetAccounts ¶
GetAccounts returns all key files present in the directory.
func (*KeyStore) HasAddress ¶
HasAddress reports whether a key with the given address is present.
func (*KeyStore) ImportKey ¶
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) NewAccount ¶
NewAccount generates a new key and stores it into the key directory, encrypting it with the passphrase.
func (*KeyStore) SignHash ¶
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 ¶
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) TimedUnlock ¶
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.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a Geth Ethereum node instance.
func NewSwarmNode ¶
func NewSwarmNode(datadir string, config *NodeConfig) (stack *Node, _ error)
func (*Node) AddBootnode ¶
func (*Node) Close ¶
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) 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.
func (*Node) SetHttpPort ¶
type NodeConfig ¶
type NodeConfig struct { // 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... // SwarmEnabled specifies whether the node should run the Swarm protocol. SwarmEnabled bool // SwarmAccount specifies account ID used for starting Swarm node. SwarmAccount string // SwarmAccountPassword specifies password for account retrieval from the keystore. SwarmAccountPassword string ServerAddrs []string }
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.
type NodeInfo ¶
type NodeInfo struct {
// contains filtered or unexported fields
}
NodeInfo represents pi short summary of the information known about the host.
func (*NodeInfo) GetDiscoveryPort ¶
func (*NodeInfo) GetListenerAddress ¶
func (*NodeInfo) GetListenerPort ¶
func (*NodeInfo) GetProtocols ¶
type PeerInfo ¶
type PeerInfo struct {
// contains filtered or unexported fields
}
PeerInfo represents pi short summary of the information known about pi connected peer.
func (*PeerInfo) GetLocalAddress ¶
func (*PeerInfo) GetRemoteAddress ¶
type PeerInfos ¶
type PeerInfos struct {
// contains filtered or unexported fields
}
PeerInfos represents a slice of infos about remote peers.