ethers.Wallet not working on node v17,18
See original GitHub issueEthers Version
5.6.8
Search Terms
wallet, mnemonic, private key
Describe the Problem
Issue: Wallet intialization not working in Node v17.x.x or v18.x.x Code:
const ethers = require("ethers");
(async() => {
const pvKey = ethers.ethers.Wallet.createRandom().privateKey;
console.log(pvKey);
})();
It throws this error:
node:internal/crypto/hash:67
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at createHash (node:crypto:135:10)
at ripemd160 (/Users/vanxh/codes/bitpack/extension/node_modules/@ethersproject/sha2/lib/sha2.js:11:43)
at new HDNode (/Users/vanxh/codes/bitpack/extension/node_modules/@ethersproject/hdnode/lib/index.js:74:110)
at Function.HDNode._fromSeed (/Users/vanxh/codes/bitpack/extension/node_modules/@ethersproject/hdnode/lib/index.js:211:16)
at Function.HDNode.fromMnemonic (/Users/vanxh/codes/bitpack/extension/node_modules/@ethersproject/hdnode/lib/index.js:218:23)
at Function.Wallet.fromMnemonic (/Users/vanxh/codes/bitpack/extension/node_modules/@ethersproject/wallet/lib/index.js:235:43)
at /Users/vanxh/codes/bitpack/extension/z.js:7:41
at Object.<anonymous> (/Users/vanxh/codes/bitpack/extension/z.js:13:3)
at Module._compile (node:internal/modules/cjs/loader:1097:14) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Documentation - Ethers.js
Returns a Promise which will stall until the network has heen established, ignoring errors due to the target node not being active yet....
Read more >@ethersproject/wallet - npm
Classes for managing, encrypting and decrypting Ethereum private keys as a Signer for ethers.. Latest version: 5.7.0, last published: 4 ...
Read more >How to set private key for Ethers Signer
My question is: Where should I provide my private key? I mean - the provider requires me to give only a node url...
Read more >Wallets and Signers — ethers.js 4.0.0 documentation
A Wallet manages a private/public key pair which is used to cryptographically sign transactions and prove ownership on the Ethereum network.
Read more >How to connect to Ethereum network with ethers.js - QuickNode
1. When someone thinks of developing a dApp the first tool that comes to their mind is web3.js which is ... 2. First,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in v5.7.0.
Thanks! 😃
As a note for those that need a quick fix, the RIPEMD-160 was removed from the default crypto provider, you can re-enable it on the node command line using
--openssl-legacy-provider
.I’ll use the software implementation in
hash.js
starting inv5.7.0
so this won’t be necessary after that release.