The recent block chain technology is very hot, Ethernet square is the block chain Technology 2.0 applications, with its intelligent contract function to the block chain increased infinite possibility, today, how to start from scratch to build the ether square.
(This article development environment is mac/linux, Ether Square client is go-ethereum, abbreviation Geth)
To install the GO environment before installing Geth, click to download
Install Geth with homebrew in Mac:
Brew tap Ethereum/ethereum
Brew Install Ethereum
Or clone under the GitHub source code, and then directly make
git clone https://github.com/ethereum/go-ethereum
CD Go-ethereum make
Geth
Add environment variables and check to see if the installation is successful
Geth version
environment installed, start building block chain
Create a new folder that stores your block-chain data. Inside the folder a new profile called Genesis.json is created to create your own Genesis block.
Contents of configuration file:
{"
config": {"Chainid": "Homesteadblock":
0,
"Eip155block": 0,
"Eip158block": 0
}, "
Coinbase" : "0x0000000000000000000000000000000000000000", "
difficulty": "0x020000",
"Extradata " :" ",
" Gaslimit " :" 0x2fefd8 ",
" nonce " :" 0x0000000000000042 ",
" Mixhash " :" 0x0000000000000000000000000000000000000000000000000000000000000000 ","
Parenthash ":" 0x0000000000000000000000000000000000000000000000000000000000000000 ","
timestamp " :" 0x00 ",
" Alloc " : {}
}"
Initialize, create the Genesis block
CD your folder
Geth--datadir Data init Genesis.json
Here,--datadir is the directory where the data is saved, and we place it under the current folder under a directory called data;
Init is the initialized configuration.
Start Node
Geth--datadir Data--networkid 1108 Console
Here,--networkid means that the network ID of this chain is 1108, the public network ID of Ethernet square is 1;
Console represents the console that enters JS.
At this point, you should enter the console of JS.
Basic Commands
View Account
> eth.accounts
[]
Create an Account
> Personal.newaccount ()
View account Balances
> Eth.getbalance (eth.accounts[0])
0
Start mining
> Miner.start ()
Stop mining
> Miner.stop ()
The first time to dig a mine to wait for a period of time until the Dag file generation completed ...
Follow-up, the development of the etheric square wallet.