EOS WiKi Bilingual News & Info Of EOS, Vote for us: eosdotwikibp

EOSIO工具包更新—Demux v4.0—新REST API,确认时触发Effect、支持更多的EOSIO动作/EOSIO Toolkit Update: Demux v4.0 — New RestAPI, Triggering Effect Confirmations, and more EOSIO Action Support

E

译文/Translated:

作为开发和增强EOSIO软件的一员,我们高兴地证实将为Demux v4.0发布一个新的稳定的版本,这将大幅度扩展库中提供给EOSIO开发者的功能。您可以在GitHub存储库中找到关于更多Demux的细节。

在EOSIO区块链平台上开发的一个主要好处是它能够带来更多可用、可规模化、并且灵活的应用。虽然区块链开发可能很复杂,但开发者转移到EOSIO区块链平台的一个主要原因在于它使用简单,其开发方式和其它非区块链开发平台又极其相似。这方面的例子包括常见的C++等智能合约引擎开发软件、灵活的权限系统、开发者一系列工具如EOSIO.CDT和Demux。

Demux是什么?

去年七月,就在我们发布EOSIO之后不久,我们旋即推出了Demux,这是一个针对EOSIO社区的开源开发工具,这个工具可以简化复杂的区块链应用开发过程。

如果你还是不熟悉,这么说吧,Demux是一个开源库,它提供了创建链下的确定数据库的建议体系结构。其灵感来源是脸书的Flux Architecture模式和Redux,从而建立了一个后端的基础设施模式,用以定位区块链活动,最终为EOSIO区块链上的应用更新可查询的数据库。

对于在EOSIO上的开发者来说,这个功能是非常强大的,因为它允许你继续用传统的Mongo或者Postgres SQL数据库,但里面存储的数据可以被区块链验证。这个做法可以说两全其美:传统数据库的灵活和速度终于和区块链的可靠性和不可变更性结合在一起了。

Demux v4.0的更新

从它发布以来,过去几个月的时间里Demux库一直有几次更新,但是现在它终于到了可以脱离EOSIO核心,拥有自己发布周期的时候了。随着我们继续扩展和加强Demux的功能性,我们会继续根据其发布日程对其进行更新,正如我们每个月对EOSIO所做的更新一样。

新的Demux Rest API

在Demux的4.0版本中,我们引入一个新的REST API,使其能够更好地以独立环境形式运行。这个REST API让应用额能够利用一个端点和Demux联系,使开发者能够开始/暂停Demux实例的同时更新应用,来更好地处理错误、引入新的功能,而不需要结束进程。在这个更新之前,如果你想修改你的Demux实例,你就必须停止服务运行来做更新,但这就限制了你更新应用的灵活性和速度。

您可以在发布之后看到更多变化细节,比如我们使用ExpressActionWatcher而不是BaseActionWatcher,通过这个,你可以获得一个端点来开始/暂停/获取正在运行的的Demux实例信息。我们还去掉了AbstractActionReader 上的maxHistoryLength,它基于不可逆转的区块自动优化历史长度。这些更新为未来更加活跃的开发经历奠定基础,也让我们后文要详细探讨的一些新功能成为可能。

确认时触发Effect

Demux一个特别有用的功能是Effect,它能根据区块链数据发生的事情触发非区块链活动。比如说,在区块链上写一些东西的时候发送邮件或者通知。

Effect虽然一直都有这个功能,但是在Demux 4.0版本中,我们扩展其功能,现在它可以基于不可逆转的区块被触发,且不是预先设置的。本质上来说,这个新功能会把应用先要运行的一系列效果都记录在内存中,当区块变得不可逆转时,它就会执行该动作。这就让你对开发过程拥有更颗粒化的控制,并在进行下一步动作前明确确认您的动作已经被执行且被记录在区块链中。

一个简单的例子就可以看到它的作用:在代币转账应用中,你可以提醒用户转账正在进行,几秒钟之后再发一个通知告知交易已经确认。

Demux中内联和延迟EOSIO动作

最后,我们和MongoDB 的EOSIO插件进行了更紧密的集成,我们利用的工具是demux-js-eos,它可以让区块充满活动和交易。Demux的核心是一个mongo活动读取器,它可以创建一个确定的链下数据库。这个功能被扩展成包含内联和延迟动作。

完整的发布细节可以在Demux的官方GitHub存储库中查看。如果你在应用中有用到Demux库,那么你就更应该查看很多突破性的变化。库demux-js的例子可用来说明Demux建筑的NodeJS应用。

联系我们

如果您愿意提供反馈和我们的团队一起为社区改进EOSIO,您可以发邮件到developers@block.one给我们的开发者关系小组。

你还可以通过在EOSIO开发者文档订阅我们的邮件获得未来的更新提醒。我们希望能够为开发者不断改进EOSIO软件平台的可用性,同时我们也会继续为空间中区块链发展不断奠定基础。


