Cvip Decentralized Casino offers a simple experience like connecting a wallet placing a bet on some random number and getting rewarded if your guess is correct, without any kind of authentication like logins via email. But first of all, let's define our goal. We want our casino to work this way:

A user chooses some number between 0 and 99 and bets ETH on this number. The user gets notified if they win immediately after a block with this transaction is added to the blockchain (it means the result should be available in the exact same block).

After this, the user can send another transaction to claim their prize which is their bet multiplied by 99

The requirements are also very simple:

No centralized services.

No random oracles - they are cool, but we can do it without their help.

Security is the first priority - no one should be ever able to get an advantage of the casino to increase their chance of winning.

First. The nature of casinos. When I think of the word "casino" I imagine something bright, rich and luxurious. Las Vegas, neon signs, gold, drugs and easy money. We are attracted by these dreams of instant wealth. And we are sure that the place that can make us rich should have billions of dollars in its safes. We don't know how much money do casinos possess in reality, but we believe there is much.

This is very important. All these luxury things won't matter if there is a big display inside the casino that shows how much money the casino has available in the prize fund. You can't say "Come on, everybody gets a million!" if everyone sees that you only have $10k.

And in the decentralized world, there is such a display for everything. Everyone could check how much money your contract has on it and then adjust their expectations.

We can't fix this problem. If our casino has only 1 BNB on its balance, there is no way to win 100 BNB in it. This makes it less attractive to users - no one is becoming a millionaire in one night. But we can offer transparency in exchange. We can say: "Here are the rules. No one can break them (even the casino owners). If you follow these rules, you have a fair chance to transform your $1 into $99 in seconds. No lies".

Every casino needs a reliable source of randomness. Centralized casinos don't have randomness - they have algorithms to make money and sometimes share a bit with some lucky ones. Decentralized casinos can't do things the same way - they should be fair. Moreover, randomness in a decentralized casino is the key point of security - it is the armoured door protecting the prize fund. If your casino has weak randomness, your prize fund will be stolen.

Randomness is hard to achieve in a deterministic environment because it is defined to be undetermined. They are two incompatible things. However, there are some tricks to obtain secure randomness in such an environment as EVM and I will teach you them.

What is DEX?

A Decentralized Exchange (DEX) is a type of cryptocurrency exchange that operates without a centralized authority or intermediary. Unlike traditional exchanges, which are centralized and require users to deposit funds into the exchange's custody, DEXs allow users to trade directly from their cryptocurrency wallets.

Last updated