I get the following error when passing (new BigNumber('2')).exponentiatedBy(100) big number value as uint256

Error: invalid BigNumber string value (arg="value", value="1.267650600228229401496703205376e+30", version=4.0.28)

I am using Truffle, but seems like a web3 issue? I'm not sure. Anyone seen this before. Wouldn't a valid uint256 go up to 2^255 ?


I'm not sure what BigNumber version you have installed as part of your project.

But Truffle exposes a global Web3 instance called web3, which exposes big-number functionality.


  • If you're using Truffle v4.x, then you may as well do web3.toBigNumber(2).pow(100).
  • If you're using Truffle v5.x, then you may as well do web3.utils.toBN(2).pow(100).
| improve this answer | |
  • Thanks let me try that – pizzarob Sep 9 '19 at 2:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.