1

I have the following code (in clojure):

212 (def CGP
213   (reify ContractGasProvider
214     (getGasPrice [_ contract-func] (BigInteger. "1"))
215     (getGasLimit [_ contract-func] (BigInteger. "10000000000000000"))))
216 
217 (.send
218   (Creation/deploy
219     web3j 
220     (Credentials/create
221       ;;"0xa335d4e1d18d9491454c05cff8b41261944c745b3f21b5cba557db46aef3ffb3"
222       ;;"0x4bF309Fd8e0206e2f7396bB52cfb4019195aEE41")
223       "9023c589167652b2182da32c2352c25c88cc1032f725b40e9a02e9f4162e1cc2")
224       ;;"0xB00d16842187bF6f5e8312C94AF192f14a199489")
225     CGP
226     "0x77aBe2770497a8FfC205aFD743292B1Db05B6b5D"
227     "creation-1"
228     "creator-1"
229     (BigInteger. "1626885270000")))

But running the second form gives me the following error:

Execution error at org.web3j.tx.TransactionManager/processResponse (TransactionManager.java:176).
Error processing transaction request: Number can only safely store up to 53 bits
Clojure: class java.lang.RuntimeException

and

{"id":55,"jsonrpc":"2.0","error":{"message":"Number can only safely store up to 53 bits","code":-32000,"data":{"stack":"Error: Number can only safely store up to 53 bits\n    at assert (/usr/local/lib/node_modules/ganache-cli/node_modules/bn.js/lib/bn.js:6:21)\n    at BN.toNumber (/usr/local/lib/node_modules/ganache-cli/node_modules/bn.js/lib/bn.js:506:7)\n    at Object.t.bufferToInt (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:4:143494)\n    at Object.number (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:4:58524)\n    at S._queueTransaction (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:212014)\n    at S.queueRawTransaction (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:210574)\n    at p.eth_sendRawTransaction (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:200119)\n    at p.handleRequest (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:196970)\n    at t (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:65024)\n    at a.handleRequest (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:195252)\n    at t (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:65024)\n    at f.s.handleRequest (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:178304)\n    at f.handleRequest (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:176115)\n    at t (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:65024)\n    at o.handleRequest (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:184369)\n    at t (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:65024)","name":"Error"}}} 

Why is this happening and how to fix this?

In java this could be written as:

Creation.deploy(web3j, Credentials.create("9023c589167652b2182da32c2352c25c88cc1032f725b40e9a02e9f4162e1cc2"),
 CGP, "0x77aBe2770497a8FfC205aFD743292B1Db05B6b5D", "creation-1", "creator-1", 
 new BigInteger("1626885270000"));

My blockchain is running on ganache-cli. How to fix this?

2
  • I have solved this error before in Javascript. but here I am not able to understand this code in clojure. Jul 22, 2021 at 12:33
  • From the json-rpc response it seems the error is in ganache-cli code. What ganache version are you using? Can you try another ganache version? also sometime I had problems with the node version being too old or too recent.
    – Ismael
    Jul 23, 2021 at 15:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.