I am using truffle-contract with a local quorum node and try to execute a smart contract method, but getting this error:

Error: Number can only safely store up to 53 bits

That's the way I do it:

const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider(''));

const ContractJSON = require('./build/contracts/MyContract.json');

//setting up for truffle-contract
var MyContract = truffleContract({
    abi: ContractJSON.abi,
    unlinked_binary: ContractJSON.bin,
    address: ContractJSON.address

var contract;
MyContract.deployed().then(instance => { 
    contract = instance;
        web3.utils.toHex('abc123'),       //bytes32
        Number(123));                     //uint256
.then(result => { console.log("RESULT " + result); })
.catch(err => { console.log("ERROR! " + err); });

The contract itself works and I can also interact with it using truffle console, but truffle-contract gives me the above mentioned error. What am I doing wrong?

  • 1
    Does it works if you use BigNumber from web3? ie web3.utils.toBN(123).
    – Ismael
    Jan 19 '19 at 16:26
  • No still the same error
    – sunwarri0r
    Jan 19 '19 at 17:06

It's a problem with the new Truffle version (using on Quorum).

truffle v5 and truffle-contract v4 don't work.

Using the latest v3 truffle-contract@3.0.7 solved this particular issue.

  • Truffle v5 seems to have a few issues still, especially with Quorum. We currently advise to use Truffle v4.1.x branch.
    – fixanoid
    Jan 20 '19 at 3:07

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

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.