Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed steps for eosio compilation and deployment

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "the detailed steps of eosio compilation and deployment". In the daily operation, I believe many people have doubts about the detailed steps of eosio compilation and deployment. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "detailed steps of eosio compilation and deployment". Next, please follow the editor to study!

1. Noun interpretation

The Genesis Node (BIOS) is used to create initial blocks and load base contracts for other nodes to connect synchronously.

The miner node (BP) is mainly used for the production of synchronous blocks, and the cost generated by the calculation contract is owned by the miner's account.

The query node does not generate blocks, synchronizes block information, and provides block information query function.

The private key is used for signature operation, and the private key can generate a unique corresponding public key.

The public key is used to verify the signature of the private key.

Where the wallet generates and saves the private key, when a signature operation is needed, the list of private keys is read from the wallet and signed.

Bandwidth is divided into cpu bandwidth and net bandwidth. A certain amount of bandwidth is consumed each time the contract is executed (deducted from the account).

A contract is an executable code on the chain and is bound to an account. Each account can only be bound to one contract.

The account stores user information, including balance, bandwidth, contract (if any), etc.

Total number of votes = total number of currencies issued.

Voters pledge money to vote for miners, and when the number of votes cast by miners is more than 15% of the total number of votes, the creation node stops producing blocks, and the miners produce blocks.

The so-called miner node and query node are only used to distinguish the different configurations of production blocks.

two。 Node code compilation, program installation

Note: later compilation depends on GIT, so be sure to make sure that the .git of the code root is complete and that the system has git installed. Take the ubuntu system as an example, and the steps of other systems are similar.

Install GIT first and ignore this step if it is already installed

Sudo apt update & & sudo apt install git-y

Clone the latest code from GIT

Git clone https://github.com/eosio/eos-recursive-depth 1

Automatic compilation using eosio_build.sh

The script will check the system dependent library and install it automatically. Please pay attention to the administrator permission prompt. If you download the dependent library, please check the network status and execute it again.

Cd eosioexport LOCAL_CMAKE_FLAGS= "- DEOSIO_ROOT_KEY=EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV-DCORE_SYMBOL_NAME=EOS". / script/eosio_build.sh

Formal environments can use the LOCAL_CMAKE_FLAGS environment variable to specify the root public key EOSIO_ROOT_KEY and the system currency symbol CORE_SYMBOL_NAME

Packaging and installation

The ASCII drawing prompt of 'EOSIO'' will appear when the compilation is successful, please do the following to install the program to the system, if there is a compilation error, please submit the error prompt to the relevant personnel to check the solution.

Cd build/packages bash. / generate_package.sh [brew | deb | rpm] ls # ubuntu sudo dpkg-I eosio-v1.7.3.deb # redhat sudo yum install eosio-v1.7.3.rpm # or sudo rpm-ivh eosio-v1.7.3.rpm

Parameter description:

Brew mac system

Deb ubuntu system

Rpm redhat system

Recompile if you modify the code, or make a version update, close the currently running wallet and node programs, and clear the thought programs installed on the system before compiling.

Pkill-2 keosd nodeos#ubuntusudo apt remove eosio#redhatsudo yum remove eosio

3. Directory where the default profile is located

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

4. Create a default wallet and public and private keys

Start the wallet service

Keosd-unlock-timeout 3600 # 3600 seconds after the wallet relocks

Create a wallet

Please save the output wallet password so that you can use it the next time you open it.

Cleos wallet create-n default# Open wallet cleos wallet open-n default

Create a public and private key

Cleos create key

Import the private key generated in the previous step into the wallet

Cleos wallet import-n default-- private-key [private key]

5. The general configuration parameter name example shows that the name of the node that identifies itself in the agent-namep2p network is "eosio bios" producer-name miner's account name "eosio" signature-provider miner's public and private key, which is used to sign EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV.

= KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3p2p-server-addressp2p service listens to address. Default listens to 0.0.0.0: 9876 "0.0.0.0 http 9876" http-server-addresshttp server listening address. If you do not want to provide http service, you can leave the address blank, otherwise the http service will not be started. Note that if you do not fill in the default address 127.0.0.1 enable-stale-production 8888 "127.0.0.1 8888" will be used as soon as the block is started. If it is not a BIOS node, enter false here. The P2P synchronization address of other truep2p-peer-address nodes, which is used to synchronize data. This parameter can be used to connect to multiple nodes. Genesis node configuration 6.1. Startup parameter configuration

