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

The Construction of EOS Development Environment

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces "the construction of EOS development environment". In the daily operation, I believe that many people have doubts about the construction of EOS development environment. 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 about "building EOS development environment". Next, please follow the editor to study!

Get the code

Download all EOSIO code, clone eos libraries and all submodules.

The shell command is as follows:

Git clone https://github.com/EOSIO/eos-- recursive

It doesn't matter if you forget to add the-- recursive parameter, and then you can clone all submodules with the command.

Git submodule update-- init-- recursive installation build settings

EOSIO can be installed and built on multiple platforms, and there are various paths for installation and build. Most users prefer to use automated scripts or docker, while more advanced users or users who want to deploy public nodes may need to do so manually. The build content is generated in the eos/build folder. Executable files can be found in a subfolder of the eos/build/programs folder.

Automated script: suitable for most developers, this script is based on Mac OS and many Linux versions.

Docker-compose mode: by far the fastest installation method, you can start and run a node in two minutes. That is, it requires some additional local configuration for development in order to run smoothly and follow the tutorials we provide.

Manual installation builds: for developers who may have conflicts with automated scripts or want more control over their builds.

Executable installation build: an optional make install step to make local development more friendly.

If you are a novice, it is recommended to look directly at the quick build and installation of EOSIO through docker.

Automated script installation

There is an automated build script that installs all dependencies and builds EOSIO. The script supports the following operating systems.

We are supporting Linux/UNIX releases that will be supported by future launches.

Amazon 2017.09 and later.

Centos 7 .

Fedora 25 and later (Fedora 27 is recommended).

Mint 18 .

Ubuntu 16.04 (Ubuntu 16.10 is recommended).

MacOS Darwin 10.12 and later (MacOS 10.13.x is recommended).

Run the installation build script from the eos directory:

Construction in cd eos./eosio_build.shdocker-compose mode

If you just want to run, it may be more appropriate to install EOSIO through docker Quick build. Otherwise, you want to learn more about higher-level builds, so go ahead.

Install dependencies

Docker:Docker version 17.05 or later

Docker-compose: version > = 1.10.0

Requirements of Docker

At least 7GB RAM (DOCK- > preferences-> Advanced-> memory-> 7GB or above)

If the installation fails, make sure you have adjusted the Docker memory settings, and then try again.

Build eos image git clone https://github.com/EOSIO/eos.git-- recursive-- depth 1cd eos/Dockerdocker build. -t eosio/eos

The above will build the latest commit to the main branch by default. If you want to target a specific branch / tag, you can use the build parameter. For example, if you want to generate a Docker image based on v1.0.0 tag, you can do the following:

Docker build- t eosio/eos:v1.0.0-- build-arg branch=v1.0.0.

By default, the symbol for eosio.system is set to SYS. When building a Docker image, you can use the symbol parameter to do this.

Docker build- t eosio/eos-- build-arg symbol=ABC. Start nodeosdocker run-- name nodeos-p 8888 eosio/eos nodeosd.sh-e arg1 arg2 in docker

By default, all data is saved in the docker volume. If the data is outdated or corrupted, you can delete it:

$docker inspect-- format'{{range .Mounts}} {{.Name}} {{end}} 'nodeosfdc265730a4f697346fa8b078c176e315b959e79365fc9cbd11f090ea0cb5cbc$ docker volume rm fdc265730a4f697346fa8b078c176e315b959e79365fc9cbd11f090ea0cb5cbc

Alternatively, you can install the host directory directly into docker.

Docker run-- name nodeos- v / path-to-data-dir:/opt/eosio/bin/data-dir-p 8888 eosio/eos nodeosd.sh-e arg1 arg2 acquires block chain information curl http://127.0.0.1:8888/v1/chain/get_info launches nodeos and keosddocker volume create-- name=nodeos-data-volumedocker volume create-- name=keosd-data-volumedocker-compose up-d in docker

After docker-compose-d, the nodeos and keosd services will be started. The nodeos service provides ports 8888 and 9876 to the host. The kesod service does not expose any ports to the host, and cleos can access it only when cleos is running in the cleos container.

Execute the cleos command

You can run cloes through the bash alias

Alias cleos='docker-compose exec keosd / opt/eosio/bin/cleos-u http://nodeosd:8888-- wallet-url http://localhost:8900'cleos get infocleos get account inita

If you want to use the cleos command anywhere, you can specify a path in docker-compose.yml:

Alias cleos='docker-compose-f path-to-eos-dir/Docker/docker-compose.yml exec keosd / opt/eosio/bin/cleos-u http://nodeosd:8888-- wallet-url http://localhost:8900'

Submit a sample exchange contract:

Cleos set contract exchange contracts/exchange/

If you don't need keosd, you can stop using the keosd service:

