Hey stackers, i got something tasty for you today.
I was inspired by @aftermath's post here: #317289
I challenged myself to construct a lottery protocol where:
- Off-chain deposits and payouts are supported
- Players can verify the outcome was fair
- Players can prove to outside observers whenever the lottery coordinator cheats
- The lottery coordinator can prove to outside observers that it selected winners honestly
- Players remain 100% anonymous from each other; No P2P messaging needed.
- The on-chain transaction footprint is efficient and minimized
Turns out, this is actually more than just possible, it can be generalized to work for any Discreet Log Contract .
This means any kind of oracle-based contract (e.g. sports betting, derivatives, CFDs, etc) can be conducted off-chain without any of the DLC players needing to send or receive on-chain transactions or converse P2P. Participants in a DLC can instead use one untrusted coordinator who provides the on-chain capital while everyone else transacts off-chain. I call this person the 'market maker', and they can charge fees for their capital services.
review pls?review pls?
Bear in mind i just wrote this myself and finished it today. I'm hoping I didn't make any glaring errors which would make the whole protocol impossible. Please have a read and tell me if I'm crazy. I'll also be submitting this idea to the DLC-dev mailing list to get more opinions.
linkslinks
- Blog article: https://conduition.io/scriptless/lottery/ (Onion version)
- Github PR (comments welcome!): https://github.com/conduition/conduition.io/pull/4
Sounds like it can equally be called "provably unfair"
Good idea!
As a step towards making it trustess, you might want to check out "oblivious signing"[1] which uses adaptor signatures and something called oblivious transfer to achieve a trustless off-chain coinflip and which can probably be generalized into a lottery.
I also implemented a simple demonstration/test[2] of the underlying ecc math that makes oblivious signing work and which you might also find helpful.
https://telaviv2019.scalingbitcoin.org/files/scriptless-lotteries-on-bitcoin-from-oblivious-transfer.pdf ↩
https://github.com/VzxPLnHqr/secp256k1-scala/blob/main/Oblivious.test.scala ↩
Neat! i can see how this works for a two-player coin flip, but i'm not sure how one might generalize it for
nplayers.Notice how in Lloyd's coin-flip lottery, one of the
Picktransactions would need to be chosen arbitrarily by Alice. Bob might be able to claim the output of thePickTX depending on his choice of bit, and depending whichPicktransaction Alice chose.The problem with protocols that involve more than 2 agents is that everyone has to assume everyone else is colluding with each other. If you add a third player (Carol) who also receives an oblivious signature from Alice, then how can Bob be sure that Carol isn't colluding with Alice? If the two collude, then Carol can simply tell Alice which
Picktransaction to publish so that Carol wins the 3-way lottery, thus taking Bob's money.For an
n-player lottery to work fairly, it has to be impossible for anybody to predict or dictate the outcome in advance, as long as at least one player is honest.Ok, I am shooting from the hip here quickly (so what follows could very well be wrong), but let's try this:
Uand can sell sell a ticket to each Bob for an amount slightly more thanU / n(it is slightly more so that, in expectation she can earn a profit).I think for large enough
nand slow enough ticket sales, these issues are surmountable, no?Nice idea!
Can you explain this in more detail? What would happen if a coordinator cheats?
It's all detailed here. Specifically:
The market maker can also cheat by going offline (not awarding the jackpot at all), but I also describe how they can commit to revealing at least one winner
i don't get it
The provably fair lottery doesn't need any oracles. The Bitcoin is an oracle.
https://t.me/LuckyTipBot