Be one of the first people to run EOS

To review the last article, the EOS system has three main applications:

  • Nodeos: The core processes of the EOS system, known as “nodes”.

  • Cleos: A local command-line tool that interacts with human users on the command line and communicates with nodes (Nodeos) and wallets (Keosd). It is a bridge between the user or developer and the node process.

  • Keosd: local wallet tool. Multiple wallets with private keys can be managed and encrypted.

requirements

This tutorial works on the following systems, but it is highly recommended to install a virtual machine on Ubuntu, regardless of whether you are running a Windows or A MAC, as the MAC has a lot of bugs. Tutorials on installing Ubuntu virtual Machines are available online.

  • Amazon 2017.09 and who.
  • Centos 7.
  • Fedora 25 and higher (Fedora 27 recommended).
  • Mint 18.
  • Ubuntu 16.04 (Ubuntu 16.10 recommended)
  • MacOS Darwin 10.12 and higher (MacOS 10.13.x recommended).

Configuration requirements:

  • 8 gb of memory
  • 20GB free disk space

If the machine has less than 8 GIGABytes of memory, the automatic compilation script will report an error.

Running EOS requires a little Linux and Github foundation, but don’t bother, as developing EOS contracts in the future will require a lot of this knowledge. Recommend you do by step first rise, have not understood can refer to the following article. Don’t be afraid. No one is born knowing everything.

Linux Command base: linux.cn/article-616…

Making basis: www.runoob.com/w3cnote/git…

Download EOS code

If you have a Mac and need to download Git first, you can search “Mac Git” for various articles that will teach you how to install Git on your Mac.

First use the CD command to go to the folder you want to install, which is usually the root directory, and run the following command to download the EOS code:

git clone https://github.com/EOSIO/eos --recursive
Copy the code

Note to add the recursive command as EOS has several sub-modules so that they can all be downloaded. If you forget this command, use the following command to fix it:

git submodule update --init --recursive
Copy the code

Build the EOS

With the source code, we were able to build our native EOS program. The EOS official has kindly prepared an automatic build script for us. Using this script can be greatly simplified, first we go to the EOS directory we just downloaded and execute the build script:

cd eos
./eosio_build.sh
Copy the code

Depending on the network speed and machine performance, it may take 30 minutes to 1 hour. Please be patient. After the completion of the construction, the products of the construction need to be verified:

  • Linux (Ubuntu, etc.) :
~/opt/mongodb/bin/mongod -f ~/opt/mongodb/mongod.conf &
Copy the code
  • Mac:
/usr/local/bin/mongod -f /usr/local/etc/mongod.conf &
Copy the code

All operating systems then execute the following command:

cd build
make test
Copy the code

To facilitate the development of smart contracts, you also need to make install in the build directory: If you have entered the build directory, remove the CD build.

cd build
sudo make install
Copy the code

Establish a local single-node test network

After the completion of the building, we enter the eos/build/designed/nodeos directory (using the CD and CD.. Run the nodeOS node program:

./nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::account_history_api_plugin 
Copy the code

In the command, the -p parameter indicates that the eoSIO account permission is used, which is the original account provided by the local test system. The following plug in parameters are the plug-ins that you choose to load.

If you see output similar to the following, you have successfully established a local single-node test network:

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 trxs 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 trxs 0 pending. eosio generated block 046b9984...# 101527@2018-04-01T14:24:58.000 with 0 TRXS
eosio generated block 5e527ee2... # 2018-04-01T14:24:58.500 with 0 TRXS.Copy the code

The local single node starts to generate blocks.

As mentioned in the previous article, the local test network we set up was as follows. Instead of a separate Keosd wallet, we used the wallet plug-in in the NodeOS program.

Advanced Settings

If this is not enough, you can modify the node configuration. The configuration file is located at:

  • Mac OS: ~/Library/Application Support/eosio/nodeos/config
  • Linux: ~/.local/share/eosio/nodeos/config

The genesis.json configuration file is in the above folder by default. You can modify it directly or write a new configuration file in another file, but when running nodeOS, you need to specify the location of the new configuration file by using the –config-dir command.

The configuration folder also has a config.ini file by default. If not, nodeOS will automatically create one when it starts, but the config.ini file that is automatically created does not allow the node to block. In this case, you need to use Ctrl-c to stop nodeOS and edit the file:

	# Load the testnet genesis state, which creates some initial block producers with the default key
   genesis-json = /path/to/eos/source/genesis.json
   # Enable production on a stale chain, since a single-node test chain is pretty much always stale
   enable-stale-production = true
   # Enable block production with the testnet producers
   producer-name = eosio
   # Load the block producer plugin, so you can produce blocks
   plugin = eosio::producer_plugin
   # Wallet plugin
   plugin = eosio::wallet_api_plugin
   # As well as API and HTTP plugins
   plugin = eosio::chain_api_plugin
   plugin = eosio::http_plugin
   # This will be used by the validation step below, to view account history
   plugin = eosio::account_history_api_plugin
Copy the code

When this is done, restart nodeOS and the block will be smooth.

Nodeos’s running data folders (such as logs and shared storage) are located in the following folders:

  • Mac OS: ~/Library/Application Support/eosio/nodeos/data
  • Linux: ~/.local/share/eosio/nodeos/data

But you can also respecify the data folder using nodeOS’s –data-dir command.


Related articles and videos recommended

[Xu Xiaodi] EOS block data structure

Yuan Yuan Institute brings together a large number of blockchain masters to create high-quality blockchain technology courses. There are high quality free public courses on all major platforms for a long time, welcome to sign up and watch.

Open course address: ke.qq.com/course/3451…