Block.one作为EOSIO社区的一员是以志愿形式为社区贡献力量,我们不负责保证该软件及相关应用的的整体运行情况。我们不代表、担保、确保和许诺这里提到的发布事宜、相应的GitHub发布事宜或者整个EOSIO软件,不管是明确陈述还是暗示,因此我们不对带着任何目的使用该软件而导致的任何情况承担任何责任。标题:


原文/Original:

As a contributor to the development and enhancement of the EOSIO software, we are pleased to confirm a new stable release for Demux, v4.0 which greatly expands the features available in the library to developers building on EOSIO. You can find more detail about Demux in its GitHub repository.

One of the primary benefits of building on the EOSIO blockchain platform is the ability to create more usable, scalable, and flexible applications. While blockchain development can be difficult, one of the primary reasons developers are migrating to the EOSIO blockchain platform is its ease of use and parallels to familiar development practices used in non blockchain development. Examples of this include familiar smart contract development languages like C++, flexible permissions systems, and a number of tools in development like EOSIO.CDT and Demux.

What is Demux?

In July last year, shortly after the release of EOSIO, we announced Demux, a new open-source development tool for the EOSIO community that simplifies complex blockchain application development.

If you aren’t already familiar, Demux is an open source library that provides a suggested architecture for creating a deterministic database off-chain that is verified by an EOSIO blockchain implementation. It draws inspiration from Facebook’s Flux Architecture pattern and Redux, creating a back-end infrastructure pattern for sourcing blockchain events in order to deterministically update queryable databases for applications built on the EOSIO blockchain.

This is incredibly powerful for application developers building on EOSIO because it allows you to use traditional Mongo or Postgres SQL databases in a way that makes the data stored in them verifiable by the blockchain. This practice enables the best of both worlds: the flexibility and speed of traditional databases, coupled with the trust and immutable properties of a blockchain.

Demux v4.0 Updates

There have been a number of updates in the past few months to the Demux library since it was released, but it has reached a point where it will start having its own release cycle independent of EOSIO core. We will continue to provide updates on its release schedule similar to the updates we provide each month for EOSIO as we continue to expand and strengthen functionality for Demux.

New Demux REST API

In Demux v4.0 we’ve introduced a new REST API that makes it easier to operate demux as a standalone environment. The REST API allows applications to interact with Demux using an endpoint — giving developers the ability to start / pause their Demux instance while making updates to better handle errors and introduce new functionality in their application without having to shut down the process. Prior to this update, if you wanted to modify your demux instance, you had to stop the service from running and make updates limiting the flexibility and speed at which you can update your application.

There are a number of changes you can read about in more detail in the release like the ExpressActionWatcher being used instead of the BaseActionWatcher which exposes an endpoint that allows you to start, pause, and get info about the running demux instance. We have also removed `maxHistoryLength` on AbstractActionReader — which allows for history length to be automatically optimized based on the last irreversible block. These updates make for a more robust development experience with Demux and enable new features which we will go into in more detail below.

Effect Triggers on Confirmation

One of the most useful features of Demux are Effects, the ability to trigger non blockchain actions based on things that happen with blockchain data. For example, sending an email or pushing a notification when something is written to the blockchain.

While this has been always available through Effects, in Demux v4.0 we have extended this functionality to allow for Effects to be fired based on irreversible blocks, and not beforehand. Essentially the new functionality will keep a list in memory of effects that an application wants to run and when blocks become irreversible, it will execute the actions. This allows for more granular control in your development and definite confirmation that your action has been executed and written in stone on the blockchain before taking further action.

A simple example of where this is useful could be seen in a token transfer application where you want to notify a user that a transfer is pending and then moments later push a second notification that the transfer is confirmed.

Inline and Deferred EOSIO Actions in Demux

Finally, we have made a tighter integration with the MongoDB plugin for EOSIO using demux-js-eos that populates blocks with actions and transactions. The core of Demux is a mongo action reader that creates a deterministic off-chain database. This functionality has been extended to include inline and deferred actions.

The full details of the release can be viewed in the official GitHub repositoryfor Demux. There are a number of breaking changes to be reviewed in more detail if you are using the Demux library in your application. The example library demux-js serves as a reference NodeJS implementation of Demux architecture.

Stay Connected

If you are interested in providing feedback and working more closely with our team to improve the EOSIO software for developers, you can send our developer relations team an email at developers@block.one.

You can also stay up to date on future updates by subscribing to our mailing list on the EOSIO Developer Portal. We are excited to be continually improving the usability of the software for EOSIO developers as we continue laying a foundation for the mass adoption of blockchain technology.


Disclaimer

Block.one makes its contribution on a voluntary basis as a member of the EOSIO community and is not responsible for ensuring the overall performance of the software or any applications related thereto. We make no representation, warranty, guarantee or undertaking in respect of the releases described herein and the related GitHub release or the EOSIO software, whether expressed or implied, and disclaim all liability that may arise from any use of the software for any purpose.

原文链接/Original URL:

https://medium.com/eosio/eosio-toolkit-update-demux-v4-0-f1a5724c2c2a

About the author

By user
EOS WiKi Bilingual News & Info Of EOS, Vote for us: eosdotwikibp

Recent Posts