I keep getting an error deploying a smart contract (using netheruem). The error is: insufficient funds for gas * price + value with geth command:
geth --dev --rpc --rpcport "8545" --rpcapi="db,eth,net,web3,personal,web3" console
I read that I need to adjust the gas limit in my genesis.json file but I have done this step before I init the geth. Here is my genesis.json file:
{
"config":{
"chainId": 45,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 12
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" :
"0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" :
"0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}
My gas limit in my latest block is 6283185 which should be enough to deploy the smart contract. Is there something I need to check with the configuration?
Thanks
You need to either supply funds to your account that is executing the transactions, or allow for 0 gas price transactions.
To fund an account, add the allocation to your genesis.json when creating the initial block:
{
...
"alloc": {
"ACCOUNT_ADDRESS": {
"balance": "9999999999999999999999999"
}
}
}
Create the account through geth
then use that address in the configuration. The value is in Wei.
In lieu of using funds, you can use a gas price set to 0, but you’ll have to start your miner(s) with the —gasPrice
set to 0 (otherwise, your miners will ignore your transactions). Even if you use 0 gas prices, you still have gas limit constraints.