substrate-feeless-token-factory
Github地址:
https://github.com/shawntabrizi/substrate-feeless-token-factory
介绍网站地址:
https://www.shawntabrizi.com/substrate/substrate-feeless-token-factory/
What is it?
In simple terms, this project provides a runtime module which provides the following features:
- A token factory where any user is able to create an ERC20 compliant token on top of the Substrate runtime
- An additional API for transfer of these tokens without the end user paying any fees in the native currency
Ideas for alternative payment methods for transfers:
- (Yes)Token Fee Fund: A fund for a particular token where token transfers are paid from the fund.(令牌费基金)
- (No)Pay with Token: The ability to "pay" the block producer not with the native currency, but with the token you are trying to transfer.(用转移的代币进行支付)
- (No)Proof of Work: Complete some small proof of work along with your transfer to allow the transaction to be included.
User Story
For example, the "Better Energy Foundation" issue a new token to be used as electricity credits.
When they do this, they fund the token with an initial fund of the underlying blockchain currency: 10,000 units. They specify that the users of their token have 10 free transactions every 1,000 blocks.
They can sell their tokens and transfer them to the buyers just like a normal ICO.
These buyers can then call the try_free_transfer function when trying to trade the token among their peers, and the fees are paid for using the fund.
Anyone in the community can continue to add more funds, and allow the free transfers to continue.
If a user does not have any more "free" transactions left for the current period, they can always make a transaction using the normal transfer function which will charge them a normal fee.
简单总结:
0-目前类似以太坊花费ETH的转账不是很友好,尤其是对于需要转出ERC20的新用户;
1- 转账分为免费和付费两种;
2-初始化 默认给用户10次免费转账的机会;
3-10次免费的转账结束后,按照付费的模式来收取用户的转账费用;
A:交易费用是为了抵抗拒绝服务攻击
如何实现:
B:构建一个交易费用的资金池 - 资金池主要由Token的创建者来维护。(任何人都可以做同样的操作)
- 10 free transactions every 1,000 blocks
- try_free_transfer
- transfer
代码中测试的部分还没有尝试,找个时间测试一下;