0

I have setup a private Ethereum node using the following configuration for the genesis block:

{
    "config": {
    "chainId": 143,
    "homesteadBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 0
    },
    "alloc": {},
    "difficulty" : "0x40000",
    "gasLimit"   : "0x8880000"
}

I am running the geth client with the following commands cmd args:

geth --port 3000 --networkid 44444 --nodiscover --datadir=./blkchain --maxpeers=0  --rpc --rpcport 8543 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,miner" --allow-insecure-unlock

Once it is running I attach the geth JS client using: geth attach http://127.0.0.1:8543

I have created an account and have unlocked it as well.

I am trying to deploy a very simple smart contract:

pragma solidity >=0.4.0;

contract UnrealContract {
    function test() public pure returns (uint16) {
        return 15;
    }
}

I have tried both from Remix IDE and using the web3js library and although the deployment seems to work fine (I'm getting back a contract address) when I call the test() method I get a response of 0x0 in Remix while in my Javascript code I get an error:

Returned error: gas required exceeds allowance (5000000) or always failing transaction

No matter the amount of gas and gasprice I set it always seems to return this error. Is this a problem with any of the versions of the software I'm using?

  • In Remix try changing the default EVM version in Solidity compiler settings. If that works you need to enable the more recent forks in your genesis file. – Ismael Nov 29 '19 at 14:23
  • Do your accounts that you are sending transactions from have enough eth / can you check their balance? You may want to pre-fund them in your genesis file. – Steven V Nov 29 '19 at 23:23
0

As @Ismael said, the problem seems to have been the fact that I was missing 3 forks:

  • petersburg
  • constantinople
  • byzantium

After adding these at block 0 it started working.

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.