How the BeFund team developed a promising automated lottery

How the BeFund team developed a promising automated lottery

Lotteries have always benefited their founders and excitement from the game to participants. Since ancient times, people have played among themselves for interest or material values, therefore, in the world of high technologies, lotteries have gained new unique opportunities. With the advent of electronic money and cryptocurrencies, people have the opportunity to participate in lotteries of a new type, which does not require special efforts and predicts considerable winnings. Therefore, for the organizers of the lottery, the lottery is always a profitable business. And a well-defined lottery is an almost inexhaustible source of income. And in this part, BeFund experts have something to say to clients.

Why is the lottery not a casino?

But first you should find out the basic features of any lottery. BeFund is often approached by customers with various tasks related to creating games, but not everyone fully understands the difference between a lottery and a casino. Next, we will consider a specific successful example developed by our company. In the meantime, let’s find out: the lottery is an organized game of luck, in which a raffle of a previously formed monetary fund is provided for among its players. Winning the lottery is random and depends on the random fallout of certain numbers or tickets (lots). Most of the funds contributed by the players go to the formation of the prize fund, some to the lottery organizers, and some are paid in the form of taxes. Instead, in the casino, the competition between the players takes place among themselves or there is a fight for the money of the casino itself. This gives more reasons for dishonest actions on the part of casino owners to preserve and increase their fortunes.

Both lotteries and casinos are subject to the Law and are regulated separately in different countries of the world. We, as software developers, will not talk about legalization, UX/UI solutions and marketing, each of which is extremely important for the existence and development of any lottery. Our goal now is to tell how it all works at the backend level and what ideas the BeFund developers implemented in the project.

A “convenient” lottery is the key to success

One of the last orders for our team involved the development of a lottery according to the typical “6×45” scheme, but with detailed requirements for algorithms of interaction with customers and the use of third-party services. Regarding the blockchain, there were two requirements:

  • Participants have the opportunity to buy lottery tickets for various cryptocurrencies;
  • The results of the draws are stored in the blockchain to increase the level of trust of the participants in the lottery.

Another interesting feature of the project was the priority use of the bot to interact with players. You can buy lottery tickets on the site, but customers wanted the site not to be the main site for customers to visit. This is a very forward-thinking thought, because nowadays people like spending time on different messengers much more than surfing the web. We wrote about this in the article “ How cryptobots from BeFund will help your business? ” of the BeFund blog earlier.

Thus, the use of the Telegram bot to attract participants and the ability to spend various cryptocurrencies should contribute to a greater involvement of users who are simply comfortable participating in the lottery. The issues of technical implementation remained open and our team offered the optimal solution.

How the modern lottery works

Today, there are completely different solutions for organizing electronic lotteries, including ready-made blockchain applications. For example, earlier we implemented a ready-made Samsara Protocol solution that allows you to create smart contracts for running a lottery on the Ethereum blockchain. However, this time the blockchain plays the role of an archive of results, so it is more appropriate to process the information in another way.

BeFund’s solution is built on Python and interacts with the Telegram bot via an API. Integration with TrusWallet, which supports more than 200 coins at once, was approved for accepting various cryptocurrencies. This, according to the customer, was enough, and the custom development of its own solution for accepting currencies and integration with each of them required considerable time and resources.

Lottery draws take place every week and do not have a mandatory minimum number of participants (to be more precise, this limit is only three users). Each lottery ticket has a fixed value each time, and the number of tickets purchased by one player is unlimited. The use of TrusWallet ensures the conversion of cryptocurrencies at the current exchange rate, so anyone who has the corresponding cryptocurrency equivalent can participate in the lottery.

It is worth noting that the main element of the whole scheme — the draw — is the easiest to implement. It is basically a regular randomizer: a code that sequentially generates random numbers in the range from 1 to 45. The numbers cannot be repeated. It is simply impossible to falsify the results of this process, so personal success is really the deciding factor for lottery players.

The system automatically forms a prize fund and calculates administrative fees, which cannot exceed 9% of the total amount of money collected. At the specified time, the random results of the draw are generated and in a few moments the participants know who won and who, unfortunately, did not. The distribution of winnings occurs almost instantly, and it can also be done in the selected cryptocurrency – the conversion will take place at the current exchange rate at the time of the draw.


As a result, BeFund customers received a functional product that meets all the specified requirements. The system works coherently and transparently, and the results can always be verified on the blockchain. All this, in combination with simple terms of participation and communication with the Telegram bot, is really liked by the participants. This demonstrates the weekly increase in lottery participants and the increase in the prize fund. So if you have a desire to start your own lottery, we will be happy to realize your idea in the best way!