table of Contents
geth and ethereum wallet installation
geth start-related
I use the environment installation for the 15 Pro version of VMware® Workstation 15.5.0 of Ubuntu 18.04.3 LTS mirror.
geth open command:
geth --datadir "xxx" console --rpc --dev --dev.period 0
xxx is you set up geth private chain block chain is created data directory, first mentioned in Bowen's, such as:
geth --datadir "/home/zhou/chain1" console --rpc --dev --dev.period 0
my data storage location is / home / zhou / chain1
other complex points command such as:
geth --datadir "./" --networkid 989898 -rpc console --port 30304 --rpcport 8546 /
--dev.period value 1 --allow-insecure-unlock
- -Rpc
remote procedure calls, we can add this in ethereum wallet chain link private - -Dev
developer mode, plus the geth will not go public synchronous Ethernet Square chain, but into developer mode - -Dev.period x
and -dev conjunction, set mining policy, x is 0 (default) will only have mining in the transaction, and will only generate a block. . . do not know why. Square provisions of ether behind a block only if there are 12 blocks will be confirmed through verification, that is only if we open at 12 nodes can be normally performed in subsequent experiments. . .
So generally x is set to 1, when you first start the private chain, if x is 1, the system will automatically generate an account and start mining, we at the command lineminer.stop()
, then mining will stop and return null, then use commandseth.blockNumber
can see the number of blocks have been excavated, after starting a private chain again, the system will not create a new account, but the account directly to mining accounts automatically start mining. - -Networkid --port --rpcport
I do not know what the port. . . Open when you can not add automatically generated (it), if suggestive of a port is occupied, and then re-open when combined with the corresponding port and the port number, and be careful not to prompt the occupied port, as should the Tip tcp port 30303 is occupied, then plus--port 30301
or a different port number. - -Allow-insecure-unlock
the latest updates Ethernet Square, ban direct way to unlock the account in the console, if you want to unlock the console will add the account.
The system automatically accounts related
password
The first would like to transfer money from an account in the system to other accounts, passwords, try an afternoon did not find out all kinds of Baidu, asked a big brother to say in the configuration file there, looking for a long discovered this document, the location is home / zhou / chian1 / geth / LOCK
found to be empty after opening the file, I think there is no password Yeah, and then try again. . . Wait until the next day, a hot head, the password will not be empty bar, the transaction once again, enter the password "," successful. . .
Change coinbase
Here I wanted to abandon the account is automatically created, using my own account to mining, use the command miner.setEtherbase(xxx)
, xxx is mining a new address, after setting start mining, the console has been waiting for, no new information display can not enter other commands, this issue is not yet resolved.
Other experiments at present I am going to the next step of the automated account system as an Ethernet pool, turn inside out from Ethernet to other accounts smart contract calls.
geth private and ethereum wallet chain links
geth chain link private and ethereum wallet has been described in the first part of the blog, the problem I have encountered here is not linked to sudden wallet with a few days of a private chain (ie chain1), restart the geth have not been solved the current strategy is to re-establish the private chain file, and will have a later chain2, chain3. . .
The reason is unknown, but may be modified coinbase address and I have a relationship, not a few private chain link I have tried to modify the coinbase.
Intelligent related contracts
Deployment of smart contract See Bowen:
reference Bowen
described in great detail, and here I want to say and pay attention, or is my personal habits, and I after the first 1 + n times to open the geth, will enter immediately miner.stop()
stop mining, until when I deploy contracts, transfers or calls will open again mining contracts, use the command miner.start(x);admin.sleepBlocks(y);miner.stop();
indication x CPU cores were mining, stops after blocks dug y, x generally default, if the CPU resource constraints, then It can be set to a small number, y I generally set to 10.
Doing so can sometimes be a problem, I use this command to open mining contracts after the call, the console will be stuck. . . Then restart the geth, invalid, restart the virtual machine, invalid, established chain4. . .