Hey stackers, i got something tasty for you today.

I was inspired by @aftermath's post here: https://stacker.news/items/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?

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.

## links

- Blog article: https://conduition.io/scriptless/lottery/ (Onion version)
- Github PR (comments welcome!): https://github.com/conduition/conduition.io/pull/4

related

^{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.^{2}of the underlying ecc math that makes oblivious signing work and which you might also find helpful.## Footnotes

`n`

players.`Pick`

transactions would need to be chosen arbitrarily by Alice. Bobmightbe able to claim the output of the`Pick`

TX depending on his choice of bit, and depending which`Pick`

transaction Alice chose.`Pick`

transaction to publish so that Carol wins the 3-way lottery, thus taking Bob's money.`n`

-player lottery to work fairly, it has to be impossible foranybodyto predict or dictate the outcome in advance, as long as at least one player is honest.`U`

and can sell sell a ticket to each Bob for an amount slightly more than`U / n`

(it is slightly more so that, in expectation she can earn a profit).`n`

and slow enough ticket sales, these issues are surmountable, no?`Pick`

transaction to publish.