EOS合约开发第三章-程序和工具集

程序和工具集

一、EOSIO包含以下程序和工具

程序:

  • nodeos
  • cleos
  • keosd
  • launcher
  • snapshot

工具:

  • Eosiocpp

二、nodeos

OSIO核心守护进程,可以配置插件来运行一个EOS节点。包含以下可配置项:

1. 插件eosio::chain_api_plugin
支持chain的RPC API
2. 插件eosio::wallet_api_plugin
开启wallet功能,支持wallet的RPC API
3. http-server-address
指定RPC API查询ip,默认启动则开启8888端口
4. p2p-listen-endpoint
指定等待其他节点连接自己的监听ip,默认则开启9876端口
5. p2p-peer-address
指定本节点接入到EOS网络中其他节点的ip
6. data-dir
节点运行时数据目录,默认情况下:

Mac OS: ~/Library/Application Support/eosio/nodeos/config
Linux: ~/.local/share/eosio/nodeos/config
7. config-dir
节点启动时配置目录,默认情况下:

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

三、cleos

cleos是一个和nodeos的REST API接口交互的命令行,运行时需要指定nodeos运行实例的ip地址和端口,并且nodeos需要配置成加载‘eosio::chain_api_plugin’插件。

Cleos包含了它所有命令的使用文档,使用以下命令可以查看cleos支持的所有命令列表:

[kingnet@bctestnode3 cleos]$ ./cleos

ERROR: RequiredError: Subcommand required

Command Line Interface to EOSIO Client

Usage: ./cleos [OPTIONS] SUBCOMMAND

 

Options:

  -h,--help                   Print this help message and exit

  -H,--host TEXT=localhost    the host where nodeos is running

  -p,--port UINT=8888         the port where nodeos is running

  --wallet-host TEXT=localhost

                              the host where keosd is running

  --wallet-port UINT=8888     the port where keosd is running

  -v,--verbose                output verbose actions on error

 

Subcommands:

  version                     Retrieve version information

  create                      Create various items, on and off the blockchain

  get                         Retrieve various items and information from the blockchain

  set                         Set or update blockchain state

  transfer                    Transfer EOS from account to account

  net                         Interact with local p2p network connections

  wallet                      Interact with local wallet

  sign                        Sign a transaction

  push                        Push arbitrary transactions to the blockchain

 

如果想获得特定子命令的帮助,只需要使用无参数运行它:

[kingnet@bctestnode3 cleos]$ ./cleos create

ERROR: RequiredError: Subcommand required

Create various items, on and off the blockchain

Usage: ./cleos create SUBCOMMAND

 

Subcommands:

  key                         Create a new keypair and print the public and private keys

  account                     Create a new account on the blockchain

[kingnet@bctestnode3 cleos]$ ./cleos create account

ERROR: RequiredError: creator

Create a new account on the blockchain

Usage: ./cleos create account [OPTIONS] creator name OwnerKey ActiveKey

 

Positionals:

  creator TEXT                The name of the account creating the new account

  name TEXT                   The name of the new account

  OwnerKey TEXT               The owner public key for the new account

  ActiveKey TEXT              The active public key for the new account

 

Options:

  -x,--expiration             set the time in seconds before a transaction expires, defaults to 30s

  -f,--force-unique           force the transaction to be unique. this will consume extra bandwidth and remove any protections against accidently issuing the same transaction multiple times

  -s,--skip-sign              Specify if unlocked wallet keys should be used to sign transaction

  -j,--json                   print result as json

  -d,--dont-broadcast         don't broadcast transaction to the network (just print to stdout)

  -p,--permission TEXT ...    An account and permission level to authorize, as in 'account@permission' (defaults to 'creator@active')

  --max-cpu-usage UINT        set an upper limit on the cpu usage budget, in instructions-retired, for the execution of the transaction (defaults to 0 which means no limit)

  --max-net-usage UINT        set an upper limit on the net usage budget, in bytes, for the transaction (defaults to 0 which means no limit)

四、keosd

一个EOSIO钱包守护进程,加载钱包相关的插件,如HTTP interface,RPC API。包含以下配置项:

1. http-server-address
钱包RPC API查询ip,默认情况下为8888端口

五、launcher

该程序简单的部署多个nodeos节点到网络上,它可以通过CLI进行配置以组成每个节点的配置文件,然后安全的分发这些文件,启动多个nodeos实例。

六、snapshot

引用EOSIO/genesis存储库的子模块,其中包含用于从众包协议生成快照的nodejs应用程序,用于配置生成块和其他生成相关工具的Web GUI

七、eosiocpp

Eosiocpp用于生成ABI规范文件,通过检查智能合约源代码中声明的类型来生成ABI规范文件。

 如果需要指定一个类型必须被导出到ABI,在类型声明时需要声明为@abi,语法如下:

l @abi action [name name2 .... nameN]

l @abi table [index_type name]

同时要生成ABI文件,还必须使用-g参数执行eosiocpp。

eosiocpp -g abi.json types.hpp

Generated abi.json ...

eosiocpp也可以用于生成序列化和反序列化ABI中定义的类型的帮助函数

Eosiocpp -g abi.json -gs types.hpp

Generated abi.json ...

Generated types.gen.hpp ...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值