pull down to refresh

A few months ago, I decided to dedicate a good portion of my free time to develop tools and services for the Bitcoin ecosystem.
I truly believe Satoshi created a liberating technology that has the potential to the empower millions around the world, and I want to contribute to that cause.
I have seen enough damage from governments to sit back and do nothing. It is time to take over and build solutions designed for individuals, valuing their privacy, security, freedom and sovereignty.
This is the start of my journey, I'm proud to announce BTRY.

BTRY

BTRY is an open-source accountless (daily) lottery that uses asymmetric cryptography to register bets/prizes, and the Lightning Network to send and receive payments.
Thanks to Bitcoin, cryptography and the Tor network, BTRY is:
  • Globally available
  • Permissionless
  • Transparent and auditable
  • Completely private
  • Simple
On top of that, it offers instantly redeemable and hard money prizes!
It requires a browser proxied through Tor to be accessed (like the Tor Browser). It can't be accessed through clearnet.

Getting started

All you need to participate is an ED25519 private key.
BTRY initially generates one randomly to ensure an uninterrupted experience, but is up to the user to keep it, enter a custom one or generate it using the UI.
The private key never leaves the client, its associated public key is used to identify your bets and prizes, and the signature is used to withdraw them.
The user should make sure to back it up, because it's the only way he can withdraw the funds. For greater privacy, it's suggested not to reuse keys on different lotteries.

Bets

Bets are submitted by paying invoices, the invoice amount is the number of tickets that the user gets assigned once paid (1 sat = 1 ticket).
A single ticket can win multiple prizes, all users participate for the 99.609375% of the prize pool. The bigger the bet, the higher the chances to win.
Any user can do any number of bets and they can be as little as 1 sat and as big as the capacity available.
In this lottery, ticket numbers are not chosen by the users but assigned sequentially. For example, if the prize pool is of 10,000 sats and the user submits a bet for 5,000 sats, he would get the tickets 10,001 to 15,000. If any of the winning numbers is between those two, the user is assigned a prize.

Prizes

Winners are announced daily at 00:00 UTC and the winning numbers are generated using cryptographically secure random numbers.
These are the prizes as a percentage of the prize pool:
PlacePrize
1st50
2nd25
3rd12.5
4th6.25
5th3.125
6th1.5625
7th0.78125
8th0.390625
BTRY fee0.390625
All prizes expire after 5 days, this is to avoid having liquidity locked for long periods (automatic withdrawals may help overcome this).
Users can opt to receive notifications through Telegram in case of winning. Messaging service identifiers are stored for one week and permanently deleted after that.

Next steps

