Conversation
|
Work in progress, things to figure out:
|
|
I've realized that this is NOT needed. @vnprc , can you confirm? |
|
Ehash issuance does not require a lightning node. I've got a working prototype of issuance without lightning. But because cashu only operates on lightning you can't turn ehash tokens into bitcoin without lightning integration. I suppose you could come up with a multi-mint model where one mint handles issuance and a separate one handles redemptions. I'm not sure how this would work because this was never my goal. Not saying it couldn't work that way. I always intended for the same mint to handle redemptions. The simplest flow looks like this:
If you wanted to split issuance and redemption across different mints how would the trust model work? The bitcoin needs to flow from the coinbase (or mining reward if the hashpool instance is running as a proxy pool) to a lightning node where it rests until users claim those sats. So there is a rug risk after the block is found while users are doing ehash redemptions. If the Hashpool instance doesn't custody these funds, who does? What leverage does Hashpool have to enforce these redemptions? If Hashpool custodies the funds then they have a reputation to uphold and are accountable to the miners who trusted this mining pool. I'm not sure how the trust model works if you extend it to another party. What benefit does this have over the simplified single-mint model? It has a significantly more complicated trust model, so there should be commensurate benefits. |
|
Thanks for the write-up, some points are new to me! What is a bit awkward to me, is that in the ehash mint there is a discrepancy in the denomination of the ehash values and the lightning values. At the time of creation of ehash tokens their final conversion ratio is not known, so therefore they will have a denomination different than the satoshis in the lightning backing. In fact the ehash is unbacked. Technically it is probably possible to implement, with some custom logic in the mint, I just found it a bit counterintuitive. Based on my general (&limited) knowledge of the project goals, and mining, cashu, lightning, and bitcoin, what I had in mind is:
I guess if one mint is used, very similar result can be achieved, if it is modified internally according to the needs. For the specific questions on trust model, with two mints:
In any case, the redemption cannot be done trust-minimized, since the mint is the one determining the payout ratio, and turning unbacked ehash into ecash. So I don't see much difference between the two cases. Further remarks:
|
|
General discussion aside, I understand that for now the plan is to have the mint connected to the lightning node. I will continue on this. |
|
On further thought: If a single mint is used, and ehash is swapped to lightning, then there is no need for the mint to be connected the lightning node. Here's what I mean:
|
If the epoch is tied directly to mining rewards then it could be very long or very short. Likely both at different times. I think it will work like this. Hashpool will have two modes of operation: solo mode or proxy mode. In solo mode the pool mines blocks directly. In proxy mode the pool mines upstream to an aggregator pool. I like proportional payouts for their simplicity of design in both modes. Proportional payouts let us do a very simple calculation once each epoch: simply divide the amount of ehash issued by the reward received to get a sat/difficulty value (the unit of ehash is called difficulty). It works the same in solo mode or proxy mode. The unit conversion takes a little getting used to but I think this is the only way it works. You can't know the value of shares in bitcoin until you receive a mining reward. |
Yep! That's the spec is written. Ecash from closed epochs can still be redeemed but no new ecash can be issued from that keyset.
Yeah this is essentially how it will work. The mint will support two currency units: ehash and sats. They both have their own keyset and epochs. They basically operate like separate mints under the same service. This saves the mint operator a bunch of overhead that would be required to run two mints. |
I think the ehash->lightning flow will be substantially more complicated than ehash->ecash because the user and mint first need to exchange a bunch of information. The user knows how much ehash they have. The mint knows the conversion ratio. For bolt11 the user needs to create the payment invoice. For bolt12 the mint can attempt a payment directly. But in either case we need to wait for the payment to confirm before expiring the ehash tokens. So we need to build an API flow where this information can be exchanged and failure cases handled correctly. That's gonna be a lot of work. The flow for ehash -> ecash should be a lot simpler because the mint just handles everything and delivers the ecash tokens in the API response. It's all atomic and synchronous, no payment failures, invoice timeouts, or privacy leaks to worry about. (BOLT12 is a big privacy leak, unfortunately, because it associates all your ehash tokens to a static payment address). We can also leverage all the work that has already been done to make ecash->lightning flows work. It's just one more step for the user to redeem their ecash through already existing flows. |
Oh that is interesting. I haven't thought of that flow before. I assumed the mint and lightning node would be tightly integrated because this is how cashu already works. Is there a benefit to tightly coupling the pool and LN node instead? I'll have to think about that. Off the top of my head it seems like we'd be reinventing the wheel since the cashu community has already solved most of the problems with lightning integration. Pool-lightning integrations are not widely deployed and AFAIK there is not a well supported FOSS project to support this flow. |
Exactly. As I said, this is more of an implementation-level issue: two mints or one mint supporting the two kinds of ecash both achieve the same things. My thinking was that the ecash part can be an unmodified cashu implementation, hence it makes sense to have it separately, while the ehash part needs to have internal logic customization. But one mint customized implementation is almost the same, I'm fine with that approach too. |
I see these alternatives:
Of these, 1 is the simplest for sure. I was brainstorming about the other options as I got the feeling that you have a preference for atomic swaps. |
|
Played around a bit with these, but struggled with "Unit unsupported". It looks like CDK with CLN backend defaults to Msat. |
|
Did you try adding the If you give me more info on what you're trying to accomplish I might can help. |
|
cdk supports a built-in ldk node since version 0.15 so CLN is no longer necessary. closing this issue |
Connect the Mint in the devenv to the already added CLN lightning node (#51).
Fixes #56