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

How to develop and use EOS Block chain

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

Share

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

Most people do not understand the knowledge points of this article "how to develop and use EOS blockchain", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to develop and use EOS blockchain" article.

Overview of EOS Block chain

EOSIO comes with many programs. The main parts you will use and the parts covered here are:

Nodeos (node + eos = nodeos), which can be configured using plug-ins to run the node's core EOSIO node daemon. Example uses are block production, dedicated API endpoints, and local development.

Cleos (cli + eos = cleos), command line interface for interacting with blockchain and managing wallets.

Keosd (key + eos = keosd), a component that securely stores EOSIO keys in the wallet.

Eosio-cpp (part of eosio.cdt), which compiles C + + code to WASM and generates ABI (CDT is a contract development tool chain).

The basic relationship between these components is shown in the following figure.

The latest stack version (as of this writing date)

Nodeos:1.5.0

Cleos:1.5.0

Keosd:1.5.0

Eosio.cdt:1.4.1

Eosio.contracts:1.4.0

Install the local node

There are several ways to do this:

1. Using Docker is quick and easy.

two。 Use binaries, which is also fine.

Use Docker to install You create 2 containers. One for 'nodeos' and another for' keosd'#Pull latest docker image of EOSdocker pull eosio/eos-dev#Create local networkdocker network create eosdev#Start nodeos (Core Daemon) docker run-- name nodeos-d-p 8888purse 8888-- network eosdev-v / tmp/eosio/work:/work\-v / tmp/eosio/data:/mnt/dev/data-v / tmp/eosio/config:/mnt/dev/config eosio/eos-dev\ / bin/bash-c "nodeos-e-p eosio-- plugin eosio :: producer_plugin\-plugin eosio::history_plugin-- plugin eosio::chain_api_plugin\-- plugin eosio::history_api_plugin-- plugin eosio::http_plugin\-d / mnt/dev/data-- config-dir / mnt/dev/config-- http-server-address=0.0.0.0:8888\-- access-control-allow-origin=*-- contracts-console-- http-validate-host=false "# NOTES about above Command- Creating a Docker container running 'nodeos' daemon- Exposing port 8888 so that you can access the' nodeos' using RPC and HTTP- Mounting few directories on your local machine so that you don't have to login into container- Few plugins which will allow this node to become a producer Expose rpc api over http, exposing command line interface to run 'nodeos' commands#Run keosd (Wallet and Keystore) docker run-d-- name keosd-- network=eosdev-I eosio/eos-dev / bin/bash\-c "keosd-http-server-address=0.0.0.0:9876" # Check installationdocker logs-tail 10 nodeosand you will see something like:info 2018-12-04T15:01:22.003 thread-0 producer_plugin.cpp:1494 produce_block] Produced block 00005ce7fabcbcf8. # 23783 @ 2018-12-04T15:01:22.000 signed by eosio [trxs: 0, lib: 23782, confirmed: 0] info 2018-12-04T15:01:22.507 thread-0 producer_plugin.cpp:1494 produce_block] Produced block 00005ce84867bcbf. # 23784 @ 2018-12-04T15:01:22.500 signed by eosio [trxs: 0, lib: 23783, confirmed: 0] info 2018-12-04T15:01:23.005 thread-0 producer_plugin.cpp:1494 produce_block] Produced block 00005ce936ca4869. # 23785 @ 2018-12-04T15:01:23.000 signed by eosio [trxs: 0, lib: 23784, confirmed: 0] i#Check Wallets (Open bash for keosd) docker exec-it keosd bashand once in the container, on bash, execute this:cleos-- wallet-url http://127.0.0.1:9876 wallet list keysShould show empty wallets:Wallets: [] # Check 'nodeos' end points-run this out side containerscurl http://localhost:8888/v1/chain/get_info{ "server_version": "549c96cd" Chain_id: cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f, head_block_num: 24182, last_irreversible_block_num: 24181, last_irreversible_block_id: 00005e751a1e31b15acd25ffc8725cb2c67926647edb89e726e386716afdef5d, head_block_id: 00005e76fd035dbf694d2a575bb1849f436428b466fd95323e43619b73bf7b9d, head_block_time: 2018-12-04T15:04:41.500, head_block_producer: eosio, virtual_block_cpu_limit: 200000000 "virtual_block_net_limit": 1048576000, "block_cpu_limit": 199900, "block_net_limit": 1048576 "server_version_string": "v1.5.0-rc2"} # Alias cleos so that you can access it by simply 'cleos'docker network inspect eosdevcheck for keosd IP address in the response of above command and execute the following:alias cleos='docker exec-it nodeos / opt/eosio/bin/cleos-- url http://127.0.0.1:8888-- wallet-url http://172.18.0.3:9876' install using binaries-MAC directive # Step 1: Install binariesbrew tap eosio/eosiobrew install eosio#Step 2: Setup a development directory Stick to it.mkdir contractscd contracts#Step 3: Install CDT. The EOSIO Contract Development Toolkit CDT for shortbrew tap eosio/eosio.cdtbrew install eosio.cdt#Boot Node and Wallet # Start keosd: keosd & # Start nodeos: nodeos-e-p eosio\-- plugin eosio::producer_plugin-- plugin eosio::chain_api_plugin-- plugin eosio::http_plugin-- plugin eosio::history_plugin-- plugin eosio::history_api_plugin\-d / Users/vijay/eos_blockchain/contracts/eosio/data\-config-dir / Users/vijay/eos_blockchain/contracts / eosio/config\'- access-control-allow-origin=*'-contracts-console-http-validate-host=false'- filter-on=*' > > nodeos.log 2 > & 1 & # Check installation (in current directory) tail-f nodeos.log # Check the wallet cleos wallet list # Check nodeos endpoints curl http://localhost:8888/v1/chain/get_info