To create the public and private keys of the eosio system account, see 4. 0. Create wallets and public and private keys

Modify the initial_key of genesis.json to the public key generated in the previous step

Start the node and fill in the public and private keys generated in step 1

Nodeos-- agent-name "eosio bios"-- producer-name "eosio"\-- signature-provider [public key] = KEY: [private key]\-- plugin eosio::chain_plugin-- plugin eosio::chain_api_plugin\-- p2p-server-address "0.0.0.0 producer-name 9876"-- http-server-address "127.0.0.1 producer-name 8888"-- enable-stale-production

6.2. Deployment system contract

Download the compile contract compiler

Git clone https://github.com/eosio/eosio.cdt.git-- recursive-- depth 1 cd eosio.cdt. / build.sh sudo. / install.sh

Download the compilation contract

Git clone https://github.com/eosio/eosio.contracts.git-- depth 1 cd eosio.contracts. / build.sh

Create a system account

OwnerKey is the same as ActiveKey, see 6. 1 generated public key

Cleos create account eosio eosio.token [OwnerKey] [ActiveKey]-p eosio cleos create account eosio eosio.msig [OwnerKey] [ActiveKey]-p eosio cleos create account eosio eosio.bpay [OwnerKey] [ActiveKey]-p eosio cleos create account eosio eosio.names [OwnerKey] [ActiveKey]-p eosio cleos create account eosio eosio.ram [OwnerKey] [ActiveKey]-p eosio cleos create account eosio eosio.ramfee [OwnerKey] [ActiveKey]-p eosio cleos create account eosio eosio.saving [OwnerKey] [ ActiveKey]-p eosio cleos create account eosio eosio.stake [OwnerKey] [ActiveKey]-p eosio cleos create account eosio eosio.vpay [OwnerKey] [ActiveKey]-p eosio

If the root public key is specified using the LOCAL_CMAKE_FLAGS parameter, it must be the same here.

To deploy the currency contract, please make sure it is executed in the contract code root directory, see 6.2.2 download the compilation contract

Cleos set contract eosio.token build/eosio.token-p eosio.tokencleos set contract eosio.msig build/eosio.msig-p eosio.msig

Create currency

Cleos push action eosio.token create'["eosio", "1000000000000.0000 EOS", 0,0,0]'- p eosio.tokencleos push action eosio.token issue'["eosio", "1000000000000.0000 EOS", "issue"]'- p eosio

If the system currency symbol is specified using the LOCAL_CMAKE_FLAGS parameter, it must be the same here.

To deploy the system contract, please make sure it is executed in the contract code root directory, see 6.2.2 download the compilation contract

Cleos set contract eosio build/eosio.system-p eosiocleos push action eosio init'[0, "4je EOS"]'- p eosio@activecleos push action eosio setpriv'["eosio.msig", 1]'- p eosio@active

7. Miner node configuration 1. Registered miner account

To create the public and private keys of the miner's account, see 4. Create wallets and public and private keys

Create miner's account

Cleos system newaccount-- stake-net [quantity]-- stake-cpu [quantity]-- buy-ram-kbytes 8192\ [creater] [name] [OwnerKey] [ActiveKey]-p [creater] # Parameter description # the creator account of the creater miner account. The name of the # name miner account. # quantity buys bandwidth resources and deducts them from the creator's account. # OwnerKey is the same as ActiveKey, and the public key of the miner's account is the public key generated in the previous step. # sample cleos system newaccount-- stake-net "50.0000 EOS"-- stake-cpu "50.0000 EOS"-- buy-ram-kbytes 8888888 eosio eosnewbpa\ EOS7n1U9Z2NQeVEvQZYjHCedNXRVWshmmuGH2j3r6bD4c8fH4U8QL EOS7n1U9Z2NQeVEvQZYjHCedNXRVWshmmuGH2j3r6bD4c8fH4U8QL-p eosio

Transfer money to miner's account

