0

I am discovering the blockchain world step by step, but I am facing a problem that I can't solve.

I am using this simple smart contract from the Solidity documentation:

pragma solidity >=0.4.0 <0.7.0;

contract SimpleStorage {
    uint storedData;

    function set(uint x) public {
        storedData = x;
    }

    function get() public view returns (uint) {
        return storedData;
    }
}

I compile the code with Remix, and when I deploy it on JavascriptVM, everything works fine, I can change the stored value.

However, when I deploy it on a private geth node (using web3deploy), the contract is successfully mined but when I try to use the set() function storage.set(4,{from:eth.accounts[0]}) it always returns "gas required exceeds allowance or always failing transaction", even if the account has sufficient funds.

I feel that I am missing something important but I can't figure it out. Someone help would be appreciated! thks!

Jasperan
  • 2,154
  • 1
  • 16
  • 40
Matt
  • 1
  • 1
  • I have solved the problem. I have updated geth, and added "byzantiumBlock": 0, "constantinopleBlock":0, "petersburgBlock": 0 in the genesis file of my private network. I am not sure to understand the reason of the problem, but it works fine now. – Matt Feb 11 '20 at 10:02
  • Can you provide us your genesis.json used for your private geth ? – Noé Feb 20 '20 at 15:09
  • Here is the genesis file that I now use for my private blockchain, and works for the deployment of smart contracts: { "config": { "chainId": 23052019, "homesteadBlock": 0, "eip150Block": 0, "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock":0, "petersburgBlock": 0 }, "alloc": {}, "difficulty" : "0x4", "gasLimit" : "0x8880000" } – Matt Feb 24 '20 at 08:51
  • To interact with your smartcontract you may want web3 to know your contract address. Can you please show us your code used before web3 calling storage.set – Noé Feb 27 '20 at 11:46

0 Answers0