• 搭建EOS环境


    搭建EOS环境

    1、Ubuntu 18.04 下安装eosio

    wget https://github.com/eosio/eos/releases/download/v1.4.4/eosio_1.4.4-1-ubuntu-18.04_amd64.deb
    sudo apt install ./eosio_1.4.4-1-ubuntu-18.04_amd64.deb

      在~目录下创建 contracts 目录。

    2、启动钱包。

    keosd &

      启动成功的话,可以看见下面的输出。

    info  2018-11-26T06:54:24.789 thread-0  wallet_plugin.cpp:42          plugin_initialize    ] initializing wallet plugin
    info  2018-11-26T06:54:24.795 thread-0  http_plugin.cpp:554           add_handler          ] add api url: /v1/keosd/stop
    info  2018-11-26T06:54:24.796 thread-0  wallet_api_plugin.cpp:73      plugin_startup       ] starting wallet_api_plugin
    info  2018-11-26T06:54:24.796 thread-0  http_plugin.cpp:554           add_handler          ] add api url: /v1/wallet/create
    info  2018-11-26T06:54:24.796 thread-0  http_plugin.cpp:554           add_handler          ] add api url: /v1/wallet/create_key
    info  2018-11-26T06:54:24.796 thread-0  http_plugin.cpp:554           add_handler          ] add api url: /v1/wallet/get_public_keys

    3、启动nodeos

    nodeos -e -p eosio 
    --plugin eosio::producer_plugin 
    --plugin eosio::chain_api_plugin 
    --plugin eosio::http_plugin 
    -d /home/ubuntu/contracts/eosio/data 
    --config-dir /home/ubuntu/contracts/eosio/config 
    --access-control-allow-origin=* 
    --contracts-console 
    --http-validate-host=false 
    —filter-on=‘*’ >> nodeos.log 2>&1 &

    These settings accomplish the following:

    1. Using a work directory for blockchain data and configuration in eosio directory under the development directory. Here we use eosio/data and eosio/config respectively

    2. Run the Nodeos. This command loads all the basic plugins, set the server address, enable CORS and add some contract debugging and logging.

    3. Enable CORS with no restrictions (*)

      通过以下命令检验是否成功运行nodeos

    tail -f nodeos.log

      如果有以下输出,则成功了。

    1929001ms thread-0   producer_plugin.cpp:585       block_production_loo ] Produced block 0000366974ce4e2a... #13929 @ 2018-05-23T16:32:09.000 signed by eosio [trxs: 0, lib: 13928, confirmed: 0]
    1929502ms thread-0   producer_plugin.cpp:585       block_production_loo ] Produced block 0000366aea085023... #13930 @ 2018-05-23T16:32:09.500 signed by eosio [trxs: 0, lib: 13929, confirmed: 0]
    1930002ms thread-0   producer_plugin.cpp:585       block_production_loo ] Produced block 0000366b7f074fdd... #13931 @ 2018-05-23T16:32:10.000 signed by eosio [trxs: 0, lib: 13930, confirmed: 0]
    1930501ms thread-0   producer_plugin.cpp:585       block_production_loo ] Produced block 0000366cd8222adb... #13932 @ 2018-05-23T16:32:10.500 signed by eosio [trxs: 0, lib: 13931, confirmed: 0]
    1931002ms thread-0   producer_plugin.cpp:585       block_production_loo ] Produced block 0000366d5c1ec38d... #13933 @ 2018-05-23T16:32:11.000 signed by eosio [trxs: 0, lib: 13932, confirmed: 0]
    1931501ms thread-0   producer_plugin.cpp:585       block_production_loo ] Produced block 0000366e45c1f235... #13934 @ 2018-05-23T16:32:11.500 signed by eosio [trxs: 0, lib: 13933, confirmed: 0]
    1932001ms thread-0   producer_plugin.cpp:585       block_production_loo ] Produced block 0000366f98adb324... #13935 @ 2018-05-23T16:32:12.000 signed by eosio [trxs: 0, lib: 13934, confirmed: 0]
    1932501ms thread-0   producer_plugin.cpp:585       block_production_loo ] Produced block 00003670a0f01daa... #13936 @ 2018-05-23T16:32:12.500 signed by eosio [trxs: 0, lib: 13935, confirmed: 0]
    1933001ms thread-0   producer_plugin.cpp:585       block_production_loo ] Produced block 00003671e8b36e1e... #13937 @ 2018-05-23T16:32:13.000 signed by eosio [trxs: 0, lib: 13936, confirmed: 0]
    1933501ms thread-0   producer_plugin.cpp:585       block_production_loo ] Produced block 0000367257fe1623... #13938 @ 2018-05-23T16:32:13.500 signed by eosio [trxs: 0, lib: 13937, confirmed: 0]

    4、使用cleos查看钱包

    cleos wallet list

      你应该看见如下输出:

    Wallets:
    []

    5、可以查看 ~/contracts/eosio/config/config.ini 文件,可以看到默认nodeos端口为8888.

      

      cleos默认通过localhost:8888来连接nodeos。

      可以通过http来发起请求来测试这个端口。

    curl http://localhost:7777/v1/chain/get_info

    参考:

    1、https://developers.eos.io/eosio-home/docs/setting-up-your-environment

    2、https://developers.eos.io/eosio-home/docs/getting-the-software

  • 相关阅读:
    三数之和
    167
    二分搜索树
    687
    索引堆
    二分查找 leetcode704
    leetcode 56合并区间 java
    leetcode 1046
    堆的数据结构java
    leetcode 493
  • 原文地址:https://www.cnblogs.com/tekkaman/p/10026737.html
Copyright © 2020-2023  润新知