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
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.