Geth's full name is Go-ethereum, is an Ethernet square client, written in the go language, should be currently the most commonly used clients. Of course, the Ethernet square client is also useful C++,ruby,python,java and other languages written, different types of clients to meet the different requirements of the scene. Today we will mainly introduce the use of geth (pronounced with guess).
(1) Open the terminal terminal and execute the following command to start the Geth in development mode
Geth--datadir "~/ethdev"--dev
This will create a Ethdev folder under the current root directory, of course, the name of the folder you can take it yourself, we leave this folder is for the purposes of what to do, the following will be introduced
(2) After the successful start of Geth, reopen a terminal, execute the following command, open the Geth console:
Geth--dev Console 2>>file_to_log_output
This command opens the Geth console, while generating a log file called File_to_log_output in the directory, which we will check for this log file.
(3) See what accounts are currently available
Eth.accounts
(4) Create a new account
Personal.newaccount (' password ')
We create two accounts here. Then use the eth.accounts to view the account:
(5) The account can be assigned to a variable, while the balance of the account is queried
(6) The above mentioned log file, we reopen a terminal, we use the following command to open the log:
Tail-f File_to_log_output
(7) Start ore digging in Geth console: Miner.start ()
Ethernet Square perform miner.start return null
whether to set miner address
Before starting the node to dig the mine, you need to see if the account exists in the current node, you can execute the following command to see if there is an account under the current node.
>personal.listaccounts
["0xc040cbd8a189d36f580fa83c2ffe3a26fb3e6a7e", "0XE0D1DE6C934049FE4847B64BECFF5885BDB83FA4"]
When the confirmation account already exists, you can set the Etherbase. Check out the following Coinbase accounts first:
>eth.coinbase
"0xc040cbd8a189d36f580fa83c2ffe3a26fb3e6a7e"
Through the above command, you can see the Coinbase account address, that is, check the address above to find the first address.
To perform the setup miner address:
>miner.setetherbase (Eth.coinbase)
True
You can also perform the following command to set:
>miner.setetherbase (Eth.accounts[0])
True
You can then perform a mining command to see if the problem is resolved. node false Alarm
In another case, the Miner.start () command has been successfully executed, except that the node returns NULL. If it is dev mode, you can use Eth.blocknumber to see if the block height increases. node version problem
I installed the geth-1.7.3 version of the node, in the dev environment to verify the discovery, when the execution of Miner.start (), return null. But in fact miner has been executed, except that it waits for you to send a transaction before it generates a new chunk. That is, the execution of Miner.start (), which has been waiting, which is to send a deal, and then view the block height found has been added to the piece.
(8) Stop digging mine
Miner.stop ()
(9) At this point, we will look at the account balances of two accounts. This shows that the deposit of the ether is passed into the first account by default.
(a) User1 transfer of etheric currency to User2
Eth.sendtransaction ({From:user1,to:user2,value:web3.towei (3, "Ether")})