4

I am running geth --syncmode "light"

When I attempt to communicate with a smart contract already deployed on the mainnet I do the following in the geth console:

>var Contract = eth.contract(abi)
>var myContract = Contract.at(address)

However, when I try to execute a function I get the following:

>myContrant.func.call(3,5)
Error: can't fetch trie key b3658ad28c17c69b3cd0fc2dfebbc66b9223d1c01ec56751ea9dd000cd79b061: no suitable peers available
    at web3.js:3143:20
    at web3.js:6347:15
    at web3.js:5081:36
    at web3.js:4102:22
    at <anonymous>:1:1

Also:

>myContract.func.sendTransaction(3, 5, {from: eth.accounts[1]})
Error: no suitable peers available
    at web3.js:3143:20
    at web3.js:6347:15
    at web3.js:5081:36
    at web3.js:4137:16
    at <anonymous>:1:1

Is this a problem of the lightnode and its communication with the peers?

How can this problem be solved?

2

For others running into Error: no suitable peers available, it is very likely that your geth instance just hasn't found a suitable peer yet if you're running in light mode. It took me about 15 minutes to find a full node that supported syncing with light clients.

Quoting from a related Github issue:

FYI I am running a few light servers at my own expense, and my nodes get saturated with light client peer connections. The "fix" here is more people in the community running nodes and enabling the light server (see here), please consider helping the cause and running a light server too 😄.

If you want to confirm, run add console to the end of your geth command and call admin.peers.

|improve this answer|||||
0

I was having the same issue. I am running Geth 1.7.3 with:

--testnet --syncmode="light" --datadir "C:\Ethereum\data_testnet"  --rpc --rpcapi db,eth,net,web3,personal --cache=1024 --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*

After launching a clean (existing data deleted) light sync from scratch, and waiting 40 minutes for the sync to be over I got this error when doing a eth.getBalance()

I stopped and restarted geth and it worked, but only temporary. I managed to do a eth.getTransactionCount() but the second call I had

Error: can't fetch trie key 

After lauching it again it seems to work. So I guess you need to keep trying and be patient

EDIT: Sorry I do get this error also when calling a function of a contract. Everything else seems to work (deploying, balance, registering events)

|improve this answer|||||

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.