0

I am using geth console to interact with the smart contract. I have followed the following link to deploy the smart contract. https://medium.com/@gus_tavo_guim/deploying-a-smart-contract-the-hard-way-8aae778d4f2a I am able to deploy the contract but "storage.get.call()" is always returning 0. The solidity version used in the link is 0.4.10. But I have used solidity version 0.5.11. And I have made changes in smart contract accordingly. Is the solidity version causing problem? What may be the issue?

1 Answer 1

3

Yes the syntax of 0.5.11 is completely different to 0.4.10

I for my part still use 0.4.10 for my contracts (although I shouldn't).

I fixed the contract for you.

pragma solidity ^0.5.11;
contract Storage {
  uint256 storedData;
  function set(uint256 data) public {
    storedData = data;
  }
  function get() public view returns (uint256) {
    return storedData;
  }
}

Use of constant is outdated now. Replace with view.

Furthermore, you need to set the visibility of the functions with public.

Deploy this new contract. Keep in mind to also get the new ABI. Then it should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.