EOS踩坑记 2

1、--contracts-console

  在开发模式下,需要将 nodeos 添加此选项。

  EOS踩坑记 2-LMLPHP

  EOS踩坑记 2-LMLPHP

2、Debug Method

  The main method used to debug smart contract is Caveman Debugging, where we utilize the printing functionality to inspect the value of a variable and check the flow of the contract.

  原始人调试法(Log 调试法)

  Printing in smart contract can be done through the Print API. The C++ API is the wrapper for C API, so most often we will just use the C++ API.

3、If no optional arguments are used (i.e. --url and --wallet-url), cleos automatically tries to connect to a locally running eos node (i.e. nodeos).

4、nodeos --plugin

--plugin eosio::chain_api_plugin

  也可以在 cofnig.ini 中配置

  EOS踩坑记 2-LMLPHP

plugin = eosio::chain_api_plugin

5、nodeos -h 可以查看 plugin 有哪些option可以设置
  EOS踩坑记 2-LMLPHP

6、cleos system

  EOS踩坑记 2-LMLPHP

  EOS踩坑记 2-LMLPHP

7、p2p-peer-address

  通过 config.ini 中的 p2p-peer-address 可以配置要联接的主网结点,使得当前结点可以加入主网。

  EOS踩坑记 2-LMLPHP

# Default p2p port is
p2p-peer-address = 123.255.78.9:

8、Non-Producing Node

  A non-producing node is a node that is not configured to produce blocks. An example use case would be to provide a synchronized node that provides a public HTTP-RPC API for developers or as a dedicated private endpoint for your app.

  You need to set some peers in your config ini, for example:

    p2p-peer-address = 106.10.42.238:9876

  Or you can include the peer in as a boot flag, like so:

    --p2p-peer-address=106.10.42.238:9876

  只需指定 p2p-peer-address,就这么简单。详情见参考[3]。

9、nodeos 单节点常用选项

    # 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
# 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 history
plugin = eosio::history_api_plugin

10、EOSIO Core Network

  EOS踩坑记 2-LMLPHP

11、EOSIO Access Network

  EOS踩坑记 2-LMLPHP

  1)API Node

    API nodes handle requests from cleos to perform transactions and query state. API nodes communicate with cleos via http, and with other nodeos nodes using the EOSIO networking protocols.

    Each producer node should have at least one associated API node.

  2)Seed Node

    Seed nodes communicate with other nodeos nodes in order to maintain synchronization with the producer nodes. Seed nodes might be producer candidates that are maintaining synchronization with producers and servicing other nodes.

    Each producer node should have at least one associated seed node.

12、EOSIO Consumer Network

  

参考:

1、https://developers.eos.io/eosio-cpp/docs/debugging

2、https://developers.eos.io/eosio-nodeos/docs/environment-producing-node

3、https://developers.eos.io/eosio-nodeos/docs/environment-non-producing-node

04-14 02:47