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. 深入理解使用synchronized同步方法和同步代码块的区别

    一.代码块和方法之间的区别 首先需要知道代码块和方法有什么区别: 构造器和方法块,构造器可以重载也就是说明在创建对象时可以按照不同的构造器来创建,那么构造器是属于对象,而代码块呢他是给所有的对象初始化 ...

  2. WEBBASE篇: 第六篇, CSS知识4

    CSS 1.框模型 1.内边距 属性: padding:value; padding-top / right / bottom / left:value; 2.box-sizing 作用:指定框模型的 ...

  3. git 本地分支和远程分支改名字

    1.将本地分支进行改名: git branch -m old_branch new_branch 2.将本地分支的远程分支删除: git push origin :old_branch 3.将改名后的 ...

  4. Python if语句

    a=99 b=input("请输入一个数字:") int(b) if a >b: print("欢迎来到Python") eilf a=b: print( ...

  5. Cache架构设计

    Cache策略 定时过期策略 定时过期的好处是Cache节点的个数符合实际需求,不会造成资源滥用和服务器压力 定时过期适合访问量较大,实时性要求不高的情况 如果访问量小,定时过期会造成Cache命中率 ...

  6. vim编辑Makefile如何使用Tab

    因为用vim编辑代码设置了Tab键为4个空格,但有时候我们需要编写Makefile,必须使用Tab,同时也不想设置set noexpandtab. 其实可以先Ctrl_v组合键,再按Tab键盘,这样我 ...

  7. Google - Find Most People in Chat Log

    1. 给你一个chatting log file,format大概是这样的: A: bla B: bla bla C: bla bla bla 要你找出说话最多(看word number) 的K个人 ...

  8. Transaction rolled back because it has been marked as rollback-only 原因 和解决方案

    产生原因  , 1 serviceA 调用 serviceB 然后 B  抛出异常 ,B 所在的 事物 回滚,B 把当前可写 事物标记成 只读事物 , 2 如果 A 和B 是在 同一个事物环境,并且 ...

  9. Day 08 文件操作模式,文件复制,游标

    with open:将文件的释放交给with管理 with open('文件', '模式', encoding='utf-8') as f:    # 操作    pass​ a模式:追加写入 # t ...

  10. Zuul 跨域

    JS访问会出现跨域问题的解决, 一.对单个接口,处理跨域,只需要在被调用的类或或方法增加注解 CoossOrigin 如下设置 allowCredenticals=true,表示运行Cookie跨域 ...