One of the above steps will help you set up and run local nodes.

Use wallets, accounts and keys

Now you're ready to do something on the blockchain. In EOS, you must have an account to perform any operations, such as creating token, sending token, receiving token, writing transactions, etc. This node will have a system user named eosio, so you can use this user to play the eos blockchain.

Therefore, in this section, we will do the following on the local node:

Create a new wallet.

Create a new key (private + public).

Import these keys into the wallet.

Open a new account.

Let's run some commands and observe what you see. You only need to read the comments of all commands to understand what they do.

# List existing wallets. Wallet stores keyscleos wallet list#List wallet keys if anycleos wallet list key#you should see all empty response#create wallet nowcleos wallet createCreating wallet: default "PW5JYR5u7WTk6RaJARE41qb3Wy6BJtcKCjpDAyjR2uV3CWF8nDFe7" this will create wallet with name 'default'. Keep note of password it returns.#Create new keyscleos create key-- to-consolePrivate key: 5JseP8pEsJfAEWix5U6ow77TrKu2uuBhjfobyzgYyCYAtnxnCk8Public key: EOS4tmc8ufENZNkFQaj8ZfV9UfeRLnyaCecybSgPS1U8671BNdSxD#Import the private keys in wallet cleos wallet import-n quant-- private-key 5JseP8pEsJfAEWix5U6ow77TrKu2uuBhjfobyzgYyCYAtnxnCk8#### MOST IMPORTANT STEP # Import genesis' eosio' account keys in the wallet so that eosio account is available for creating new accounts.Private key of eosio: 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

At this stage, you have a wallet with eosio (Genesis account) and an imported new key. So we're ready to do more now.

We will do the following in the next section:

Deploy the token contract so that the blockchain is ready to create a new token.

Create a new token.

Assign the new token to the Genesis account (eosio).

Transfer token between users.

Check the balance, etc.

# Deploy Token Contacts create an account first with the name 'eosio.token' for the contractcleos create account cleos create account eosio eosio.token EOS5ySgzeHp9G7TqNDGpyzaCtahAeRcTvPRPJbFey5CmySL3vKYgE EOS5ySgzeHp9G7TqNDGpyzaCtahAeRcTvPRPJbFey5CmySL3vKYgEyou would see something like this:executed transaction: 4a8b53ae6fa5e22ded33b50079e45550e39f3cb72ffa628e771ea21758844039 200bytes 339 us # eosio

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