This is the announcement that I announced here:
I finally got the MVP done for a prediction market on lightning.
If you don't know what a prediction market is, watch this video.
But first and foremost: To prevent loss of funds, the market is running on mutinynet and not mainnet until I have enough confidence in the code for mainnet. This means the sats have no value and you need to use the mutiny faucet to pay invoices and the mutiny wallet (signet) to test withdrawals as mentioned in /about.
Thanks to @benthecarman @TonyGiorgio and Paul (I don't know his nym on here, lol) for mutinynet and the provided tools! Less stuff I had to worry about on my own.
Features
- create your own binary markets
On the main page, you can immediately see a button to create a new market. You'll need to login with lightning though. You can use any LNURL-auth capable wallet for that. LNURL-auth is independent from which network is used for transactions :)
For now, you can only create binary markets. This means that you can only bet on events which outcome is either
YES
or NO
:market creation form:
Be aware that you can currently not change the description or delete the market after creation. In the future, I might allow edits for a few minutes after creation.
- trading of YES and NO shares
Basically the heart of the market. As a market would be useless without trading, you can obviously create BUY and SELL orders for YES and NO shares. Every order must be matched with an order of a different market participant.
For example, if you want to buy 2 YES shares at a price of 70 sats per share or short:
BUY 2 YES @ 70 sats
, your order must match a BUY 2 NO @ 30 sats
order.buy order form:
The interface might still be overwhelming even though I iterated on it several times already.
The input labeled with
how much?
specifies how many sats you want to bet. With how sure?
you specify the price per share since the share prices in a prediction market reflect what the market currently thinks how likely an outcome is (at least in theory).- interactive order book
To match existing orders easily, you can simply click on
PENDING
and a context menu will show - assuming it's not your own order, else it will show a button to cancel your order:matching existing orders using the interactive order book:
On click on
match
, you'll get redirected back to the order form but with prefilled values. If you submit this order, this will match the other order after payment. For example, if you click on match
in the screenshot, you would get redirected to this order form with BUY 2 YES @ 20 sats
prefilled:- basic market stats
On the
stats
page, you can see the total sats locked in the market (volume) and how many are on which side. YES
75% means that 75% of all sats were put into YES share which means that the market thinks that the chance that YES will win is 75%. However, tbh, I am not entirely sure if the chart works, lolstats page:
- withdrawal
You can withdraw any sats you received via payout or canceling an order (you'll get a refund for any invoice you paid for the order) in your wallet:
wallet page:
withdrawal via bolt11 payment request:
- list of all invoices
Not much to say here. Just a list of all your invoices with their status so you can pay them later or keep track of what you've done:
- list of all orders
Similar to the invoice list. You can also cancel your orders from this list (and not only from within a market order book) by clicking on
PENDING
to show the context menu.- market settlement
If you created a market, you can decide the outcome of the market via a hidden
settings
page:This is obviously not ideal and unlike what I initially mentioned: that the market creator (or me, as the site operator) would only be used as a fallback if the trading parties don't find consensus on the outcome. However, this idea didn't make it into the MVP.
If anyone even remembers, I also mentioned that I would be using HODL invoices to wait with settling the invoices until a counter party was found. If no counter party was found, their sats would get returned for free - no network fees. That also didn't make it into the MVP and I am no longer sure that's even something users would want since it trades UX for a potentially insignificant risk of having to pay the lightning network again for a withdrawal if you found no counter party.
Planned
- actually show end date that was picked during market creation to user
- PWA with push notifications
- fix chart (?)
- code cleanup / refactor (that's probably always a thing, lol)
- tests, tests, tests
- other stuff that I forgot now
- ...
- mainnet
That's it for now. I want to go to sleep and writing all of this took some time that I was worried about my account deletion deadline, lol
Now go, find all the bugs that I have hidden for you! Feel free to create new markets. I have created some orders for the existing markets so you can use them to immediately find some matches :)
Hopefully I'll wake up to some interesting prediction markets - or funny :)
some somewhat random pings: @Natalia @grayruby @Undisciplined @nemo @siggy47 @orthwyrm @elvismercury @carlosfandango
how sure are you?
to make it more "intuitive" how the price is created. If you're very sure, you would pay a lot to gain a little. And the higher your price, the lower the amount the counter party has to bet against you so it's more likely you'll actually find someone to be your counter party. But as you framed it "if you're very unsure, you might win a lot" makes it clear that this isn't intuitive, loladd_header Access-Control-Allow-Origin *
instead of inside the code feels like a hack but maybe that's actually not a hack but (should be) best practice? lolwhois
info being private. But it won't stop the feds obviously.