0

I have a private blockchain where I am able to deploy my smart contracts successfully and then I am getting the address of my smart contract which I am storing on my relational db. In geth console when I am trying to access contract method using following code

deployedContract = eth.contract(smart_contract_abi).at(contract_address)

deployedContract.myMethod()

It's working fine and giving me expected output/result

But after few days when I am trying to access method of contract on those addresses then I am getting this error:

Error: new BigNumber() not a base 16 number: 
    at L (bignumber.js:3:2876)
    at bignumber.js:3:8435
    at a (bignumber.js:3:389)
    at web3.js:1110:23
    at web3.js:1634:20
    at web3.js:826:16
    at map (<native code>)
    at web3.js:825:12
    at web3.js:4080:18

What would be the reason of this error?

3
  • How are you running the node? – fixanoid Feb 22 '20 at 5:11
  • @fixanoid I am using geth client to run my private blockchain using following command: geth --datadir ~/eth-dev/ --networkid 45639 --verbosity 3 --rpc --port 30303 --rpcport 8545 --rpcaddr “<private IP>” --rpccorsdomain "http://<private ip>:8080, http://<private ip>:8000" --rpcapi "web3,eth,personal,net" --preload "mineWhenNeeded.js" --nodiscover --allow-insecure-unlock console 2 – Ruchita Feb 24 '20 at 7:44
  • 1
    Right, so in plain vanilla geth, you should enable --gcmode archive – fixanoid Feb 25 '20 at 16:21
1

Tracing and pruning: By default, state for the last 128 blocks kept in memory.

https://github.com/ethereum/go-ethereum/wiki/Tracing:-Introduction

The block number is mandatory and defines the context (state) against which the specified transaction should be executed. It is not possible to execute calls against reforged blocks, or blocks older than 128 (unless the node is an archive node).

https://geth.ethereum.org/docs/rpc/ns-eth

By default, Geth enables the garbage collection to keep in memory only the latest 128 blocks, I bet you certainly deployed your contract before these 128 blocks were mined.

The solution is to use --gcmode archive, it disables the garbage collection and keep all the historical state data since the Genesis.

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.