EOS开发基础之六:使用cleos命令行客户端操作EOS——智能合约之eosio.msig和eosio.system

上一节我们搞了老半天,也没整明白Exchange这个合约到底干啥用的。就它官方提供的说法,是用于货币的创造和交易。我没整明白,所以去看了下代码,发现代码头文件里面有下面这段话:

This contract enables users to create an exchange between any pair of standard currency types. A new exchange is created by funding it with an equal value of both sides of the order book and giving the issuer the initial shares in that orderbook.
 
To prevent exessive rounding errors, the initial deposit should include a sizeable quantity of both the base and quote currencies and the exchange shares should have a quantity 100x the quantity of the largest initial deposit.
Users must deposit funds into the exchange before they can trade on theexchange.
 
Each time an exchange is created a new currency for that exchanges market maker is also created. This currencies supply and symbol must be unique and it uses the currency contract's tables to manage it.
 
用百度翻译看了一下,没明白什么意思。但是我知道它会被应用在不同类型的货币交换过程中,而且这互换过程发生之前需要创建互换货币之间的汇率关系,搞不懂搞不懂。也就是说我们基本上暂时是用不到了。那就先放着吧,以后遇到再说。
 
接下来我们来看看两个比较重要的合约——eosio.msig和eosio.system
 
4、eosio.msig
这个合约用于多用户签名和用户权限管理用的,需要在实际应用中才能看出效果。我们先load它进来吧。

如上图中,我发现了一个新秘密——直接使用./cleos wallet create_key这个命令,可以将./cleos create key./cleos wallet import ${private_key}两个命令合成一个。

这样,我们就把eosio.msig这个厉害得不行的智能合约加载进来了。

下边我们也把eosio.system加载进来吧。

 

5、eosio.system

这个叫系统智能合约,通过这个智能合约,可以进行很多系统级别的操作,比如用户投票、将用户注册成为生产者等,功能强大到不行,以后我们会经常用到。

同样的节奏:

 

可是,到正式加载eosio.system智能合约的时候,它告诉我说超时了!

居然超时?多来几遍试试?

疯了,我们用了各种姿势,结果都是一样的说这玩意儿超时了。

看来,真的是超时了。

既然超时了,那咱们让它不超时不就得了嘛?

切换到nodeos命令行窗口,暂停运行程序,输入下面命令回车:

./nodeos -e -p eosio --max-transaction-time=1000

咦?!死锅咦……

怎么弄都可以了。

 

后话:这两天去研究EOS正式版了,刚刚上边的程序也跑的EOSIO V1.0.3。由于上边这两个智能合约一句话两句话说不清楚,所以我们先把他加载进来,回头具体使用的时候,咱们再仔细聊。

先水一节,下一节先讲角色权限哈……

 

 

posted on 2018-06-14 19:17  paluano  阅读(1905)  评论(2编辑  收藏  举报