Sixth milestone — Lottery

Lumenswap
Lumenswap
Published in
4 min readOct 20, 2021

Greetings Lumenswap community!

We are excited to introduce the first fully transparent, decentralized lottery model built on Stellar.

http://lottery.lumenswap.io/

Every day, we are inspired by the opportunities that the cryptocurrency ecosystem creates for people all around the world to participate in. We are also inspired by the amazing potential that Stellar has to revolutionize global economies. As a result, we wanted to apply this revolution to the lottery industry.

Unlike traditional lotteries, we want to give you a fair, democratic chance of winning by establishing a transparent and decentralized lottery model.

Introduction

At a glance, our model operates just like more traditional lotteries. Our lottery will function within a set timeframe, with a ticket required for participation, and the prize paid to the winner.

Unlike traditional lotteries, the prize will be pegged to the equivalent value in XLM, the ‘ticket’ will be digital and the winner is chosen through a decentralized mechanism, not by a fat man sitting behind his desk petting his cat!

But here’s the key difference:

Everything will happen on a distributed network with immutable records. This bit is really important. By leveraging the transparency of blockchain technology, we are creating a fair, open, global, and accessible lottery platform.

How to Participate in the Lottery

To participate in a lottery round, you need to buy a ticket while the round is open.

How do you purchase tickets?

It’s simple. You just need to transfer your LSP to the GAB7…24WK (through our interface or manually), and the transaction hash will serve as your ticket ID.

Lumenswap will independently set ticket prices for each round and announce them in the Round Introduction article. Because we’re aiming for maximum inclusion, tickets will be priced in a way that anyone with any financial capacity can participate.

Note: Round 1 will be live on October 22 and in the Round introduction article, we will give more complete information about how to buy tickets.

The lottery is completely open, so anyone can buy as many tickets as they want. However, this raises a question: How do we plan to prevent whales from buying many tickets?

The answer is that we don’t! We don’t believe in limiting individuals in the name of fairness. Instead, through transparency and decentralization, we want to ensure that everyone has a chance to win in proportion to their purchase volume.

Note: The address to which LSP is sent is the contract address. All pooled LSP will be removed from circulation. Each lottery round will therefore also serve as a token-burning mechanism. This is the first upgrade to our tokenomics roadmap and serves as an important milestone in delivering more value for the Lumenswap ecosystem and community.

Choosing the Winner

We have created a fair model so that everyone can understand the winner selection process.

At the beginning of each round, the Lumenswap team specifies a ledger/block number on Stellar that will be generated in roughly 30 days after the round starts.

Once that specific ledger is created, the winner selection process starts.

The mechanism works by comparing ticket hashes to the ledger hash to find the longest matching substring:

It starts by comparing the first character of the ledger hash with that of ticket IDs. Non-matching hashes are eliminated and the matching ones proceed to the next step where the second characters are compared. The process continues until a single ticket ID remains, which will be designated as the lottery winner.

Let us demonstrate this process with a few examples.

Scenario 1

Let’s say we have three tickets for one round:

T1: 9330ba3bc04d04b258390f8c7e42fe03af57b79d5413a53341e0c09a306534

T2: 3ab2ddf00b4c17ceea016d45b6ac11cc1d4c70ee7b943de72669210ae7098a

T3: 378f0d225a59c7caabe46079a3aef6edba47ab7838c45feffc6abb9436808f1e

And the ledger hash is:

3ac61ddc1df04bd76fe965d3193710d130baa85503cd911a7ddb37b674432b

Here, we compare the first character of the ticket IDs with that of the specified ledger hash. As you can see, the first character of T2 and T3 is the same as the first character of the ledger hash — unlike T1. So, T1 is removed, and we repeat the same process for the second character of the hashes. T2 has the same second character as the ledger hash as opposed to T3. So, Ticket 3 is eliminated and T2 wins the lottery.

Scenario 2

Let’s say we have three tickets for one round.

T1:

32p0ba3bc04d04b258390f8c7e42fe03af57b79d5413a53341e0c09a306

T2:

3kd2ddf00b4c17ceea016d45b6ac11cc1d4c70ee7b943de72669210ae70

T3:

37of0d225a59c7caabe46079a3aef6edba47ab7838c45feffc6abb9436808

And the ledger hash is:

3192e59ab9d0d239769f1db1d0cec388796f8c6c04a0653b6a88e79e46f09

Here, we compare the first character of the ticket IDs with the first character of the desired ledger hash. As you can see, all the tickets have the same first character, which matches the first character of the ledger hash. So, we move on to the next step to compare the second characters. None of the second characters matches the second character of the ledger hash. What happens now?

In this case, the ticket with the earliest timestamp is selected as the lottery winner.

Conclusion

If you have liked our concept, we would love you to share this new lottery model with your friends. We’re only as valuable as our community, and want to give back to our loyal members. It’s just the first step of our evolution towards transforming decentralized finance with Stellar, and we can’t wait to share it with you.

Thank you for reading this article.

--

--