This is my smart contract:

pragma solidity ^0.4.24;
contract Greet
  string message;
  constructor() public{
        message="I'm ready!";
function setgreetings(string _message)public
function getgreetings()public view returns(string){
       return message;

I deployed my Greetings smart contract to my private network.

  var myABI = [{"...."}]
  var myCont = eth.contract(myABI)
  var myCode = "0x..."
  var txDeploy = {from: 'account_address', data: myCode, gas:210000}

// unlock the account to send the transaction

   var app = myCont.new(txDeploy)

// mined the block // got the address of the deployed contract Now using remix to call getgreetings function. It should return "I'm ready". But it is blank: enter image description here

Contract works fine when I use JVM.


Embedded JS EVM in Remix is synchronous in nature and will return immediately with the return value. Real node software is asynchronous and you will synchronously only get the transaction hash. Later, when the transaction is included, you'll get the transaction receipt. However, the receipt itself has only a status field (0: failed, 1: success). There is no field for the return value.

See "why are return values only True or False" how to navigate around this.

| improve this answer | |
  • I am deploying my contract in my private network using remix IDE and now its working fine. But I deploy it from geth console it's not working. – crypto S. Oct 8 '18 at 6:14
  • If you’re sending a transaction from geth’s console, the only thing you get in return is the tx receipt. And it has no field for a return value as you’re expecting. – ivicaa Oct 8 '18 at 6:21

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.