Documentation ¶
Overview ¶
Copyright 2017 The go-ethereum Authors This file is part of the go-ethereum library.
The go-ethereum library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The go-ethereum library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
- Copyright (C) 2019 Zilliqa *
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. *
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
Index ¶
- Variables
- func ToFile(privateKey, passphrase string, t crypto.KDFType) (string, error)
- type Account
- type BatchSendingResult
- type DerivationPath
- type Wallet
- func (w *Wallet) AddByKeyStore(keystore, passphrase string)
- func (w *Wallet) AddByPrivateKey(privateKey string)
- func (w *Wallet) CreateAccount()
- func (w *Wallet) SendBatch(signedTransactions []*transaction.Transaction, provider provider.Provider) []BatchSendingResult
- func (w *Wallet) SendBatchAsync(signedTransactions []*transaction.Transaction, provider provider.Provider, ...) []BatchSendingResult
- func (w *Wallet) SendBatchOneGo(signedTransactions []*transaction.Transaction, p provider.Provider) ([]BatchSendingResult, error)
- func (w *Wallet) SetDefault(address string)
- func (w *Wallet) Sign(tx *transaction.Transaction, provider provider.Provider) error
- func (w *Wallet) SignBatch(transactions []*transaction.Transaction, provider provider.Provider) error
- func (w Wallet) SignBatchWithNonce(transactions []*transaction.Transaction, provider provider.Provider, ...) error
- func (w *Wallet) SignWith(tx *transaction.Transaction, signer string, provider provider.Provider) error
Constants ¶
This section is empty.
Variables ¶
var DefaultBaseDerivationPath = DerivationPath{0x80000000 + 44, 0x80000000 + 60, 0x80000000 + 0, 0, 0}
DefaultBaseDerivationPath is the base path from which custom derivation endpoints are incremented. As such, the first account will be at m/44'/60'/0'/0/0, the second at m/44'/60'/0'/0/1, etc.
var DefaultRootDerivationPath = DerivationPath{0x80000000 + 44, 0x80000000 + 60, 0x80000000 + 0, 0}
DefaultRootDerivationPath is the root path to which custom derivation endpoints are appended. As such, the first account will be at m/44'/60'/0'/0, the second at m/44'/60'/0'/1, etc.
var LegacyLedgerBaseDerivationPath = DerivationPath{0x80000000 + 44, 0x80000000 + 60, 0x80000000 + 0, 0}
LegacyLedgerBaseDerivationPath is the legacy base path from which custom derivation endpoints are incremented. As such, the first account will be at m/44'/60'/0'/0, the second at m/44'/60'/0'/1, etc.
Functions ¶
Types ¶
type BatchSendingResult ¶ added in v1.1.0
type BatchSendingResult struct { Index int Hash string ErrMsg string Transaction *transaction.Transaction }
type DerivationPath ¶
type DerivationPath []uint32
DerivationPath represents the computer friendly version of a hierarchical deterministic wallet account derivaion path.
The BIP-32 spec https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki defines derivation paths to be of the form:
m / purpose' / coin_type' / account' / change / address_index
The BIP-44 spec https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki defines that the `purpose` be 44' (or 0x8000002C) for crypto currencies, and SLIP-44 https://github.com/satoshilabs/slips/blob/master/slip-0044.md assigns the `coin_type` 60' (or 0x8000003C) to Ethereum.
The root path for Ethereum is m/44'/60'/0'/0 according to the specification from https://github.com/ethereum/EIPs/issues/84, albeit it's not set in stone yet whether accounts should increment the last component or the children of that. We will go with the simpler approach of incrementing the last component.
func ParseDerivationPath ¶
func ParseDerivationPath(path string) (DerivationPath, error)
ParseDerivationPath converts a user specified derivation path string to the internal binary representation.
Full derivation paths need to start with the `m/` prefix, relative derivation paths (which will get appended to the default root path) must not have prefixes in front of the first element. Whitespace is ignored.
func (DerivationPath) MarshalJSON ¶
func (path DerivationPath) MarshalJSON() ([]byte, error)
MarshalJSON turns a derivation path into its json-serialized string
func (DerivationPath) String ¶
func (path DerivationPath) String() string
String implements the stringer interface, converting a binary derivation path to its canonical representation.
func (*DerivationPath) UnmarshalJSON ¶
func (path *DerivationPath) UnmarshalJSON(b []byte) error
UnmarshalJSON a json-serialized string back into a derivation path
type Wallet ¶
func (*Wallet) AddByKeyStore ¶
func (*Wallet) AddByPrivateKey ¶
func (*Wallet) CreateAccount ¶
func (w *Wallet) CreateAccount()
func (*Wallet) SendBatch ¶ added in v1.1.0
func (w *Wallet) SendBatch(signedTransactions []*transaction.Transaction, provider provider.Provider) []BatchSendingResult
Send transactions sequentially
func (*Wallet) SendBatchAsync ¶ added in v1.1.0
func (w *Wallet) SendBatchAsync(signedTransactions []*transaction.Transaction, provider provider.Provider, batchNum int) []BatchSendingResult
Send transactions using golang WaitGroup
func (*Wallet) SendBatchOneGo ¶ added in v1.1.0
func (w *Wallet) SendBatchOneGo(signedTransactions []*transaction.Transaction, p provider.Provider) ([]BatchSendingResult, error)
Send transactions using JSON-RPC batch request https://www.jsonrpc.org/specification#batch
func (*Wallet) SetDefault ¶
func (*Wallet) Sign ¶
func (w *Wallet) Sign(tx *transaction.Transaction, provider provider.Provider) error
func (*Wallet) SignBatch ¶ added in v1.1.0
func (w *Wallet) SignBatch(transactions []*transaction.Transaction, provider provider.Provider) error
func (Wallet) SignBatchWithNonce ¶ added in v1.1.0
func (w Wallet) SignBatchWithNonce(transactions []*transaction.Transaction, provider provider.Provider, nonce int64) error
func (*Wallet) SignWith ¶
func (w *Wallet) SignWith(tx *transaction.Transaction, signer string, provider provider.Provider) error