Search code examples
javascriptsoliditytrufflequorum

How to fix " Error: Number can only safely store up to 53 bits" in my script?


I'm trying to create storage contract with Quorum 7nodes, but I have this problem: Error: Number can only safely store up to 53 bits

Javascript:

 await contract.methods.set(5).send({ from: accounts[0]});

contract in solidity:

pragma solidity ^0.5.0;

contract SimpleStorage {
  uint storedData;

  function set(uint x) public {
    storedData = x;
  }

  function get() public view returns (uint) {
    return storedData;
  }
}

versions:

Truffle v5.0.14 (core: 5.0.14)
Solidity v0.5.0 (solc-js)
Node v10.15.1
Web3js "^1.0.0-beta.52"

truffle config:

  nodefour: {
        host: "127.0.0.1",     // Localhost (default: none)
        port: 22003,            // Standard Ethereum port (default: none)
        network_id: 10,       // Any network (default: none)
        gasPrice: 0,
        gas: 4500000,
        type: "quorum" },

Solution

  • This error occurs because Raft stores the block timestamp in nanoseconds (instead of seconds), and Truffle is unable to handle this. A simple solution is to use Istanbul or Clique consensus instead.

    Alternatively, there is a thread here that describes how to set up a proxy to work around this: Quorum Ethereum Truffle) Error: Number can only safely store up to 53 bits