Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ethers.Wallet not working on node v17,18 #3082

Closed
vanxh opened this issue Jun 14, 2022 · 5 comments
Closed

ethers.Wallet not working on node v17,18 #3082

vanxh opened this issue Jun 14, 2022 · 5 comments
Assignees
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@vanxh
Copy link

vanxh commented Jun 14, 2022

Ethers 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'
}
@vanxh vanxh added the investigate Under investigation and may be a bug. label Jun 14, 2022
PierreJeanjacquot added a commit to iExecBlockchainComputing/iexec-sdk that referenced this issue Jun 16, 2022
@ricmoo ricmoo added the on-deck This Enhancement or Bug is currently being worked on. label Jun 17, 2022
@0xged
Copy link

0xged commented Jul 11, 2022

@alcuadrado already reported!

@alcuadrado
Copy link

Hey @ricmoo,

I think this will become increasingly more common now that Hardhat supports Node 18.

We had some instances of this issue internally and fixed it by upgrading to the latest ethereum-cryptography. I know that may not be something you are looking to do, but maybe @noble/hashes?

@ricmoo ricmoo added bug Verified to be an issue. and removed investigate Under investigation and may be a bug. labels Jul 14, 2022
@ricmoo
Copy link
Member

ricmoo commented Jul 14, 2022

FYI: confirmed this issue. Working on it now.

@ricmoo
Copy link
Member

ricmoo commented Jul 14, 2022

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 in v5.7.0 so this won't be necessary after that release.

ricmoo added a commit that referenced this issue Jul 14, 2022
@ricmoo ricmoo added the fixed/complete This Bug is fixed or Enhancement is complete and published. label Jul 14, 2022
@ricmoo
Copy link
Member

ricmoo commented Aug 19, 2022

Fixed in v5.7.0.

Thanks! :)

@ricmoo ricmoo closed this as completed Aug 19, 2022
@ricmoo ricmoo removed the on-deck This Enhancement or Bug is currently being worked on. label Feb 23, 2023
Woodpile37 pushed a commit to Woodpile37/ethers.js that referenced this issue Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

No branches or pull requests

4 participants