I setup a local testnet using geth following these instructions. I was able to mine my initial Ether and all was working. After deploying some contracts I quickly spent all the Ether I had. Now it seems I'm unable to mine any more Ether. How do you continue to fund your account with Ether on a private testnet?
Aren't blocks processed every so often regardless of the number of transactions? That doesn't seem to be happening on my test node.
Updated: Here's the output when I manually start the miner (note, account is unlocked)
>miner.start();
I0128 15:22:16.501677 8525 backend.go:584] Automatic pregeneration of ethash DAG ON (ethash dir: /Users/testgeth/.ethash)
I0128 15:22:16.501789 8525 backend.go:591] checking DAG (ethash dir: /Users/testgeth/.ethash)
I0128 15:22:16.501843 8525 miner.go:119] Starting mining operation (CPU=8 TOT=10)
true
> I0128 15:22:16.503824 8525 worker.go:570] commit new work on block 48 with 0 txs & 0 uncles. Took 1.893754ms
I0128 15:22:16.503953 8525 ethash.go:220] Generating DAG for epoch 0 (size 1073739904) (0000000000000000000000000000000000000000000000000000000000000000)
I0128 15:22:17.432934 8525 ethash.go:237] Done generating DAG for epoch 0, it took 928.992201ms
UPDATE: What seems to work is to send a transaction. Once geth reached the stopping point I mention above, I sent a transaction and the normal block processing began.
Best Answer
If you are on a private net/chain you actually don't need to mine to get ethers, but just to confirm transactions.
You can fund your account(s) by specifying the amount in wei you want that account to start with, in your genesis json file:
Another thing you can do if you still want to mine to get ethers is lower the difficulty, again in the genesis block, a value of
"0x400"
or `"0x200" will let you mine faster the first blocks. If your geth is stuck and doesn't mine anymore (on osx I found it common when you put the computer in sleep), simply kill it with Crtl-C and restart it.To specify your genesis block you can pass these parameters to the geth command:
A sample genesis block is:
You can find a more complete guide here