每天进步一点点:使用cleos 广播事务

in cn •  5 years ago 

最近需要执行一些EOS上的操作,但是遗憾的cleos并不支持直接进行这类操作,于是就想该如何让cleos能完成这项任务呢?


(图源 :pixabay)

为了方便,我们已转账为例,cleos支持如下转账命令

cleos transfer [OPTIONS] sender recipient amount [memo]

但是对其它命令而言,并不存在transfer这个指令,该如何去用cleos执行呢?

我注意到cleos中有如下一条指令:

push Push arbitrary transactions to the blockchain

中文解释为将任意事务推到区块链,也就是说可以推包括transfer在内的诸多事务啦。

查看以下push的详情:

也就是说,通过push指令,我们可以推送action、transaction、transactions到EOS区块链。

查看以下cleos push transaction的帮助:

cleos push transaction --help

也就是说我们需要将transaction弄成JSON字符串或者放到一个文件里:

再次以transfer为例,我弄了包含如下内容的文件:

然后再调用如下指令就可以啦(-d表示不广播,只测试):

cleos transaction -d -j trans_file

返回结果如下:

想实际广播的话,去掉-d就可以啦。

尽管我们只是测试转账,但是对其它事务而言都是一样的,只要我们写出正确的JSON文件就可以啦,是不是非常简单啊?


Vote For Me As Witness
https://steemit.com/~witnesses type in oflyhigh and click VOTE

Vote @oflyhigh via Steemconnect
Thank you!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
  ·  5 years ago 

!thumbup
恭喜你!您的这篇文章入选 @justyy 今日 (2019-12-20) 榜单 【优秀的文章】, 回复本条评论24小时内领赏,点赞本评论将支持 @dailychina 并增加将来您的奖赏。
@justyy 是CN区的见证人,请支持他,给他投票,或者设置justyy为见证人代理。感谢!@justyy的主要贡献:https://steemyy.com

Congratulations! This post has been selected by @justyy as today's (2019-12-20) 【Good Posts】, Steem On! Reply to this message in 24 hours to get rewards. Upvote this comment to support the @dailychina and increase your future rewards! ^_^

SteemIt 工具、API接口、机器人和教程
SteemIt Tools, Bots, APIs and Tutorial



If you believe what I am doing, please consider a spare vote voting me here, thank you very much indeed.

@justyy - the author of https://SteemYY.com and I have been a Steem Witness for more than a year now.

我这电脑盲十分羡慕你们会编程的能人!

来自于 [WhereIn Android] (http://www.wherein.io)

  ·  5 years ago 

厉害,佩服得不行。
!shop

  ·  5 years ago 

你好鸭,O哥!

@cnfund给您叫了一份外卖!

@lovelemon 拧萌 迎着飓风 徒步 给您送来
Hot chicken flavor ramen

吃饱了吗?跟我猜拳吧! 石头,剪刀,布~

如果您对我的服务满意,请不要吝啬您的点赞~
@onepagex

  ·  5 years ago 

  ·  5 years ago 


You lose! 你输了!乖乖的给我点赞吧!