Reputation: 677
I am trying to deploy smart contract in the private network using Ethereum Wallet client (mist) . Although i have enough funds the application complains me that i have insufficient funds for * gas price+value.
smart contract code:
pragma solidity ^0.4.18;
contract HelloWorld {
uint256 counter = 0;
/* Constructor */
function Increase() public {
counter++;
}
function Decrease() public {
counter--;
}
function GetCounter() public constant returns(uint256){
return counter;
}
}
** genesis.json **
{
"config": {
"chainId": 0,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000041",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}
Geth command:
geth --datadir=./chaindata
Note: I am new to the ethereum block chain development so trying to get hands on experience by creating a private net
Upvotes: 0
Views: 115
Reputation: 10991
There's a few issues...
You mention that your account has funds. How did you add ether to your accounts on the private blockchain? There is no indication of funds being initialized in the genesis.json config. You should have something like this:
{
...
"alloc": {
"ACCOUNT_ADDRESS": {
"balance": "30000000000000000000000000000"
}
}
}
This will seed your account with 300 ether. You'll need to create an account on the private blockchain first and use that in the config file.
Second, you're setting the network id to 0 in genesis.json. Choose a different id.
Third, as mentioned in my comment, your not connecting to your private network. You need to add the --networkid
option when starting geth, passing in the network id you set in genesis.json. When starting geth, you should see something like this in your output:
INFO [01-11|14:21:03] Initialising Ethereum protocol
versions="[63 62]" network=1
With the network id being whatever you set in genesis.json. If you see network=1
, you're connecting to the main network.
If you're just starting out with Solidity, you may want to consider not creating a private blockchain just yet. You can use Remix for a fully sandboxed development environment, or use the Ropsten test network.
Upvotes: 0