Problem
As is well known, udt token scheme requires ~145 CKB to build the data structure. And there should be another 145 CKB to be provided to send tokens as the ‘receive box’. It is a significant burden from both user education and product design perspectives.
Anyone-can-pay lock is a good solution for the extra CKB spending. It allows sender directly modifies the receiver’s udt cell to add up the token without the interaction from the receiver. But the concurrency problem prevent ACP from wide usage: when more than one transfer happens at the same, only one transaction could be processed, the others will fail.
Solution
A trivial solution to this problem is to prepare more acp cells from the receiver side. It will dramatically decrease the collision possibility. However, in most of the mass-adoption scenarios, users cannot afford lots of cells (more than $1 per cell).
We propose this acp-in-middle solution to this problem, which could solve it perfectly.
Here we prepare a number of “public relay cells”, which allows sender store udt temporarily. Then the decentralized seveice collect the cells and send tokens to the receiver periodically. All the public relay cells can be used to receive and store some tokens from any sender, the more relay cells exist, the less probabilitys occur.
The basic data structure of relay cells may looks like as follows.
// relay cells
data:
amount
target_lockscript
type:
udt
lock:
acp or modified_acp
The service provider collect the relay cells periodically, then send the tokens to the target lockscript in the ACP way. This hub-like design have lots of benefits.
- Reduce cell collision probability, improvce user experience
- Every user uses only one acp cell, reduce their account cost
- Non-breaking change, application could use a plain acp solution at the beginning, then switch to non-contract based relay cell hub, and finally a contract-based trustless relay cell hub
- Business opportunities for service providers, they can charge like 0.1% fee for every relay.