Cleos transfer [from] [recipient] [amount] [momo] # Parameter description # from transfer account # recipient receive transfer account # amount amount # momo Note # sample cleos transfer eosio eosnewbpa "9000000000.0000 EOS"trans to eosnewbpa"

Registered miner

Cleos system regproducer [name] [ActiveKey] [url] # Parameter description # name miner account # ActiveKey miner account public key # url miner's website # sample cleos system regproducer eosnewbpa EOS7n1U9Z2NQeVEvQZYjHCedNXRVWshmmuGH2j3r6bD4c8fH4U8QL https://192.168.0.57:8888

Mortgage the corresponding resources

Cleos system delegatebw [name] [name] [stake_net_quantity] [stake_cpu_quantity] # Parameter description # name miner account # network bandwidth resource pledged by stake_net_quantity # CPU bandwidth resource pledged by stake_cpu_quantity # example cleos system delegatebw eosnewbpa eosnewbpa '4400000000.0000 EOS'' 4400000000.0000 EOS'

Vote for yourself.

Cleos system voteproducer prods [voter] [producers]-p [voter] # Parameter description # voter miner account # network bandwidth resources pledged by producers # sample cleos system voteproducer prods eosnewbpa eosnewbpa

two。 Startup parameter configuration

To create the public and private keys of the eosio system account, see creating wallets and public and private keys

Modify the initial_key of genesis.json to the public key generated by the creation node (BIOS)

Start the node and fill in the public and private keys generated in step 1

Suppose that the bios node 192.168.0.56 is known, the Magi BP node 192.168.0.58 is known.

Nodeos-- agent-name "eosnewbpa"-- producer-name "eosnewbpa"\-- signature-provider [public key] = KEY: [private key]\-- p2p-server-address "0.0.0.0 producer-name 9876"-- http-server-address "127.0.0.1 producer-name 8888"\-- p2p-peer-address "192.168.0.56 Swiss 9876"-p2p-peer-address "192.168.0.58Rol 9876"

8. Query node configuration

The configuration of the query node is similar to that of the miner node, except that the miner is not registered, and the query node is often used for data query. It is recommended to open the mongo_db_plugin plug-in. Mongo_db_plugin is a plug-in that saves block transaction information to mongodb.

Suppose you have known bios nodes 192.168.0.56 purl 9876 Magi BP nodes 192.168.0.57 frex9876 and 192.168.0.58 Rue 9876, and all three nodes have the mongo_db_plugin plug-in enabled.

Nodeos-- agent-name "eosnewbpb"-- producer-name "eosnewbpb"\-- signature-provider [public key] = KEY: [private key]\-- p2p-server-address "0.0.0.0 producer-name 9876"-- http-server-address "127.0.0.1 producer-name 8888"\-- p2p-peer-address "192.168.0.56 Swiss 9876"-p2p-peer-address "192.168.0.57 producer-name 9876"-- P2P -peer-address "192.168.0.58 9876"\-plugin eosio::mongo_db_plugin-- mongodb-uri mongodb://127.0.0.1:27017/EOSIO9. Suggestion

From a security point of view, do not disclose the private key to others, after knowing the private key of the account, you can manipulate the account at will.

If you use a private key generated by a mnemonic, use a more complex mnemonic.

Many of the parameters passed above are for demonstration. For formal deployment, it is recommended to use configuration files.

It is recommended to use SIGINT signal to shut down the node to prevent the program from generating dirty data.

Pkill-2 keosd nodeos

If dirty data is generated, use the-- replay-blockchain parameter or-- delete-all-blocks parameter to start the node and resynchronize the data.

Before starting the node, make sure that the time and time zone is correct, and the time offset will affect the block data verification.

Sudo mv / etc/localtime / etc/localtime.baksudo ln-s / usr/share/zoneinfo/UTC / etc/localtime# use ntpdate to update system time sudo apt install ntpdate ntp-y # yum install ntpdate ntp-ysudo timedatectl set-timezone UTCsudo ntpdate-u time.windows.comsudo hwclock-- systohc # write hardware # start ntpd service sudo systemctl enable ntp # systemctl enable ntpdsudo systemctl start ntp # systemctl start ntpd

At this point, the study of "detailed steps for compiling and deploying eosio" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report