这篇“EOS推送操作怎么实现”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“EOS推送操作怎么实现”文章吧。
根据合约ABI,消息应该是合约。
例如,货币合约的ABI被构造如下。
$ cleos get code -a currency.abi currency
code hash: 9b9db1a7940503a88535517049e64467a6e8f4e9e03af15e9968ec89dd794975
saving abi to currency.abi
$ cat currency.abi
{
"types": [{
"newTypeName": "AccountName",
"type": "Name"
}
],
"structs": [{
"name": "transfer",
"base": "",
"fields": {
"from": "AccountName",
"to": "AccountName",
"amount": "UInt64"
}
},{
"name": "account",
"base": "",
"fields": {
"account": "Name",
"balance": "UInt64"
}
}
],
"actions": [{
"action": "transfer",
"type": "transfer"
}
],
"tables": [{
"table": "account",
"indextype": "i64",
"keynames": [
"account"
],
"keytype": [],
"type": "account"
}
]
}
从上面的abi中,我们可以看到货币合约接受一个叫做transfer的操作,它接受带有from,to和amount字段的消息。
$ ./cleos push message currency transfer '{"from":"currency","to":"tester","amount":50}' -S currency -S tester -p currency@active
1589302ms thread-0 main.cpp:271 operator() ] Converting argument to binary...
1589304ms thread-0 main.cpp:290 operator() ] Transaction result:
{
"transaction_id": "1c4911c0b277566dce4217edbbca0f688f7bdef761ed445ff31b31f286720057",
"processed": {
"refBlockNum": 1173,
"refBlockPrefix": 2184027244,
"expiration": "2017-08-24T18:28:07",
"scope": [
"currency",
"tester"
],
"signatures": [],
"messages": [{
"code": "currency",
"type": "transfer",
"authorization": [{
"account": "currency",
"permission": "active"
}
],
"data": {
"from": "currency",
"to": "tester",
"quantity": 50
},
"hex_data": "00000079b822651d00000000c84267a13200000000000000"
}
],
"output": [{
"notify": [{
"name": "tester",
"output": {
"notify": [],
"sync_transactions": [],
"async_transactions": []
}
}
],
"sync_transactions": [],
"async_transactions": []
}
]
}
}
以上就是关于“EOS推送操作怎么实现”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注亿速云行业资讯频道。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:https://my.oschina.net/u/3837977/blog/1915866