This tutorial is part of a series of blog posts on getting a web page on your web server to communicate via web3 with your Ethereum test network on localhost.
In our previous post, we created the first block in our testnet using a CustomGenesis.json. In the CustomGenesis.json, we set the difficulty attribute to a very low value, which will enable us to mine some Ether on our testnet quickly.
In this tutorial, we’ll describe how to mine for Ether on your testnet.
In your Terminal, run the following command to create a new account on your testnet. All of the arguments should look familiar. Pay special attention to the account new, which will create a new user.
Joels-MBP-4:Clients joelgarcia$ geth --networkid 200 --identity node1 --verbosity 3 --nodiscover --nat none --datadir=~/myBlockChain/node1 account new
After you enter the password for this new user, you’ll be provided with the unique id for your new user. Copy and paste the address to a safe place.
You should also be able to see this user in your file system by opening up Finder to your myBlockChain directory.
Next, we’re going to start up geth. We’re going to start up geth to enable RPC so that Mist and our web pages in the future can access geth.
geth --networkid 200 --identity node1 --datadir=~/myBlockChain/node1 --rpc --rpcaddr "127.0.0.1" --rpcport "8545" --rpccorsdomain "*"
Most of the parameters should look familiar. We’ve added arguments to enable RPC to enable remote procedure calls to 127.0.0.1, localhost, over port 8545, for all domains. You would not want to run this for a production environment as you’re enabling any domain to access via RPC.
In the subsequent results, you should see that the testnet has started. Make note of your IPC endpoint in the second to last line as we’ll use it next.