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。由於上邊這兩個智能合約一句話兩句話說不清楚,所以我們先把他加載進來,回頭具體使用的時候,咱們再仔細聊。

先水一節,下一節先講角色權限哈……

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM