0
votes

I'm new on Ethereum blockchain and I'm working on deploy and using smart contracts using truffle on my private blockchain.

I have followed exactly this guide https://www.trufflesuite.com/docs/truffle/getting-started/interacting-with-your-contracts

But every time i call getBalance() function

   -> truffle(develop)> let balance = await instance.getBalance(accounts[0])
   -> truffle(develop)> balance.toNumber()

I get the error: Returned values are not valid, did it run Out of Gas

So I added a simple smart contract getNumber() then return a simply integer (3) and I always get the same error.

But if I invoke sendCoin() function I don't get any error and I write correctly the transaction.

So I get the error any time I try to get values from the blockchain.

Someone can help me?

1
did you try just balance. get function did not consume gas. gas is used when we add new data to block chain.Block Crasher
Are using Ganache? What is your version?Zulhilmi Zainudin

1 Answers

1
votes

Chances are you did not deploy your contract properly. Interacting with a not exist or wrong contract could lead to that error message.

In truffle develop, try migrate command to compile and deploy your contracts and then see if it can work.