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的更多相关文章

  1. Peer-to-Peer (P2P) communication across middleboxes

    Internet Draft                                                   B. FordDocument: draft-ford-midcom- ...

  2. Microsoft.AspNet.SignalR 2.2

    Nuget :http://www.nuget.org/packages/Microsoft.AspNet.SignalR/ What is SignalR? ASP.NET SignalR is a ...

  3. Java性能提示(全)

    http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...

  4. Introduction to SignalR -摘自网络

    What is SignalR? ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of ...

  5. RFC Transactional RFC (tRFC) queue RFC(qRFC) 概念

    Transactional RFC When using transactional RFC (tRFC), the called function module is executed exactl ...

  6. ARVE: Augmented Reality Applications in Vehicle to Edge Networks

    ARVE:车辆到边缘网中的增强现实应用 本文为SIGCOMM 2018 Workshop (Mobile Edge Communications, MECOMM)论文. 笔者翻译了该论文.由于时间仓促 ...

  7. [dev][ipsec] netlink是什么

    介绍: https://www.linuxjournal.com/article/7356 大纲: man手册 http://man7.org/linux/man-pages/man7/netlink ...

  8. HP-Socket v3.2.2

    ==========================================================================================v3.2.2 upg ...

  9. OPENVPN2.3配置文档官方说明

    openvpn Section: Maintenance Commands (8)Index NAME openvpn - secure IP tunnel daemon. SYNOPSIS open ...

随机推荐

  1. java 加密工具类(MD5、RSA、AES等加密方式)

    1.加密工具类encryption MD5加密 import org.apache.commons.codec.digest.DigestUtils; /** * MD5加密组件 * * @autho ...

  2. 编写简单的windows桌面计算器程序

    编译环境:VS2017 主文件为: #include "stdafx.h" #include "WindowsProject5.h" #include &quo ...

  3. 《从Lucene到Elasticsearch:全文检索实战》学习笔记五

    今天我给大家讲讲tf-idf权重计算 tf-idf权重计算: tf-idf(中文词频-逆文档概率)是表示计算词项对于一个文档集或语料库中的一份文件的重要程度.词项的重要性随着它在文档中出现的次数成正比 ...

  4. java.lang.ClassNotFoundException: org.apache.http.conn.UnsupportedSchemeException

    加入了阿里云的消息服务后,就一直之前报java.lang.ClassNotFoundException: org.apache.http.conn.UnsupportedSchemeException ...

  5. react hooks 笔记

    1. 建议安装以上版本: "dependencies": { "react": "^16.7.0-alpha.2", "react ...

  6. terraform 配置github module source

      terraform 支持多种module 的source 配置 以下是一个简单的使用github source的demo 测试项目 项目结构 ├── init.tpl ├── main.tf 代码 ...

  7. Docker之 默认桥接网络与自定义桥接网卡

    docker引擎会默认创建一个docker0网桥,它在内核层连通了其他的物理或虚拟网卡,这就将所有容器和宿主机都放到同一个二层网络. 1. docker如何使用网桥 1.1 Linux虚拟网桥的特点 ...

  8. java 原子性 可见性 有序性

    原子性 原子性是指一个操作或多个操作要么全部执行完成且执行过程不被中断,要么就不执行. 如向变量x赋值操作 x = 10 是原子性的,就不会出现赋值操作进行到一半(x的低16位赋值成功,高16位没有赋 ...

  9. git push 和 pull 时 免密执行的方法

    问题:在使用git代码仓库时,使用git clone 获取代码时,如果使用的是https协议,则在每次push时需要输入账号密码.相关文档:文档一,文档二 验证了文档一种的方法二可用,记录一下创建文件 ...

  10. python开发计算器

    1 业务需求 1.1 用户输入 1 - 2 * ( (60-30 +(-40/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 )) - (-4*3)/ (16- ...