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

parse $PRIVATE_KEY as type uint256: digit 10 is out of range for base 10 #6070

Closed
2 tasks done
billchen-818 opened this issue Oct 20, 2023 · 4 comments · Fixed by #6269
Closed
2 tasks done

parse $PRIVATE_KEY as type uint256: digit 10 is out of range for base 10 #6070

billchen-818 opened this issue Oct 20, 2023 · 4 comments · Fixed by #6269
Labels
T-bug Type: bug

Comments

@billchen-818
Copy link

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (619f3c5 2023-10-20T00:17:29.281153000Z)

What command(s) is the bug in?

forge script script/Counter.s.sol:CounterScript

Operating System

macOS (Apple Silicon)

Describe the bug

I use a script to deploy the contract and write the deployer's private key (a hexadecimal string, 64 bits in length) in the .env environment variable.When executing the script, reade the PRIVATE_KEY and converte it to uint256,
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");

An error will be reported,
Failed to parse $PRIVATE_KEY as typeuint256: digit 10 is out of range for base 10

@billchen-818 billchen-818 added the T-bug Type: bug label Oct 20, 2023
@billchen-818
Copy link
Author

I understand, the private key needs to be prefixed with '0x'.

@billchen-818
Copy link
Author

This is not a bug, the private key needs to be prefixed with '0x'

@mattsse
Copy link
Member

mattsse commented Oct 20, 2023

we'll add a fallback for 0x again shortly and improve error message, #6041

but it's recommended to use 0x prefix if it's hex

@Chinwuba22
Copy link

This is not a bug, the private key needs to be prefixed with '0x'

thanks this helped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
3 participants