I have a rpc enabled running private ethereum blockchain node with mining enabled. I have connected to it using metamask and have performed some contract interactions (deployment, calling functions,etc) using remix and it works fine. However when I try doing the same with truffle framework I am facing an error. I have referred to couple of different ways with the popular tutorials directed by google and followed the steps but I always land on this same error. So this is the code I use to start my node:

geth --datadir test --networkid 15 --rpc --rpcport "30308" --rpccorsdomain "*" --rpcaddr "" console

I have used a single account for every purpose (mining, deploying contracts and so on) to avoid confusions and the account has a ton of ethers(to avoid gas problems). At every point of operations the account is unlocked(to avoid locked account errors). This is my contract in the contracts folder of truffle: Hello.sol

pragma solidity ^0.5.8;

contract Hello {
   uint public message;
   constructor() public {
   message = 123456;

   function get() public view returns (uint) {
   return message;

   function set(uint inpStr) public{
   message = inpStr;

This is the migration file in the migrations folder of truffle: 2_deploy_contracts.js

const Hello = artifacts.require("Hello");

module.exports = function(deployer) {

After this I ran truffle compile which worked fine(no issues here). This is the truffle config file: truffle.js

module.exports = {
    rpc: {
            host: "localhost",
    networks: {
            development: {
                    host: "localhost",  //testing on the same vm
                    network_id: 15,
                    from: "0x56164f073d19fdd9e8a0041e2a3a9dc8c8*******",
                    gas: 2000000

I ran truffle migrate which worked fine and deployed my contracts(no issues here). After that I ran truffle console:

Hello.deployed().then(function(instance) { dApp = instance; })

Running dApp gives me all the information about my contract(looks legit). Now when I try:

dApp.message.call() or dApp.get()

It throws me this error:

Error: Returned values aren't valid, did it run Out of Gas? at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2-cookies/dist/xml-http-request.js:318:1) at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2-cookies/dist/xml-http-request.js:208:1) at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2-cookies/dist/xml-http-request-event-target.js:34:1) at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-providers-http/src/index.js:96:1) at /usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-provider/wrapper.js:112:1 at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3-core-requestmanager/src/index.js:147:1 at sendTxCallback (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-method/src/index.js:473:1) at Method.formatOutput (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-method/src/index.js:163:1) at Method.outputFormatter (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/src/index.js:818:1) at Contract._decodeMethodReturn (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/src/index.js:465:1) at ABICoder.decodeParameters (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth-abi/src/index.js:226:1)

when I perform:


It works fine and displays the transactions details. When it comes to the other fuctions which require the data to be displayed gives me the above error. What could be the culprit here?

  • try it on remix? – Majd TL Jul 3 '19 at 10:32
  • I have mentioned in the second sentence that it works fine on remix. – Ragas Gnuluk Jul 4 '19 at 5:14
  • okay sorry, i can test it again after the work, but why you arn't using Ganache? instead of Geth – Majd TL Jul 4 '19 at 7:20
  • your point? @MajdTL – Ragas Gnuluk Jul 5 '19 at 10:14

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.