1

I started a new private network by geth command.

geth --networkid "198"  --nodiscover --datadir "~/test-geth" --rpc --rpcaddr "0.0.0.0" --rpcport "8545" --rpccorsdomain "*" --rpcvhosts "*" --rpcapi web3,eth,personal,miner,net,txpool,debug --unlock 0,1 --password /home/user/.gethpasswd --mine --minerthreads 1 --targetgaslimit 6721975 --gasprice "100000"

And deployed my token to this network. "truffle compile" & "truffle migrate" succeeded. But sendTransaction fails everytime…

I debugged with truffle debugger. Here is the result of “sendTransaction”.

MintedCrowdsale.sol:

24:   {
25:     // Potentially dangerous assumption about the type of the token.
26:     require(MintableToken(address(token)).mint(_beneficiary, _tokenAmount));
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

debug(development:0xb76ce508...)> i

Transaction halted with a RUNTIME ERROR.

This is likely due to an intentional halting expression, like assert(), require() or revert(). It can also be due to out-of-gas exceptions. Please inspect your transaction parameters and contract code to determine the meaning of this error.

I thought this error may be occurred by failure of "transferOwnership", but truffle debugger says "transferOwnership" succeeded.

And, strangely, no error occurs when using ganache-cli or Ropsten test net…

I get errors only on private network established by geth command.

Please tell me if anyone has advice on this issue.

0

Now I got a solution.

My genesis block setting was wrong.

This setting works fine for me.

{
  "config": {
    "chainId": 198,
    "HomesteadBlock":      0,
    "DAOForkBlock": 0,
    "DAOForkSupport":      true,
    "EIP150Block":         0,
    "EIP155Block":         0,
    "EIP158Block":         0,
    "ByzantiumBlock":      0
  },
  "nonce": "0x0000000000000042",
  "timestamp": "0x0",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "extraData": "",
  "gasLimit": "0x8000000",
  "difficulty": "0x4000",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x3333333333333333333333333333333333333333",
  "alloc": {}
}

And, in migrations/2_deploy_contracts.js

module.exports = function(deployer, network, accounts) {


    const wallet = accounts[0];

causes gaslimit error.

module.exports = function(deployer, network, accounts) {


    const wallet = "<your address>";

is OK.

| improve this answer | |

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.