Although I present BTRY as a lottery, I would like it to become a platform that offers many services. Some of the features I'm looking to add in the next weeks/months are:
  • Battles (#9):
    Battles are a non-custodial PvP game based on HODL contracts where two players compete for a fixed amount of money.
    The funds are never in the hands of BTRY, it merely acts as a coordinator and decides which payment to settle (loser -> winner) and which one to cancel (winner -> loser).
    Initially, the idea is that both users choose one number between 0 and 1000, BTRY generates one randomly (using provably fair numbers) and the one that got it closer wins. In case of a tie, both invoices are canceled.
    However, the goal is to move towards other forms of deciding a winner, like real event outcomes. There has been demand for a sports betting platform based on Lightning and these technologies may be a great fit for that.
  • On-chain transactions support (#5): The ability to deposit and withdrawal using on-chain transactions could be really useful, especially because big prize pools may be cheaper to move on-chain than in lightning. The main issue is that without splices, it does require managing liquidity on both layers and paying the fees to move from one to the other.
  • Automatic withdrawals via lightning addresses (#11): To overcome the drawback of having a limited time to withdraw the prizes, a potential solution could be to let users specify a lightning address before the prizes are assigned so they are sent automatically if they win. On-chain addresses could be used as well if #5 is implemented.
And more... Feel free to leave comments on the existing issues and to open new ones if you would like to propose a feature request or report a bug.

Contact

I run the node aftermath, I'm looking for long-lived channels and actively managed nodes.
Minimum size: 2M. Private channels are rejected to avoid locked liquidity (this may change in the future).
I will be reading your feedback here and answering any questions. You can also contact me on Telegram at @aftermath02.
Love it all! Except the Telegram part..
Surely Simplex or Nostr or something for notifications that is at least open source and trustworthy, and doesn't require a phone number or shitcoin?
Email, even. Appreciate that this is optional, but still, f*ck Telegram.
reply
I opted to use Telegram because there are many Bitcoin communities there, it can be proxied over tor and was super simple to integrate.
But I agree with you and will take into consideration the options you suggested. I have created the following issue to fix this https://github.com/aftermath2/btry/issues/23.
Thank you for the feedback!
reply
Thanks! Indeed, I don't get how so many Bitcoiners are like 'yeah, sovereignty' whilst simultaneously installing crapware like telegram, facebook etc on their personal tracking devices..
Good luck with the project
reply
Very neat! I was mulling over the plausibility of this concept just yesterday, glad to see someone working on making it reality. As a curious engineer i hope you'll indulge me in some friendly questions :)
Please correct me if I'm wrong, but from a glance at the code, it seems like the winner is chosen by the server completely at random. How is that verifiable?
It computes a die roll, weighted by bet size, which seems OK. But the actual entropy for the die roll is pulled from the server's internal RNG. I can't see where the 'provable fairness' or 'auditability' of the winner is derived from. Even though the source code is honest, the actual deployed server might be colluding to award prizes to specific player(s). Honest players would have no way of knowing.
Furthermore, the server could abstain from distributing prizes at all, keeping all the money paid into a lottery for itself. How can players tell if a prize was paid correctly, or paid at all?
It would make more sense to me if the winner was selected by hashing some undisputable but unpredictable future data, like the hash of a yet-to-be-mined block, along with a lottery-specific salt to prevent tampering by miners. With BitVM, you might even be able to set up a contract to punish the server if someone can prove the wrong winner was chosen. With a well-designed n-of-n multisig contract, the server could commit money to revealing a winner before a given date (or else be punished by players).
Happy to chat anytime if you find these ideas interesting. My github is here if you wanna tag me in any issues.
reply
Thank you for your questions, perhaps I wasn't clear enough in the second part of the post but I will try to explain all your doubts.
it seems like the winner is chosen by the server completely at random. How is that verifiable?
When I mentioned provably fair random numbers I was referring to the Battles implementation, which is a completely different service.
As you said, the winning numbers are generated using an RNG (/dev/random in linux).
However, I did create an issue https://github.com/aftermath2/btry/issues/20 which changes the way in which lotteries duration are measured.
Switching to block-based lotteries would allow the numbers to be generated using the last block hash as an entropy source and that way the users would be able to verify that the numbers are fair.
Even though the source code is honest, the actual deployed server might be colluding to award prizes to specific player(s).
You are right, users have to trust BTRY that the deployed source-code is the one in the repository, unfortunately, I'm not sure it's possible to guarantee that the binary is not tampered.
I did include the current commit at the bottom of the page to make it harder for the server to cheat.
the server could abstain from distributing prizes at all, keeping all the money paid into a lottery for itself. How can players tell if a prize was paid correctly, or paid at all?
Prizes withdrawals are not listed because I wanted to avoid showcasing any information that could be considered sensitive.
However, you could listen to the SSE stream at {url}/api/events?stream=events to the messages of type "payments" and receive updates every time a user makes a withdraw. All you will be able to see is the payment_id and status though.
It would make more sense to me if the winner was selected by hashing some undisputable but unpredictable future data, like the hash of a yet-to-be-mined block
I'm not sure I understood this completely. If the data is unpredictable how can users verify it? A hash of a yet-to-be-mined block can be whatever the server wants to, so we wouldn't solve the problem.
As I mentioned before, we could use the latest block hash as a source of entropy because picking the numbers the server wants in that short period of time would be nearly impossible.
With BitVM, you might even be able to set up a contract to punish the server if someone can prove the wrong winner was chosen. With a well-designed n-of-n multisig contract, the server could commit money to revealing a winner before a given date (or else be punished by players).
That's a great idea! I haven't digged into BitVM much yet, but I would love to learn more about it and to implement something like that.
Happy to chat anytime if you find these ideas interesting. My github is here if you wanna tag me in any issues.
I'll tag you in the ones I mentioned above. I'm really interested in having technical conversations and discussing about any Bitcoin topic or even contributing to any projects you may have. I'm open to chatting if you want to!
reply
I appreciate your work on this, but me personally I NEVER gamble with my sats. That's why I can afford to live off my BTC nowadays... meanwhile others are gambling with their money.... more sats for me.
reply
I 100% agree with you, I never gamble myself and will never do. But some people find it entertaining and there were no similar solutions so I though it would be a good project to get started.
reply
50 sats \ 1 reply \ @OT 15 Nov 2023
Nice project!
How do you say it? "bee-te-ry"?
reply
Thanks! I pronounce it "bee-try" because it sounds better to me, but initially the name was "Bittery" so I guess both ways are valid.
reply
I'm not much of a gambler myself, but I recognize that there is potential for this market in Bitcoin. In my opinion, almost anything that brings activity to the blockchain is good. Congratulations on the initiative and good luck!
reply
Absolutely, my intention is to help the network and this community to grow. Thank you for you words!
reply
awesome fren great work
reply
Thank you!
reply
Your node is offline, please have a look at it.
reply
CC @Paulysats and @lightning_roulette who were interested in this project
reply