aftermath2 / btry

Accountless lottery powered by the Bitcoin Lightning Network
GNU Affero General Public License v3.0
3 stars 1 forks source link

Block-based lottery duration #20

Closed aftermath2 closed 5 months ago

aftermath2 commented 10 months ago

Description

Currently there is one lottery every 24 hours starting at 00:00 UTC. However, we could switch to a block-based duration of 144 blocks per lottery and use the 144th block header hash as a source of entropy to generate the winning numbers.

That way, users would be able to prove that the numbers were generated randomly and not arranged or manipulated. Right now, they must trust that the code running in the production server is indeed the one present in this repository's master branch.

conduition commented 9 months ago

Hi @aftermath2, I went down a bit of a rabbit hole and designed a whole protocol for this over the last couple days. It allows provably fair outcomes and grants players the ability to prove misbehavior by the server with irrefutable succinct proofs.

Excerpt from the introduction:

In this document, I'll describe a protocol for a provably fair Bitcoin lottery in which players can pay into the jackpot using Lightning. If everyone cooperates, the winner can even receive their prize using Lightning too. This enables large scale federated lotteries with very low barriers to entry, and highly flexible ticketing systems, where 1 satoshi paid into the jackpot is literally equivalent to one ticket in the lottery. Players maintain total anonymity from one-another.

The lottery's jackpot capital is backed on-chain by a market maker. The market maker is trusted, but verifiable: While the market maker could choose to award the jackpot to the wrong player (collusion is possible), any other honest player can immediately recognize this misbehavior, and publish a non-interactive fraud proof to warn others.

The market maker can publish irrefutable proofs demonstrating they picked winners fairly, and can commit himself to a deadline, where he must award the jackpot by a given block height, or else be financially punished.

Given more advancements in BitVM, it could even be possible for the market maker to commit himself to honest winner selection, allowing players to financially punish the market maker for choosing a winner dishonestly.

Needs review as i'm sure I missed stuff.

Naturally it would be a lot of work to convert BTRY into a cryptographically provable lottery; i'm not sure if that was your original intent or not. I hope this provides some interesting food for thought at least :smile:

aftermath2 commented 9 months ago

@conduition This is awesome! Very interesting solution and concepts. I'll take some time to review it further, point by point and leave some comments here. Thank you for taking the time and effort to craft a protocol.

Naturally it would be a lot of work to convert BTRY into a cryptographically provable lottery; i'm not sure if that was your original intent or not. I hope this provides some interesting food for thought at least

It wasn't my original idea but because I came up with this issue a few days before publishing the MVP. It's definitely something worth getting into and hopefully developing the logic necessary to make it work.

aftermath2 commented 7 months ago

Hello @conduition, sorry for taking so long to respond. I have analyzed the protocol specification and I absolutely love the concepts you have used to make it work. There are some points/questions I would like to discuss: