⚡️DailyZap: P2P Self-Custodial Wagering!!!👏🚀
@THNDRGAMES unveiled a new banger in the world of Lightning gaming last week! Picture it: you can now play against another user, wagering sats on the outcome of the game, but without the game developer taking custody of the funds at any time. Pretty sweet, innit?
The user experience is pretty simple: you sign up on the
clinch.gg/ website, link a Lightning Address, and a ''start a new game'' with an attached stake (right now, players can wager 100, 1K or 10K sats). Pass the game's link to your friend to let them join. Each player will be asked to pay an invoice of the amount at stake (say 100 sats) before the game can begin. The invoice pays the other player, but going through THNDR's node, and isn't settled right away.
At the end of the game, the invoice that pays the winner is settled, while the invoice paying the loser is simply canceled. In other words, the winner gets the loser's money, as you'd expect. In the middle, THNDR is able to collect some fees, which could prove to be an interesting funding mechanism for game developers.
So how does this works exactly? Clinch leverages two powerful Lightning mechanisms: hodl invoices and invoice wrapping. Invoice wrapping is the process through which a third party can act as a proxy between the receiver and the sender of a payment, but without being in custody of the funds at any time.
The receiver creates an invoice, which as usual carries a payment hash only them know the preimage of. The third party will then take the payment hash and use it to craft another invoice, which pays them and can be for a different amount. The third party then sends their invoice (called the wrapped invoice) to the sender. When the sender pays this invoice, the third party can't claim this payment immediately because they don't know the underlying preimage.
The only way for them to learn this secret is to in turn pay the initial invoice that the receiver sent them. To claim this payment, the receiver must reveal the preimage to the third party, which the third party will then use to claim their payment from the sender. This way, the sender indirectly paid the receiver through the third party, which didn't have any hold on the funds in the process, while being able to claim a fee if the amount of their wrapped invoice was bigger than the amount of the receiver's invoice.
A hodl invoice, on the other hand, simply consists in the receiver of the payment (which crafted the invoice) waiting on an external event before they reveal the preimage to the sender and claim the payment.
In a Clinch game, THNDR gets an invoice from both players using their respective Lightning Address, wraps each invoice and sends the wrapped invoice to the other player (e.g. Alice gets Bob's invoice, wrapped by THNDR). Each player pays the invoice they're presented with, but the settlement of the payment is withheld by THNDR. Once the game is over and the winner is known to THNDR, THNDR can simply cancel the wrapped invoice they sent to the winner, and pay the invoice they received from the winner in the beginning using their Lightning Address. Knowing the winner's preimage, they can now claim the payment the loser made to the wrapped invoice, which was still on hold.
Interestingly, Lightning gaming OG Christian Moss had already come with a similar idea back in 2019. A key difference is that Moss's scheme was fully peer-to-peer, with no entity in the middle. While it may seem desirable (since it means no fee), it exposes the winner to a (moderate) griefing attack where the loser could refuse to cancel the winner's payment to their invoice, thus letting the payment in a "hodl" state until the invoice expires.
This is a problem because the winner can't use the funds they committed to this payment while the loser is still "hodling" to it. The cryptography-era version of a sore loser, if you will. Having THNDR in the middle in Clinch addresses this issue, since THNDR is responsible for cancelling the hodl payment to the loser when the game is over, instead of letting it expire an hour or so later. Pretty smart!
⚠️Wanna try CLINCH? Head to their Telegram group to access the closed beta version:
t.me/clinchgg