Web3.js: get error:"Number can only safely store up to 53 bits"when I used “web3.eth.getBlock()”

Created on 19 Sep 2018  ·  6Comments  ·  Source: ChainSafe/web3.js

 web3.eth.getBlockNumber().then(e => {
            blockNum = parseInt(e, 10)
             console.log(blockNum)//81642
            web3.eth.getBlock(blockNum)
                .then(e => console.log(e))
            })
>Error: Number can only safely store up to 53 bits

All 6 comments

Store it as a BigNumber ;)

Store it as a BigNumber ;)

Store what as a BigNumber ?? trying ti print the result from web3.eth.getBlock() is itself giving this error.

In many blogs I've found it was a Truffle version problem. Truffle v5 would make problems of this type. They suggest to downgrade to [email protected].

This has not been so for me. I have continue to use truffle v5. I've resolved by checking my gas limit when I sent a transaction.
gasLimit: web3.utils.toHex( gas_limit ),//The maximum gas provided for this transaction (gas limit)

Node: v8.11.4
Truffle: 5.0.12
Web3: 1.0.0-beta.52
Truffle-contract: 4.0.11
[email protected]
│ └── [email protected]
└── [email protected]
Ganache-cli: v6.4.3 (ganache-core: 2.5.5)
Ethereumjs-tx: 1.3.4

 web3.eth.getBlockNumber().then(e => {
            blockNum = parseInt(e, 10)
             console.log(blockNum)//81642
            web3.eth.getBlock(blockNum)
                .then(e => console.log(e))
            })
>Error: Number can only safely store up to 53 bits

How did you resolve this?

@macman18 Having the same issue and I am not using Truffle, just web3
Is there any good solution, yet?

+1 getting the same error when trying to get a block by the block number. BigNumber doesn't make a difference.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zamoore picture zamoore  ·  3Comments

xpepermint picture xpepermint  ·  3Comments

TinyWJL picture TinyWJL  ·  3Comments

SCBuergel picture SCBuergel  ·  3Comments

sundbry picture sundbry  ·  3Comments