News.EOS.WiKi Bilingual News & Info Of EOS

eosfinex智能合约插件——管理用户与智能合约之间的互动/The eosfinex Smart Contract Plugin——Organizing interactions between user & smart contract

e

译文/Translated:

随着eosfinex问世之日的临近,我们每周报道继续关注eosfinex内的各类研发项目。

今天我们要介绍eosfinex插件,作为eosfinex架构内不可或缺的一部分,该插件让用户能快速且直观地与匹配引擎互动。

我们将在接下来的内容中通过高层次的概述来介绍eosfinex插件如何与智能合约互动。此外,我们将讲到使用该插件签署交易的两种不同的方式。最后,我们将介绍客户连接的管理方式以及为了以最有效的方式管理大量连接我们所做的决定。

eosfinex插件旨在管理用户和作为eosfinex基础的智能合约之间的互动。

用户可以使用该项插件从EOS区块链上提取和收集详细信息。此外,eosfinex插件能让客户以相对简单的方式发送/接受市场请求,免去了进入该相关领域的主要障碍。

我们的最终目标是让每个人,无论他们拥有何种经验水平和专业程度都能够与eosfinex和EOS区块链进行互动。

eosfinex插件的主要优势在于它让API的使用与现存Bitfinex API十分相似,让现有客户能够简单地调整自身交易设置,使其适用于eosfinex。

用户可通过WebSocket协议连接至该插件,接受市场数据和发送请求,以此处理或取消eosfinex上的订单。

这里的API与Bitfinex的极为相似,但有一处主要的差别。在建立最初连接时,用户可选择通过密钥在登录时操作(凭此该插件将会签署该用户发送的所有交易)或者自己签署交易后发送给该插件。后者是最安全的方式,因为不存在密钥泄露的潜在风险。

模拟的互动流程图(客户-插件-智能合约)如下:

图1 客户与智能合约间的互动总览

依据当前活跃用户数,可使用不同数量的插件,以减少延迟并提升系统的吞吐量。

如前面所述,我们将仔细讲解该插件的内部运作。

下图展示了插件与智能合约以及连接用户之间的互动:

This image has an empty alt attribute; its file name is 1*bERHKiQlHPSAp0Yq24T-Bw.png
图二eosfinex插件总览

图二清楚地显示了,每一位客户所接受的交易信息都有自身的缓冲器。这便确保了单一客户无法使用主机的所有运算资源,并且不会影响其他用户。

客户请求经过解析后被传送至(若有必要)eosfinex智能合约。一旦接收到智能合约的回应,它将会与交易信息、市场数据及钱包更新一起直接被送至用户处。由此,我们便可确保为连接客户提供高性能低延迟的服务体验。

作为一款提供链上交易体验的服务,eosfinex将推动点对点价值交易的高扩展性网络的建立,不受边界束缚,其构建基础拥有透明、快速及完整等特性。

在以下媒体上关注最新研发成果以及我们2019年3月的发布内容。

原文/Original:

As we approach the upcoming launch of eosfinex, we continue with our weekly series looking at various developments taking place within eosfinex.

Today we introduce the eosfinex plugin — an integral piece in our architecture — which allows users to interact with the matching engine in a fast and intuitive way.

In the following article we walk through a high-level overview of how the eosfinex plugin interacts with the smart contract. Additionally, we take a look at the two different ways of signing transactions using the plugin. Finally, we take a look at how client connections are handled and what decision we made to handle a large number of connections in the most efficient way possible.

The eosfinex plugin is designed to organize interactions between the user and smart contract that that act as the foundation of eosfinex.

The use of the plugin allows users to abstract and collect details from the EOS blockchain. Additionally, the eosfinex plugin allows users to send/receive market requests in a relatively simplistic manner, removing otherwise significant barriers to entry associated with this area.

Our ultimate goal is to allow anyone, regardless of their levels of experience and expertise, to interact with eosfinex and the EOS blockchain.


A major advantage of the eosfinex plugin is that it will make use of an API very similar to the existing Bitfinex API, making it simple for existing clients to modify their trading setups to suit eosfinex.

Users can connect to the plugin via a WebSocket protocol to receive market data and send requests for placing and canceling orders across eosfinex.

The API is very similar to that of Bitfinex, with one significant difference. When the initial connection is established, the user has the choice of either passing his secret key during the login operation, upon which the plugin will sign all transactions that the user sends, or the client can sign transactions on their side and send them to the plugin. The latter option is the most secure as there is no potential possibility for the secret key to be disclosed to other users.

The scheme of interaction (client — plugin — smart contract) can be modeled as follows:

Figure 1. Overview of the interaction between client and smart contract

Depending on the current number of active users, a different number of plugins can be used to reduce latency and increase system throughput.


As mentioned before, we’ll now take a closer look at the inner workings of the plugin.

The following diagram shows the interaction of the plugin with the smart contract and connected users:

Figure 2. Overview of the eosfinex plugin

As made apparent by figure 2, each client has its own buffer for incoming messages to the exchange. This ensures that a single client will not be able to use all the computing resources of the host and will not be able to affect the work of other clients.

After the clients’ request is parsed it is transferred (if necessary) to the eosfinex smart contract. As soon as the response from the smart contract is received it is immediately sent to the user, together with information pertaining to the trades, market data and wallet updates. This way we can ensure high performance and low latency for connected clients.


As an on-chain trading experience, eosfinex will facilitate a highly-scalable network of peer-to-peer value exchange, unconstrained by borders and built around a foundation of speed, transparency, and integrity.

Stay up to date with developments below as we approach our March 2019 launch.

原文链接/Original URL:

https://medium.com/eosfinexproject/the-eosfinex-smart-contract-plugin-e2ac7753d778

About the author

By user
News.EOS.WiKi Bilingual News & Info Of EOS

Recent Posts