You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 30, 2024. It is now read-only.
- Fixed installation errors for certain packaging tools, PR [#67](https://github.com/ethereumjs/ethereumjs-wallet/pull/67)
11
-
- Remove dependency on ``crypto.randomBytes`` and use ``randombytes`` package instead, PR [#63](https://github.com/ethereumjs/ethereumjs-wallet/pull/63)
12
-
- Add comprehensive test coverage for ``fromV3``, PR [#62](https://github.com/ethereumjs/ethereumjs-wallet/pull/62)
13
-
- Remove excess parameter from ``decipherBuffer`` usage, PR [#77](https://github.com/ethereumjs/ethereumjs-wallet/pull/77)
14
-
- Update dependencies, including a fixed ``scrypt.js``, which should resolve more installation issues, PR [#78](https://github.com/ethereumjs/ethereumjs-wallet/pull/78)
12
+
- Remove dependency on `crypto.randomBytes` and use `randombytes` package instead, PR [#63](https://github.com/ethereumjs/ethereumjs-wallet/pull/63)
13
+
- Add comprehensive test coverage for `fromV3`, PR [#62](https://github.com/ethereumjs/ethereumjs-wallet/pull/62)
14
+
- Remove excess parameter from `decipherBuffer` usage, PR [#77](https://github.com/ethereumjs/ethereumjs-wallet/pull/77)
15
+
- Update dependencies, including a fixed `scrypt.js`, which should resolve more installation issues, PR [#78](https://github.com/ethereumjs/ethereumjs-wallet/pull/78)
Copy file name to clipboardExpand all lines: README.md
+34-27Lines changed: 34 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,47 +8,50 @@
8
8
A lightweight wallet implementation. At the moment it supports key creation and conversion between various formats.
9
9
10
10
It is complemented by the following packages:
11
+
11
12
-[ethereumjs-tx](https://github.com/ethereumjs/ethereumjs-tx) to sign transactions
12
13
-[ethereumjs-icap](https://github.com/ethereumjs/ethereumjs-icap) to manipulate ICAP addresses
13
14
-[store.js](https://github.com/marcuswestin/store.js) to use browser storage
14
15
15
16
Motivations are:
17
+
16
18
- be lightweight
17
19
- work in a browser
18
20
- use a single, maintained version of crypto library (and that should be in line with `ethereumjs-util` and `ethereumjs-tx`)
19
21
- support import/export between various wallet formats
20
22
- support BIP32 HD keys
21
23
22
24
Features not supported:
25
+
23
26
- signing transactions
24
27
- managing storage (neither in node.js or the browser)
25
28
26
29
## Wallet API
27
30
28
31
Constructors:
29
32
30
-
*`generate([icap])` - create an instance based on a new random key (setting `icap` to true will generate an address suitable for the `ICAP Direct mode`)
31
-
*`generateVanityAddress(pattern)` - create an instance where the address is valid against the supplied pattern (**this will be very slow**)
32
-
*`fromPrivateKey(input)` - create an instance based on a raw private key
33
-
*`fromExtendedPrivateKey(input)` - create an instance based on a BIP32 extended private key (xprv)
34
-
*`fromPublicKey(input, [nonStrict])` - create an instance based on a public key (certain methods will not be available)
35
-
*`fromExtendedPublicKey(input)` - create an instance based on a BIP32 extended public key (xpub)
36
-
*`fromV1(input, password)` - import a wallet (Version 1 of the Ethereum wallet format)
37
-
*`fromV3(input, password, [nonStrict])` - import a wallet (Version 3 of the Ethereum wallet format). Set `nonStrict` true to accept files with mixed-caps.
38
-
*`fromEthSale(input, password)` - import an Ethereum Pre Sale wallet
33
+
-`generate([icap])` - create an instance based on a new random key (setting `icap` to true will generate an address suitable for the `ICAP Direct mode`)
34
+
-`generateVanityAddress(pattern)` - create an instance where the address is valid against the supplied pattern (**this will be very slow**)
35
+
-`fromPrivateKey(input)` - create an instance based on a raw private key
36
+
-`fromExtendedPrivateKey(input)` - create an instance based on a BIP32 extended private key (xprv)
37
+
-`fromPublicKey(input, [nonStrict])` - create an instance based on a public key (certain methods will not be available)
38
+
-`fromExtendedPublicKey(input)` - create an instance based on a BIP32 extended public key (xpub)
39
+
-`fromV1(input, password)` - import a wallet (Version 1 of the Ethereum wallet format)
40
+
-`fromV3(input, password, [nonStrict])` - import a wallet (Version 3 of the Ethereum wallet format). Set `nonStrict` true to accept files with mixed-caps.
41
+
-`fromEthSale(input, password)` - import an Ethereum Pre Sale wallet
39
42
40
43
For the V1, V3 and EthSale formats the input is a JSON serialized string. All these formats require a password.
41
44
42
45
Note: `fromPublicKey()` only accepts uncompressed Ethereum-style public keys, unless the `nonStrict` flag is set to true.
43
46
44
47
Instance methods:
45
48
46
-
*`getPrivateKey()` - return the private key
47
-
*`getPublicKey()` - return the public key
48
-
*`getAddress()` - return the address
49
-
*`getChecksumAddressString()` - return the [address with checksum](https://github.com/ethereum/EIPs/issues/55)
50
-
*`getV3Filename([timestamp])` - return the suggested filename for V3 keystores
51
-
*`toV3(password, [options])` - return the wallet as a JSON string (Version 3 of the Ethereum wallet format)
49
+
-`getPrivateKey()` - return the private key
50
+
-`getPublicKey()` - return the public key
51
+
-`getAddress()` - return the address
52
+
-`getChecksumAddressString()` - return the [address with checksum](https://github.com/ethereum/EIPs/issues/55)
53
+
-`getV3Filename([timestamp])` - return the suggested filename for V3 keystores
54
+
-`toV3(password, [options])` - return the wallet as a JSON string (Version 3 of the Ethereum wallet format)
52
55
53
56
All of the above instance methods return a Buffer or JSON. Use the `String` suffixed versions for a string output, such as `getPrivateKeyString()`.
54
57
@@ -62,10 +65,10 @@ Importing various third party wallets is possible through the `thirdparty` submo
62
65
63
66
Constructors:
64
67
65
-
*`fromEtherCamp(passphrase)` - import a brain wallet used by Ether.Camp
66
-
*`fromEtherWallet(input, password)` - import a wallet generated by EtherWallet
67
-
*`fromKryptoKit(seed)` - import a wallet from a KryptoKit seed
68
-
*`fromQuorumWallet(passphrase, userid)` - import a brain wallet used by Quorum Wallet
68
+
-`fromEtherCamp(passphrase)` - import a brain wallet used by Ether.Camp
69
+
-`fromEtherWallet(input, password)` - import a wallet generated by EtherWallet
70
+
-`fromKryptoKit(seed)` - import a wallet from a KryptoKit seed
71
+
-`fromQuorumWallet(passphrase, userid)` - import a brain wallet used by Quorum Wallet
69
72
70
73
## HD Wallet API
71
74
@@ -75,18 +78,18 @@ To use BIP32 HD wallets, first include the `hdkey` submodule:
75
78
76
79
Constructors:
77
80
78
-
*`fromMasterSeed(seed)` - create an instance based on a seed
79
-
*`fromExtendedKey(key)` - create an instance based on a BIP32 extended private or public key
81
+
-`fromMasterSeed(seed)` - create an instance based on a seed
82
+
-`fromExtendedKey(key)` - create an instance based on a BIP32 extended private or public key
80
83
81
-
For the seed we suggest to use [bip39](https://npmjs.org/package/bip39) to create one from a BIP39 mnemonic.
84
+
For the seed we suggest to use [bip39](https://npmjs.org/package/bip39) to create one from a BIP39 mnemonic.
82
85
83
86
Instance methods:
84
87
85
-
*`privateExtendedKey()` - return a BIP32 extended private key (xprv)
86
-
*`publicExtendedKey()` - return a BIP32 extended public key (xpub)
87
-
*`derivePath(path)` - derive a node based on a path (e.g. m/44'/0'/0/1)
88
-
*`deriveChild(index)` - derive a node based on a child index
89
-
*`getWallet()` - return a `Wallet` instance as seen above
88
+
-`privateExtendedKey()` - return a BIP32 extended private key (xprv)
89
+
-`publicExtendedKey()` - return a BIP32 extended public key (xpub)
90
+
-`derivePath(path)` - derive a node based on a path (e.g. m/44'/0'/0/1)
91
+
-`deriveChild(index)` - derive a node based on a child index
92
+
-`getWallet()` - return a `Wallet` instance as seen above
90
93
91
94
## Provider Engine
92
95
@@ -103,6 +106,7 @@ Note it only supports the basic wallet. With a HD Wallet, call `getWallet()` fir
103
106
### Remarks about `toV3`
104
107
105
108
The `options` is an optional object hash, where all the serialization parameters can be fine tuned:
109
+
106
110
- uuid - UUID. One is randomly generated.
107
111
- salt - Random salt for the `kdf`. Size must match the requirements of the KDF (key derivation function). Random number generated via `crypto.getRandomBytes` if nothing is supplied.
108
112
- iv - Initialization vector for the `cipher`. Size must match the requirements of the cipher. Random number generated via `crypto.getRandomBytes` if nothing is supplied.
@@ -113,15 +117,18 @@ The `options` is an optional object hash, where all the serialization parameters
113
117
Depending on the `kdf` selected, the following options are available too.
114
118
115
119
For `pbkdf2`:
120
+
116
121
-`c` - Number of iterations. Defaults to 262144.
117
122
-`prf` - The only supported (and default) value is `hmac-sha256`. So no point changing it.
118
123
119
124
For `scrypt`:
125
+
120
126
-`n` - Iteration count. Defaults to 262144.
121
127
-`r` - Block size for the underlying hash. Defaults to 8.
122
128
-`p` - Parallelization factor. Defaults to 1.
123
129
124
130
The following settings are favoured by the Go Ethereum implementation and we default to the same:
0 commit comments