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

Clarify that 0x prefix is needed for imported private keys #3422

Merged
merged 1 commit into from
Mar 20, 2020

Conversation

miohtama
Copy link
Contributor

Description

Purely documentation update.

I run an issue that web3.eth.accounts.privateKeyToAccount private key format was behaving differently from other Ethereum packages

  • truffle-hd-wallet

  • ethereumjs-wallet

This may lead to a problem that users are freaking out and think they lost their account when dealing with raw private keys.

web3.js generated different accounts from the other packages because private key was handled differently. This was because of the disagreement if hexadecimal private keys should be prefixed with 0x or not.

I clarified this in the documentation and also added a pointer about creating a HD wallet.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have selected the correct base branch. (Hopefully docs are still being updated for 1.x)
  • I have made corresponding changes to the documentation.

I run an issue that `web3.eth.accounts.privateKeyToAccount` private key format was behaving differently from other Ethereum packages

* truffle-hd-wallet

* ethereumjs-wallet

This may lead to a problem that users are freaking out and think they lost their account when dealing with raw private keys.

web3.js generated different accounts from the other packages because private key was handled differently.
This was because of the disagreement if hexadecimal private keys should be prefixed with `0x` or not.
I clarified this in the documentation and also added a pointer about creating a HD wallet.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.047% when pulling 8de0d3e on miohtama:patch-2 into a6ddec5 on ethereum:1.x.

Copy link
Collaborator

@cgewecke cgewecke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @miohtama, this looks good and makes things clearer.

For context, changes made in #3316 and #3323 will enforce the 0x prefix by default. They're scheduled to be published with 1.2.7.

@cgewecke cgewecke added 1.x 1.0 related issues Documentation Relates to project wiki or documentation Review Needed Maintainer(s) need to review labels Mar 18, 2020
Copy link
Collaborator

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@holgerd77 holgerd77 merged commit a25ba79 into web3:1.x Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Documentation Relates to project wiki or documentation Review Needed Maintainer(s) need to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants