Brother even blockchain starter Tutorial EOS source Analysis (2) Run

Source: Internet
Author: User

After the EOS is installed, you can run the EOS program. Currently supports three modes of operation, namely:

-Local private node run
???? Deploy EOS nodes in local LAN, provide EOS services, nodes can be single, or multiple nodes can be deployed
--run under test public network
???? Block.one Company provides a test of the public network environment, you can make your own deployed node connected to the public network test environment
-? Running in Docker
????
Local private node runs
In order to facilitate developer testing, EOS currently deploys a set of test networks in a public network environment. If you deploy a node that is not connected to this public network test environment, it becomes a local private node deployment. In the case of on-premises deployments, you can deploy only a single node, or you can deploy multiple nodes, and we'll describe each of these two scenarios:

Single-node deployment and operation
Once the project has been successfully compiled, you can build/programs/eosiod run the program under the? directory. The call eosiod command can run the EOS node program, and when you run it for the first time, there is a good chance that an error will stop running, regardless of whether or not an error occurred. Ctrl-C Stop the program, you need to do some configuration of the program before the system can really run. When you run the program for the first time, it is automatically generated. data-dir Directory, which contains the default configuration file ( config.ini ) and some other files. You need to make the following modifications to the configuration file:

-Add block to Genesis
genesis-json = /path/to/eos/genesis.json

--Set the producers on the test chain and make the blocks through them
????
???? Producer-name = Inita
???? Producer-name = INITB
???? Producer-name = INITC
???? Producer-name = INITD
???? Producer-name = Inite
???? Producer-name = INITF
???? Producer-name = INITG
???? Producer-name = Inith
???? Producer-name = Initi
???? Producer-name = Initj
???? Producer-name = INITK
???? Producer-name = Initl
???? Producer-name = Initm
???? Producer-name = initn
???? Producer-name = Inito
???? Producer-name = INITP
???? Producer-name = INITQ
???? Producer-name = Initr
???? Producer-name = Inits
???? Producer-name = Initt
???? Producer-name = Initu
????``<br/>-?加载区块生产插件,从而系统可以生产区块<br/> Plugin = Eosio::p roducer_plugin <br/>-?加载钱包插件,从而支持钱包服务<br/> plugin = Eosio::wallet_api_plugin '
-Load RPC and API plug-ins to access EOS services through both interfaces

????
???? Plugin = Eosio::chain_api_plugin
???? Plugin = Eosio::http_plugin
????

Run again? eosiod ? command, when you see the following log, it means that you have successfully started the EOS service.

1575001ms thread-0 chain_controller.cpp:235 _push_block] initm #1 @2017-09-04t04:26:15 | 0 TRX, 0 pending, exectime_ms=0
1575001ms thread-0 producer_plugin.cpp:207 Block_production_loo] INITM generated block #1 @ 2017-09-04t04:26:15 with 0 TR XS 0 pending
1578001ms thread-0 chain_controller.cpp:235 _push_block] INITC #2 @2017-09-04t04:26:18 | 0 TRX, 0 pending, exectime_ms=0
1578001ms thread-0 producer_plugin.cpp:207 Block_production_loo] INITC generated block #2 @ 2017-09-04t04:26:18 with 0 TR XS 0 pending
...

Deploying a multi-node network
In your EOS project? build/programs/eosio-launcher ? Directory, there is an application dedicated to the launch of the EOS node, the name is? eosio-launcher , the following command runs two nodes that can interact with one another:

Sh
Cd?~/eos/build
Cp.. /genesis.json./
./PROGRAMS/EOSIO-LAUNCHER/EOSIO-LAUNCHER-P2--skip-signature

The above command will create two data directories, each of which corresponds to one of the directories, and the directory names are: tn_data_00 ? andtn_data_01

You can see the following log output in the command line terminal, which indicates that the system has generated two sub-processes, one for each running node:

Spawning child, Programs/eosiod/eosiod--skip-transaction-signatures--data-dir tn_data_0
Spawning child, Programs/eosiod/eosiod--skip-transaction-signatures--data-dir tn_data_1

To further verify that the two nodes are actually working, you can use eosioc the client tool to connect the two nodes individually, as follows:

CD PATH-TO-EOS/BUILD/PROGRAMS/EOSIOC
./eosioc-p 8888 Get Info
./eosioc-p 8889 Get Info

Two of the above eosioc two nodes respectively, you can see that the two node port numbers are 8888 and 8889, respectively, after the connection, call? get info command to obtain the blockchain information for the different nodes.

Run under test public network
Block.one provides testers and developers with a public network test environment, if you have experienced the operation of the EOS node locally, and want to be able to test your code under the public network, then you can connect the local EOS node to the public network environment, the following:

CD path-to-eos/build/scripts
./start_npnode.sh

After the system compiles, the script file is generated, and the start_npnode.sh script actually calls the eosd program, but its default data directory parameter is testnet_np that the file in this directory is set up with the connection address of the peer node in the config.ini public network environment, so After the program starts, it will be connected directly to the public network, which is the main difference between connecting the public network environment and running under the private chain, this line is configured as follows:
p2p-peer-address = p2p-testnet1.eos.io:9876

p2p-testnet1.eos.ioThis domain name points to a node of the Block.one public network environment. start_npnode.shafter the command is run, you can get the following log output:

Launched Eosd.
See Testnet_np/stderr.txt for EOSD output.
Synching requires at least 8 minutes, depending on network conditions.

If you want to understand the specifics of node run and synchronization, you can run the following command to view:

Tail-f Testnet_np/stderr.txt

When connected to the public network environment, the node first needs to synchronize the existing blockchain data from the public network, which takes a certain amount of time, when you see the following log information, the data is synchronizing:

3439731ms chain_plugin.cpp:272 Accept_block] Syncing Blockchain---Got block: #200000 time:2017-12-09t07:56:32 producer : Initu
3454532ms chain_plugin.cpp:272 Accept_block] Syncing Blockchain---Got block: #210000 time:2017-12-09xxx3:29:52 Produce R:initc

When the synchronization is complete, you will see the following information:
42467ms net_plugin.cpp:1245 Start_sync] catching up with chain, we last req was 351734, theirs is 351962 peer Ip-10-160-1 1-116:9876
42792ms chain_controller.cpp:208 _push_block] Initt #351947 @2017-12-12t22:59:44 | 0 TRX, 0 pending, exectime_ms=0
42793ms chain_controller.cpp:208 _push_block] Inito #351948 @2017-12-12t22:59:46 | 0 TRX, 0 pending, exectime_ms=0
42793ms chain_controller.cpp:208 _push_block] initd #351949 @2017-12-12t22:59:48 | 0 TRX, 0 pending, exectime_ms=0

Running in Docker

Brother even blockchain starter Tutorial EOS source Analysis (2) Run

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.