News.EOS.WiKi Bilingual News & Info Of EOS

EOSIO.contracts 1.6.0版本:通过资源交易(REX)扩展Network资源的可利用度/EOSIO.contracts Version 1.6.0: Scaling Accessibility of Network Resources through a Resource Exchange (REX)

E

译文/Translated:

作为推动EOSIO™软件开发及优化的机构,我们很荣幸在此确认稳定版本的EOSIO.contracts已可供使用。此版本的完整更新列表请参考Github上EOSIO.contracts 版本1.6.0变更总览,以及问题(#117)中的描述。此版本主要聚焦于REX相关事宜(#94、#182、#196和#208)。

资源交易(REX)的功能意图在于让代币持有者能够向需要更多运算力的人出租自己部分的CPU和Network资源,让其能够在平台之上操作应用程序。此版本中,我们专注于我们认为更加强大的支持REX的合约功能,以供社区进行审核、调整和构建。

有兴趣的用户可以查看我们用以支持REX的Bancor公式以及启动系统的可行性选择。一直奋战于这些问题的Block.one工程师们会在之后的文章中详细讲解这部分的考量。

通过交易分配Network资源

本版本中REX相关合约的功能是在eosio.system合约之内提供,没有相应的用户界面和部署选择。在此提供的REX合约代码并非是一个内置产品,也非产品本身,它作为合约的基准,开发者可用以创建交易产品,让以EOSIO为基础的区块链用户能够使用这项功能。

由此,REX为CPU和Network资源租赁市场提供合约,该市场上区块链中核心代币的持有者能够通过在REX池中买(出租资源)卖(不出租资源)REX代币,以此出租各自的部分现有资源配置。

区块链应用开发人员可以从REX池中租CPU和Network资源,以满足自身的资源需求。每次租赁的设计时长为30天,并且借出价格是由自动化市场制作者决定。请注意,REX代币不可交易,它仅为一种方便的记账单位,并帮助确定返给REX持有者的利率,因为返利率由租赁活动的等级决定。RAM交易费用以及账户名称拍卖收入也可选择流入REX池,由此可提供额外的资源可返还给REX持有者。

REX合约开发方式的副产品包括它能够在公开的以EOSIO为基础的区块链上增加投票者参与度。核心代币持有者仅在为至少21个区块制作者投票,或者将其投票权授予代理之后,才能够参与REX池的活动(出租自身可用资源赚取代币)。

流向REX的渠道系统费用

eosio.system合约的源代码设置默认将账户名称拍卖费和买卖RAM的费用流向REX池。只有在收集新的费用时才会收取渠道费用;它并不会对“eosio.ramfee”以及“eosio.names”账户中已经收集的资金产生影响。

通过将“CHANNEL_RAM_AND_NAMEBID_FEES_TO_REX”宏指令(在“eosio.system.hpp”中定义)设置为0,可在源代码中将渠道费用无效化。

在自身环境中部署REX

REX为启动系统合约带来了新的设置要求。

在部署新系统合约之前,除其他现有系统账户外,必须创建eosio.rex账户,并且eosio.rex不能为特权账户。

“eosio::init action”(仅首次在区块链中部署该系统合约时才需要)在EOSIO.contracts 1.4.0版本中推出。在此版本中,对其进行了进一步改进,以发送一个内联动作“eosio.token::open”,为“eosio.rex”开设与其核心代币符号相应的零余额条目。“eosio.token::open”首次在eosio.contracts 1.3.0版本的“eosio.token”合约中推出。在部署新的系统合约之前,建议为“eosio.token”账户部署近期的代币合约(至少为1.3.1版本)。若部署的是旧版的代币合约,“eosio::init”仍能够进行,但当“eosio.token::open”执行时,旧版合约可能毫无反应。

若本版本的系统合约替代了现有旧版eosio.system合约,则不再需要“eosio::init”操作,或者甚至禁止该项操作。区块制作者能够选择性地执行“eosio.token::open”,以便为“eosio.rex”账户创建核心代币符号的余额条目。

需要在“eosio.rex”账户中部署ABI文档“rex.results.abi”(自动生成)。而相应的合约“rex.results.wasm”则禁止部署。“rex.results”中的“buyresult”、“sellresult”、“rentresult”和“orderresult”皆不可选。它们皆作为内联的便利操作被添加至“rentnet”、“rentcpu”、“buyrex”、“unstaketorex”和“sellrex”中。内联便利操作不会有任何效果,但其数据包含了父类操作的结果,并在其自身轨迹中显示。

调整REX池的虚拟余额

若需要,Setrex操作让区块制作者能够将REX池中余额“total_rent”重置回特定数额。请注意,此项操作并非是启动REX系统时的必要操作,并且不建议多次使用。此项操作为后备机制,若初始设置不可行并且与流向REX的代币数额不一致时,该机制让区块制作者能够平衡租赁市场价格。“total_rent”为虚拟余额,该操作不会真的添加或删除代币。

保持连接

一如既往,若您有意提供反馈并与我们的团队密切合作,为开发者们优化EOSIO软件,您可以向开发者关系团队发送邮件,邮箱为:developers@block.one。

您也可以在EOSIO开发者门户订阅我们的邮件列表,获得更多更新信息。我们很高兴将继续为EOSIO的开发者们完善软件的使用性,我们也将持续为区块链的大规模应用奠定坚实的基础。

所有产品和公司名称皆为其各自所有者持有的商标TM或注册商标®。对其的使用并不意味着任何从属关系或对其认可。

免责声明

Block.one作为EOSIO社区的一员,自愿做出自身贡献,并不对软件的总体性能及任何相关应用程序负责。对于此处所述版本以及相关GitHub版本或EOSIO软件,我们不作任何明示或暗示的陈述、保证、担保或承诺,包括且不限于提供担保,保证适销性或对某一特定目的和非侵权的适用性,并不承担相应的责任。在任何情况下,无论是合约操作、侵权行为或其他,亦无论是否与软件或文档相关,或由于软件使用导致,或在软件和文档上的其他交易导致的任何索赔、损害赔偿或其他债务,我们均不承担责任。任何测试结果或绩效数据具有指示性,无法反映所有情况下的绩效。任何对第三方或第三方产品、资源或服务的引用都不受Block.one的认可或推荐。对于您使用或信任这些资源的行为,我们概不负责,并且不承担任何责任和义务。第三方资源可能随时更新、变更或终止,因此此处的信息可能已过期或不准确。

原文/Original:

As a contributor to the development and enhancement of the EOSIO™ software, we are pleased to confirm that a stable release is available for EOSIO.contracts. For a full list of updates made in this release, please refer to the Summary of Changes in EOSIO.contracts v1.6.0 in detail on Github and the description in issue (#117). This release focuses primarily on issues related to REX (#94#182#196, and #208).

The intention of The Resource Exchange (REX) functionality is to enable token holders to rent portions of their CPU and Network resources to those needing more computational power to operate applications on the platform. In this release, we focus on what we believe to be a more robust functionality for the contracts supporting REX for the community to review, adapt, and build on.

Interested users can review the Bancor equations that were used to support REX and the possible choices for initializing the system. An overview of these considerations will be detailed further in an article forthcoming by Block.one engineers who have been working on these issues.

Allocation of Network Resources through an Exchange

The functionality provided in this release for REX-related contracts are provided within the eosio.system contract without corresponding user interfaces and deployment choices. REX contract code provided is not a product in and of itself, but is intended as a baseline for contracts that developers can utilize to create exchange products that enable this functionality for users of EOSIO-based blockchains.

As such, REX provides contracts for a CPU and Network resource rental marketplace in which holders of the core token of the blockchain can lend portions of their existing resource allocations by buying (lending resources) and selling (un-lending resources) REX tokens into the REX pool.

Blockchain application developers can rent CPU and Network resources from the REX pool to meet their resource needs. The duration of each loan, as designed, is 30 days and the loan price is determined by an automated market maker. Note that a REX token is not tradable, it is merely a convenient accounting unit and helps determine the return rate available to REX holders as determined by the level of rental activity. Optionally, proceeds from RAM trading fees and account name auctions can also be channeled to the REX pool, thus providing an additional source of return to REX holders.

One byproduct of the way REX contracts have been developed is that it has the potential to increase voter engagement on public EOSIO-based blockchains. Core token holders are only allowed to participate in the REX pool (earning tokens for renting their available resources) only after having voted for at least 21 Block Producers or having delegated their votes to a proxy.

Channeling system fees to REX

The source code of the eosio.system contract is by default set up to channel the account name auction fees and the fees collected from buying and selling RAM to the REX pool. The channeling of these fees only occurs for new fees collected; it does not impact any of the funds already collected in the `eosio.ramfee` and `eosio.names` accounts.

The channeling of these fees can be disabled in the source code by setting the `CHANNEL_RAM_AND_NAMEBID_FEES_TO_REX` macro (defined in `eosio.system.hpp`) to 0.

Deploying REX in your Environment

The REX introduces new setup requirements for initializing the system contract.

The account eosio.rex must now be created in addition to all the other existing system accounts prior to deploying the new system contract eosio.rex must not be a privileged account.

The `eosio::init action`, which is only needed when deploying the system contract to a blockchain for the first time, was introduced in v1.4.0 of EOSIO.contracts. In this release, it has further been modified to send an inline `eosio.token::open` action to open a zero-balance entry corresponding to the core token symbol for the `eosio.rex` account. The `eosio.token::open` action was first introduced to the `eosio.token` contract in v1.3.0 of eosio.contracts. It is recommended to deploy a recent version of the token contract (at a minimum version 1.3.1) to the `eosio.token` account prior to deploying the new system contract. If an older version of the token contract is deployed, the `eosio::init` action will still succeed, however when the inline `eosio.token::open` action executes it may do nothing.

If this version of the system contract is replacing an existing deployment of an older version of the eosio.system contract, then no `eosio::init` action is necessary or even allowed. Block Producers can optionally execute the `eosio.token::open` action to create the zero-balance entry to the core token symbol for the `eosio.rex` account.

ABI file `rex.results.abi` (generated automatically) needs to be deployed on account `eosio.rex`. The corresponding contract `rex.results.wasm` must NOT be deployed. The actions `buyresult`, `sellresult`, `rentresult`, and `orderresult` of `rex.results` are all no-ops. They are added as inline convenience actions to `rentnet`, `rentcpu`, `buyrex`, `unstaketorex`, and `sellrex`. An inline convenience action does not have any effect, however, its data includes the result of the parent action and appears in its trace.

Adjusting the REX Pool Virtual Balance

Action setrex allows Block Producers to reset the `total_rent` balance of the REX pool to a given value, if the need arises. It is important to note that this action is NOT required to initialize the REX system and is not recommended to be used more than once. It is a backup mechanism that allows Block Producers to balance the renting market prices in case the initial settings were impractical and not in line with the amount of tokens lent to REX. `total_rent` is a virtual balance and no real tokens will be added or removed in this action.

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 keep up to date with 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.

All product and company names are trademarksTM or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.


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 related applications. We make no representation, warranty, guarantee or undertaking in respect of the releases described here, the related GitHub release, the EOSIO software or any related documentation, whether expressed or implied, including but not limited to the warranties or merchantability, fitness for a particular purpose and noninfringement. In no event shall we be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or documentation or the use or other dealings in the software or documentation. Any test results or performance figures are indicative and will not reflect performance under all conditions. Any reference to any third party or third-party product, resource or service is not an endorsement or recommendation by Block.one. We are not responsible, and disclaim any and all responsibility and liability, for your use of or reliance on any of these resources. Third-party resources may be updated, changed or terminated at any time, so the information here may be out of date or inaccurate.

原文链接/Original URL:

https://medium.com/eosio/eosio-contracts-version-1-6-0-9795101c7abd

About the author

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

Recent Posts