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
According to the example in the documentation, function web3.eth.accounts.privateKeyToAccount expects private key to be passed to hexadecimal string prefixed with "0x". If private key is passed without "0x" prefix, the function silently returns incorrect result.
Expected behavior
Function web3.eth.accounts.privateKeyToAccount throws on incorrect private key format, and always returns correct result on correctly formatted private keys. Whether hexadecimal private key without "0x" prefix is correct or not is discussible.
Actual behavior
On hexadecimal private key without "0x" prefix function web3.eth.accounts.privateKeyToAccount silently returns incorrect result.
Steps to reproduce the behavior
Call function web3.eth.accounts.privateKeyToAccount with parameters 0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709 and 348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709 and compare the results.
Versions
web3.js: 1.0.0-beta.55
The text was updated successfully, but these errors were encountered:
@3sGgpQ8H@DalderupMaurice I had the same issue, it looks like the fix has already landed in the web3@2.0.0-alpha.1 pre-release (fixed in #2929) so this should be fixed in the next release.
@3sGgpQ8H@DalderupMaurice I had the same issue, it looks like the fix has already landed in the web3@2.0.0-alpha.1 pre-release (fixed in #2929) so this should be fixed in the next release.
Yes! I saw it was mentioned in the release notes afterward.
It should be an easy backport until the v2 goes live though
Description
According to the example in the documentation, function
web3.eth.accounts.privateKeyToAccount
expects private key to be passed to hexadecimal string prefixed with "0x". If private key is passed without "0x" prefix, the function silently returns incorrect result.Expected behavior
Function
web3.eth.accounts.privateKeyToAccount
throws on incorrect private key format, and always returns correct result on correctly formatted private keys. Whether hexadecimal private key without "0x" prefix is correct or not is discussible.Actual behavior
On hexadecimal private key without "0x" prefix function
web3.eth.accounts.privateKeyToAccount
silently returns incorrect result.Steps to reproduce the behavior
Call function
web3.eth.accounts.privateKeyToAccount
with parameters0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709
and348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709
and compare the results.Versions
The text was updated successfully, but these errors were encountered: