Communication Model
【Communication Model】
EOSIO actions operate primarily in a message-based communication architecture. A client invokes actions by sending (pushing) messages to nodeos. This can be done using the cleos command. It can also be done using one of the EOSIO send methods (e.g., eosio::action::send).
nodeos dispatches action requests to the WASM code that implements a contract. That code runs in its entirety, then processing continues to the next action.
EOSIO supports two basic communication models, inline and deferred.
1、An operation to perform within the current transaction is an example of an inline action,
2、while a triggered future transaction is an example of a deferred action.
Communication among contracts should be considered as occurring asynchronously.
1、Inline Communication
Inline actions operate with the same scopes and authorities of the original transaction, and are guaranteed to execute with the current transaction.
These can effectively be thought of as nested transactions within the calling transaction. If any part of the transaction fails, the inline actions will unwind with the rest of the transaction. Calling the inline action generates no notification outside the scope of the transaction, regardless of success or failure.
2、Deferred Communication
Deferred actions get scheduled to run, at best, at a later time, at the producer's discretion. There is no guarantee that a deferred action will be executed.
The transaction that creates the deferred transaction, it can only determine whether the create request was submitted successfully or whether it failed (if it fails, it will fail immediately).
【Transactions VS. Actions】
An action represents a single operation, whereas a transaction is a collection of one or more actions. 交易是 actions 的集合。
A contract and an account communicate in the form of actions.
Transaction with one action:
{
"expiration": "2018-04-01T15:20:44",
"region": ,
"ref_block_num": ,
"ref_block_prefix": ,
"net_usage_words": ,
"kcpu_usage": ,
"delay_sec": ,
"context_free_actions": [],
"actions": [{
"account": "eosio.token",
"name": "issue",
"authorization": [{
"actor": "eosio",
"permission": "active"
}
],
"data": "00000000007015d640420f000000000004454f5300000000046d656d6f"
}
],
"signatures": [
""
],
"context_free_data": []
}
Transaction with multiple actions, these actions must all succeed or the transaction will fail:
{
"expiration": "...",
"region": ,
"ref_block_num": ...,
"ref_block_prefix": ...,
"net_usage_words": ..,
"kcpu_usage": ..,
"delay_sec": ,
"context_free_actions": [],
"actions": [{
"account": "...",
"name": "...",
"authorization": [{
"actor": "...",
"permission": "..."
}
],
"data": "..."
}, {
"account": "...",
"name": "...",
"authorization": [{
"actor": "...",
"permission": "..."
}
],
"data": "..."
}
],
"signatures": [
""
],
"context_free_data": []
}
Action Name Restrictions
Action types are actually base32 encoded 64-bit integers. This means they are limited to the characters a-z, 1-5, and '.' for the first 12 characters. If there is a 13th character then it is restricted to the first 16 characters ('.' and a-p).
Transaction Limitations
Every transaction must execute in 30ms or less. If a transaction contains several actions, and the sum of these actions is greater than 30ms.
【Action Handlers and Action "Apply" Context】

Actions operate within transactions; if a transaction fails, the results of all actions in the transaction must be rolled back.
An action can have many side effects. Among these are:
- Change state persisted in the EOSIO persistent storage
- Notify the recipient of the current transaction
- Send inline action requests to a new receiver
- Generate new (deferred) transactions
- Cancel existing (in-flight) deferred transactions (i.e., cancel already-submitted deferred transaction requests)
参考:
1、https://developers.eos.io/eosio-cpp/docs/communication-model
Communication Model的更多相关文章
- Peer-to-Peer (P2P) communication across middleboxes
Internet Draft B. FordDocument: draft-ford-midcom- ...
- Microsoft.AspNet.SignalR 2.2
Nuget :http://www.nuget.org/packages/Microsoft.AspNet.SignalR/ What is SignalR? ASP.NET SignalR is a ...
- Java性能提示(全)
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...
- Introduction to SignalR -摘自网络
What is SignalR? ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of ...
- RFC Transactional RFC (tRFC) queue RFC(qRFC) 概念
Transactional RFC When using transactional RFC (tRFC), the called function module is executed exactl ...
- ARVE: Augmented Reality Applications in Vehicle to Edge Networks
ARVE:车辆到边缘网中的增强现实应用 本文为SIGCOMM 2018 Workshop (Mobile Edge Communications, MECOMM)论文. 笔者翻译了该论文.由于时间仓促 ...
- [dev][ipsec] netlink是什么
介绍: https://www.linuxjournal.com/article/7356 大纲: man手册 http://man7.org/linux/man-pages/man7/netlink ...
- HP-Socket v3.2.2
==========================================================================================v3.2.2 upg ...
- OPENVPN2.3配置文档官方说明
openvpn Section: Maintenance Commands (8)Index NAME openvpn - secure IP tunnel daemon. SYNOPSIS open ...
随机推荐
- 公共表达式消除(UVa 12219)
紫书354页的题,将表达式树进行公共表达式消除,化为等价的图.因为需要判断某一个是否出现过,所以需要快速比较,采用哈希表的形式,将a~b与1~27一一对应,不采用0,因为0与0000是相同的,对于每一 ...
- 仿QQ菜单栏:消息,电话菜单
转载自:http://blog.csdn.net/johnnyz1234/article/details/45919907 在实际项目开发使用Fragment的时候,也碰到一些异常和存在的问题,下面做 ...
- istream不是std的成员
如果报错信息为:istream不是std的成员,那么有两种可能 1.没有包含iostream库文件 2.#ifndef 和#endif使用错误,致使包含的iostream的头文件没有被主函数包含
- ThinkPHP模板的知识
php框架 一.真实项目开发步骤: 多人同时开发项目,协作开发项目.分工合理.效率有提高(代码风格不一样.分工不好) 测试阶段 上线运行 对项目进行维护.修改.升级(单个人维护项目,十分困难,代码风格 ...
- ANSI编码导致的乱码
美帝那边的一个 donet 项目,打开后发现一段string里面各种乱码.一通折腾后发现是编码格式问题.这段string所在的类文件保存格式为ANSI,而不是VS默认的UTF-8. ANSI编码电脑是 ...
- CSS之a标签锚点
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- android AES 加密解密
import java.security.Provider; import java.security.SecureRandom; import javax.crypto.Cipher; import ...
- Linux集群之keepalive+Nginx
集群从功能实现上分高可用和负载均衡: 高可用集群,即“HA"集群,也常称作“双机热备”. 当提供服务的机器宕机,备胎将接替继续提供服务: 实现高可用的开源软件有:heartbeat.keep ...
- iOS开发SDWebImageOptions理解
iOS开发SDWebImageOptions理解 原文 http://www.cnblogs.com/WJJ-Dream/p/5816750.html typedef NS_OPTIONS(NSUIn ...
- (转)SqlServer2008 数据库同步:发布、订阅
原文地址:http://www.cnblogs.com/tyb1222/archive/2011/05/31/2064944.html 发布订阅份为两个步骤:1.发布.2订阅.首先在数据源数据库服务器 ...