Docker-compose stop keosd develops and builds customer contracts

Because the eosio/eos image does not contain the dependencies required by the contract development (this is designed to maintain a small image size), you need to use the eosio/eos-dev image. This image contains the required binaries and dependencies for building contracts using eosiocpp.

You can use the images available on Docker Hub or go to the dev folder and build the images manually.

Cd devdocker build-t eosio/eos-dev. Modify the default configuration

You can use docker compose to change the default configuration. For example, create a backup configuration file config2.ini and docker-compose.override.yml with the following contents:

Version: "2" services: nodeos: volumes:-nodeos-data-volume:/opt/eosio/bin/data-dir -. / config2.ini:/opt/eosio/bin/data-dir/config.ini

Then restart docker:

Docker-compose downdocker-compose up Delete data-dir

Data volumes created by docker-compose can be deleted:

Docker volume rm nodeos-data-volumedocker volume rm keosd-data-volumeDocker Hub

Docker Hub image from docker hub

Create a new docker-compose.yaml file as follows:

Version: "3" services: nodeosd: image: eosio/eos:latest command: / opt/eosio/bin/nodeosd.sh-- data-dir / opt/eosio/bin/data-dir-e hostname: nodeosd ports:-8888 volumes:-9876 expose:-"8888" volumes:-nodeos-data-volume:/opt/eosio/bin/data-dir keosd: image: eosio/eos:latest command : / opt/eosio/bin/keosd-wallet-dir / opt/eosio/bin/data-dir-http-server-address=127.0.0.1:8900 hostname: keosd links:-nodeosd volumes:-keosd-data-volume:/opt/eosio/bin/data-dirvolumes: nodeos-data-volume: keosd-data-volume:

Note: the default version is the latest version, you can change it to the version you want.

Run: docker pull eosio/eos:latest

Run: docker-compose up

EOSIO 1.0 Testnet

We can easily build an EOSIO 1. 0 native Testnet test chain, using docker images. Simply run the following command:

Note: if you want to use the mongo db plug-in, you must first enable it in data-dir/config.ini.

# pull imagesdocker pull eosio/eos:v1.0.0# create volumedocker volume create-- name=nodeos-data-volumedocker volume create-- name=keosd-data-volume# start containersdocker-compose-f docker-compose-eosio1.0.yaml up-d # get chain infocurl http://127.0.0.1:8888/v1/chain/get_info# get logsdocker-compose logs-f nodeosd# stop containersdocker-compose-f docker-compose-eosio1.0.yaml down

By default, blocks data is stored under-- data-dir, and wallet files are stored under-- wallet-dir by default. Of course, you can change these file paths as needed.

About the MongoDB plug-in

Currently, the MongoDB plug-in is disabled in config.ini, and by default, it must be changed manually in config.ini, or you can mount the config.ini file to / opt/eosio/bin/data-dir/config.ini in the docker-compose file.

Manually install the build

To generate manually, use the following steps to create a build folder in the eos folder, and then execute build. The following steps assume that the eos repository is clone into the home (i.e., ~) folder. It is also assumed that the necessary dependencies are already installed. See manually installing dependencies.

Cd ~ mkdir-p ~ / eos/build & & cd ~ / eos/build

On the Linux platform, use this cmake command:

Cmake-DBINARYEN_BIN=~/binaryen/bin-DWASM_ROOT=~/wasm-compiler/llvm-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl-DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib-DBUILD_MONGO_DB_PLUGIN=true..

On MacOS, use this cmake command:

Cmake-DBINARYEN_BIN=~/binaryen/bin-DWASM_ROOT=/usr/local/wasm-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl-DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib-DBUILD_MONGO_DB_PLUGIN=true..

Then execute on your platform:

Make-j$ (nproc)

Out-of-source installation builds are also supported. To override the default selection in the compiler, add these flags to the CMake command:

-DCMAKE_CXX_COMPILER=/path/to/c++-DCMAKE_C_COMPILER=/path/to/cc

For debug mode installation builds, add-DCMAKE_BUILD_TYPE=Debug. Other common build types include Release and RelWithDebInfo.

Executable file installation build

To facilitate smart contract development, you can use make install to install the target content into / usr/local. This step is to be run from the build directory. Appropriate installation permissions are required.

Cd buildsudo make install system requirements (including all platforms)

Memory 7GB

Hard disk 20GB

Verification of installation build

Optionally, we can run a set of tests on our build to perform some basic validation. To run the test suite after building, start mongod and then run make test.

On the Linux platform:

~ / opt/mongodb/bin/mongod-f ~ / opt/mongodb/mongod.conf &

On the MacOS platform:

/ usr/local/bin/mongod-f / usr/local/etc/mongod.conf &

Then do the following:

Cd buildmake test at this point, the study on "building the EOS development environment" 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