Create a private net for Ethereum
This tutorial is for you that had difficulty to create your private net for develop the smart contracts.
Download the geth and mist.
Geth: https://github.com/ethereum/go-ethereum/wiki/geth
Mist: https://github.com/ethereum/mist/releases
Configuration of the geth at .bash_profile
vi ~/.bash_profile#GETH ETHEREUMexport GETH_HOME=$HOME/Documents/ferramentas/geth-alltoolsexport PATH=$PATH:$GETH_HOMEsource ~/.bash_profile
Test your geth
GETH OK!!! But this is a public network.
Create the Genesis file:
{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000042",
"difficulty": "0x40000",
"alloc": {
"0x1b143A4D96bDf9AA599850e2bc687e4De28842B5": {
"balance": "10015200000000000000000"
}
},
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x4c4b40"
}
Inicialize the private net folder
geth --networkid 33333 --port 60303 --rpc --rpcport 8545 --rpccorsdomain "*" --rpcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --minerthreads 1 --datadir $HOME/Library/Ethereum/private init $HOME/Documents/projects/ethereum/CustomGenesis.json
Hey, here you can see the parameters description. https://github.com/ethereumproject/go-ethereum/wiki/Command-Line-Options
Start your private net
geth --datadir $HOME/Library/Ethereum/private
Now open another tab console and start the console of geth(i use 3 tabs of console)
geth attach $HOME/Library/Ethereum/private/geth.ipc

Now we are to create the etherbase for receive the ether of that mining.
the command personal.newAccount() create a new account

Note that account 0x5599bc293af32d7549416781b5fc695bc04023bb was created. Do you can to close the console using “exit”.
Copy the account created and set in etherbase parameter to start the geth(in another tab console or after close the geth console).
geth --networkid 33333 --port 60303 --rpc --rpcport 8545 --rpccorsdomain "*" --rpcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --maxpeers 0 --nodiscover --minerthreads 1 --lightkdf --cache 16 --datadir $HOME/Library/Ethereum/private --mine --etherbase "0x5599bc293af32d7549416781b5fc695bc04023bb"
Now you need to start the Mist using with the parameter the port of this private node, in this case is http://localhost:8545.
Go to new console and digit the address of the installation Mist and start the program with the parameter rpc http://localhost:8545.
/Applications/Ethereum\ Wallet.app/Contents/MacOS/Ethereum\ Wallet --rpc http://localhost:8545

The mist will to open using the PRIVATE-NET!
And do you have in your account the ether necessary to create your smart contracts transactions.
But maybe you want to create your private net without to create the file genesis_file.json manually. So for this you need to exec this commands:
geth --dev --ipcpath yourfile.ipc --datadir /directory_to_start_your_network
personal.newAccount("password")
miner.start()
In my case I did:
"START A GETH"
geth --datadir /Users/user/Documents/projetos/ethereum/networking/"WAITING TO CREATE THE IPC FILE""START THE GETH USING THE .IPC GETH CREATED"
geth --dev --ipcpath /Users/user/Documents/projetos/ethereum/networking/geth.ipc --datadir /Users/user/Documents/projetos/ethereum/networking/dev --mine --rpc --rpcport 8545 --rpccorsdomain "*" --rpcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" console"CREATE THE INITIAL ACCOUNT"
personal.newAccount()"START THE MINING"
miner.start()
That’s it, i hope this help you!
Bye.
Originally published at medium.com on August 18, 2017.