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

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

Closed
camusfsx opened this issue Sep 19, 2018 · 8 comments

Comments

@camusfsx
Copy link

 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
@Moejoe90
Copy link

Store it as a BigNumber ;)

@rahuldamodar94
Copy link

Store it as a BigNumber ;)

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

@ghost
Copy link

ghost commented May 21, 2019

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 truffle@4.1.15.

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
Truffle-interface-adapter@0.1.2
│ └── web3@1.0.0-beta.37
└── web3@1.0.0-beta.37
Ganache-cli: v6.4.3 (ganache-core: 2.5.5)
Ethereumjs-tx: 1.3.4

@ymonye
Copy link
Contributor

ymonye commented Oct 20, 2019

 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?

@Xychun
Copy link

Xychun commented Nov 4, 2019

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

@MaxXor
Copy link

MaxXor commented May 10, 2020

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

@khaschuluu
Copy link

+1
I think web3 is trying to parse response JSON, but it's include big number that my javascript can't handle.

@lucaspiressimao
Copy link

this is similar to this one #3936 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants