"Virtual Rollups" via Transfer Hooks #671
Replies: 16 comments 14 replies
-
We need to create a research specification to have a transfer hook contract to be able to perform this behavior of rebasing a user's Then the next time that the user wants to interact with their The purpose of the rollup is, of course, to save on gas fees by rolling up the user's many debits into a single on-chain transaction. |
Beta Was this translation helpful? Give feedback.
-
Final note, the Ubiquity Card service (off-chain) has a max spend limit of the user's current on-chain Ubiquity Dollar balance. Afterwards, it will read from the current balance provided by the "user delegated balance" oracle/API. Each debit on the debit card will subtract from the "user delegated balance." What does the architecture look like to let the user activate a transfer hook via an approval call? I think it would be most comforting if users must deliberately opt in to enable delegated balances, otherwise there would be a lingering sense of insecurity for users that their money can be taken by the Ubiquity team or by hacks at any time. |
Beta Was this translation helpful? Give feedback.
-
Request for comment @zgorizzo69 @rndquu |
Beta Was this translation helpful? Give feedback.
-
Sync gapTraditional banks maintain a single source of truth (i.e. DB) In the proposed architecture we should maintain 2 sources of truth:
Maintaining 2 sources of truth we have a "sync" gap when user pays with his Ubiquity debit card. Example (user balance 100 USD on-chain and off-chain):
So on next trasfer code inside a transfer hook will fail to deduct 100 USD (which came in off-chain) because there is nothing to deduct FlowConsider an example with onchain confirmation (with successful result):
Here on step 3 we should somehow distinguish a real card holder with an adversary who knows the card number. So we need an additional step of authentication (sms, push, OTP, etc...) So basically we are sending a transaction on behalf of a user. I don't get why user should take additional risks by allowing some address his funds while he can simply use any wallet, sign transaction and send it without any 3rd party services. |
Beta Was this translation helpful? Give feedback.
-
If the user wants to use the debit card feature (or any other off-chain extensions of the Ubiquity Dollar economy) the user is required to opt in to this "delegated balance service." Now this is the singular source of truth for the balance of that user. Once the user has enabled the "delegated balance service" on the next on-chain transfer of uAD, the balance will be rebased to what the "delegated balance service" thinks it should be. If a user is not opted in, then they can not use any of these features with prevents any of these issues from happening in the first place. Meaning that by default, the single source of truth will be the user's on-chain balance as we would traditionally expect for any normal stablecoin project.
I also think this is exceptionally difficult to get a transaction included and the block validated all in the same millisecond that the debit card payment was made and is checked by our server. Maybe possible so we should think about this more carefully.
I am not sure that the traditional finance system is compatible with this. I would imagine that the point-of-sale system would throw an error for such a long card transaction timeout. Also from the user's perspective: imagine going to a fast food restaurant and spending 40 seconds to buy a snack. I would not consider that as acceptable.
I always like to default to Gnosis Safe because they support push notifications and transaction approvals on the iOS app, which is a very convenient form of on-chain two-factor authentication.
There is no way that we can offer a fully decentralized debit card. It must have a centralized component unfortunately due to laws and regulations. If you know of a way to hop on to traditional finance payment rails in a totally permission less way then we will absolutely do that. However as of now, there must be KYC for example, and the card must be authorized (accepted) by merchants in specific geographies following geographic specific regulations. I'm unsure if I addressed all of your points fully. Fiat LiquidityThere is one clarification I need to make in regards to liquidity in case it is not clear: When we issue debit cards, I presume that we will need to have a fiat bank account with liquidity (e.g. $1M USD for all the early customers) and that balance must be topped up/managed daily in order to settle payments in the fiat world. So when a transaction happens with a merchant, it all happens on the fiat side. However, because Ubiquity is providing that fiat liquidity, we must be made whole from our customer/user. The way we do this is by liquidating their on-chain uAD from their wallet so that they can't redeem collateral or spend it elsewhere on chain. |
Beta Was this translation helpful? Give feedback.
-
So we should somehow block on chain transactions for that user while he is opted in to the "delegated balance service", right? |
Beta Was this translation helpful? Give feedback.
-
I think it's easy to control transfer behavior on-chain including blocking with transfer hooks. This question seems to be less around technology and more around strategy. |
Beta Was this translation helpful? Give feedback.
-
I'm trying to understand how to prevent double spending from off chain and on chain user's balances. So, from what I've understood so far, in case a user wants to opt in for the "delegated balance service" we should:
|
Beta Was this translation helpful? Give feedback.
-
Unfortunately this sounds exactly like depositing the tokens into a smart contract which defeats the vision of being able to keep your Ubiquity Dollars liquid in your wallet, while being able to spend them in the real world. Alternatively we could consider spend limits with the debit card and actually make their uAD balance negative (overdraft.) Sybil attacks should be mitigated as debit cards presumably all require some form of KYC verification. The overdraft idea is not ideal, but it will handle the edge case I replied to earlier with:
This will be synchronized in the pre-transfer-hook, every time |
Beta Was this translation helpful? Give feedback.
-
This does not eliminate double spending but if there is a form of KYC on the "debit card side" then we could charge negative in such cases |
Beta Was this translation helpful? Give feedback.
-
Another kernel of an idea that isn't completed but maybe could inspire something more fleshed out: what if we take inspiration from optimistic rollups, where we optimistically assume that everybody is a good actor, but if we detect any foul-play (attempted double spend) we can post the attestation and retroactively undo things on chain. |
Beta Was this translation helpful? Give feedback.
-
Monitor Pending TransactionsAnother potentially straightforward and simple solution: when the user swipes their debit card, our backend should monitor pending on-chain transactions. We can proactively deduct from their "delegated balance" based on the amount pending in the transaction. This does not solve for MEV related transactions yet, but it could be a step in the right direction. |
Beta Was this translation helpful? Give feedback.
-
@rndquu something @pavlovcik and me just talked about is block reorgs, in that scenario double spending could be possible but so far they seems incredibly rare |
Beta Was this translation helpful? Give feedback.
-
set a limit transfer hook where you wallet balance cant get lower than the card limit by example:
users can configure their spending limits in an app and the only requirement other than what the card issuer gives will be having uAD already in your wallet this way double spending is impossible due to the fact you're always restricted to hold money to pay us later in the event of an error also we can have the added advantage of that money not necessarily being uAD in a wallet but also LPs in pools we control so the user can still earn yield on their money and in the event they over spend we take a protion from their LP to represent that missing money |
Beta Was this translation helpful? Give feedback.
-
I think we're going to need to use account abstraction (smart contract wallets) instead of using transfer hooks. This makes me think that it might be worthwhile to remove transfer hooks from the updated deployment, as they incur additional gas fees and we have not found good use cases for them. |
Beta Was this translation helpful? Give feedback.
-
looks like the technology exists for this, just not on Ethereum
https://x.com/ekuzyakov/status/1756812623117443226?s=46&t=bdMjuqzO5LYxLUsloRROxQ |
Beta Was this translation helpful? Give feedback.
-
Basically the idea of being able to spend money on a Ubiquity debit card but deduct directly from a user's wallet balance. However, we can create a "virtual rollup" by deducting on the next transfer via a transfer hook. It might be cheaper to do a single debit to roll up all transactions vs every transaction debit in regards to gas fees.
ubiquity/research#2
Beta Was this translation helpful? Give feedback.
All reactions