Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save staccDOTsol/ff2ce4c548c3b726d5ecc81ca44ec929 to your computer and use it in GitHub Desktop.
Save staccDOTsol/ff2ce4c548c3b726d5ecc81ca44ec929 to your computer and use it in GitHub Desktop.
How To Create Your Own Ethereum Network

From: https://github.com/ethereum/go-ethereum/wiki/Installation-instructions-for-Windows

Compiling geth with tools from chocolatey

The Chocolatey package manager provides an easy way to get the required build tools installed. If you don't have chocolatey yet, follow the instructions on https://chocolatey.org to install it first.

Then open an Administrator command prompt and install the build tools we need:

C:\Windows\system32> choco install git
C:\Windows\system32> choco install golang
C:\Windows\system32> choco install mingw

Installing these packages will set up the Path environment variable. Open a new command prompt to get the new Path. The following steps don't need Administrator privileges.

Please ensure that the installed Go version is 1.7 (or any later version).

First we'll create and set up a Go workspace directory layout, then clone the source.

OBS If, during the commands below, you get the following message:

WARNING: The data being saved is truncated to 1024 characters. Then that means that the setx command will fail, and proceeding will truncate the Path/GOPATH. If this happens, it's better to abort, and try to make some more room in Path before trying again.

C:\Users\xxx> set "GOPATH=%USERPROFILE%"
C:\Users\xxx> set "Path=%USERPROFILE%\bin;%Path%"
C:\Users\xxx> setx GOPATH "%GOPATH%"
C:\Users\xxx> setx Path "%Path%"
C:\Users\xxx> mkdir src\github.com\ethereum
C:\Users\xxx> git clone https://github.com/ethereum/go-ethereum src\github.com\ethereum\go-ethereum
C:\Users\xxx> cd src\github.com\ethereum\go-ethereum
C:\Users\xxx> go get -u -v golang.org/x/net/context

Finally, the command to compile geth is:

C:\Users\xxx\src\github.com\ethereum\go-ethereum> go install -v ./cmd/...

Create a file genesis.json with like info:

{
"config": {
"chainId": 0,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc": {
"0x744f58fc697a8a0223f16e2ada5b4cb81be5c665": {"balance": "111111111"},
"0x0000000000000000000000000000000000000002": {"balance": "222222222"}
},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x1",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}

If you want an address that has balance, first run geth and create a new account, then copy the keystore file and delete the datadir.

Replace the address I have above in genesis.json with your new address, ie. something in place of 0x744f58fc697a8a0223f16e2ada5b4cb81be5c665.

Run:

geth --data-dir=ethereum --rpc init genesis.json

Next, ctrl+c to quit, then place your UTC keystore file inside the datadir/keystore

re-run geth:

geth --data-dir=ethereum --rpc

Now you'll have balance in that account.

geth attach
web3.fromWei(eth.getBalance(eth.coinbase), "ether")

Now you can mine on that account, set MetaMask or any other wallet to http://localhost:8545 and watch your balance after you import your keystore file!

geth attach
miner.start(1)

(wait for the first DAG to generate on geth)

That's it, that's all! Thanks for joining us!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment