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 ...
随机推荐
- switch和数组两种方法对不同输入做不同响应
#include<stdio.h> int main(void) { int i; scanf("%d",&i); switch(i) { : printf(& ...
- spring boot 1.4 整合 mybatis druid
http://www.jianshu.com/p/cef49ad91ba9spring boot 1.4 整合 mybatis druid
- php 图片缩放然后合成并保存
/** * 功能说明 * 将files/model_24/images/下的所有图片文件进行等比例缩放 到$image40w 尺寸 然后放到files/model_24/model.png图片的指定位 ...
- hsdfz -- 6.16 -- day1
恩这回不写游记了 按照老师要求记录今天的心里路程:这题似乎可做期望得分150->日部分分似乎不是很显然->a题似乎是结论题,大力猜一波结论->过不了样例,先看b题->b题动态树 ...
- Nginx中文url出现404问题
Nginx中文url出现404问题 前提条件检查,如我的系统centos,需要检查系统字符集是不是支持utf-8, 怎么配置可以参考这个帖子 https://www.vpser.net/manage/ ...
- 为什么我们不要 .NET 程序员
英文原文:Why we don’t hire .NET programmers,编译:外刊IT评论 http://blog.jobbole.com/10389/ 也许你已经知道了,我们正在招聘最优秀的 ...
- docker容器内存占用 之 系统cache,docker下java的内存该如何配置
缘起: 监控(docker stats)显示容器内存被用完了,进入容器瞅了瞅,没有发现使用内存多的进程,使用awk等工具把容器所有进程使用的内存加起来看看,距离用完还远了去了,何故? 分析: 该不会d ...
- 查询 SQL_Server 所有表的记录数: for xml path
--我加了 top 10 用的时候可以去掉 declare @select_alltableCount varchar(max)='';with T as (select top 10 'SELECT ...
- python网页爬虫开发之二
1.网站robots robotparser模块首先加载robots.txt文件,然后通过can_fetch()函数确定指定的用户代理是否允许访问网页. 2.识别网站技术 3.下载网页 使用urlli ...
- JS基础——变量
引用类型:对象 数组 函数 }; var b =a ; b.age = ; console.log(a.age);// 21 传递的是地址, a,b同地址 值类型: var a =100; var ...