Inspiration

Online and physical casinos are very bad, the dealer always wins and there is a lack of transparency about winning rates. No one can know in advance the exact chances of winning, and if you want to play you always have to trust the centralized entity running the games. This inspired us on creating a completely no-profit zone, where people can play with whatever tokens they possess using IBC.

What it does

On Cosmos Casino players will find a variety of games with different rules, the first one available is the "Lottery Game". A very simple lottery where anyone can buy a ticket, every two hours a winner is extracted and will win the entire prize pot, minus a small % going to the community pool. Funds in the community pool will be spendable through on-chain governance for example to develop new games or to donate to charity entities.

How we built it

Our tech stack is divided into two parts, the frontend, and the actual blockchain code. To build the blockchain we decided to bootstrap the project using starport, then we developed a custom module (x/lottery) that has all the logic for our first game. For the frontend, we are using React JS and integration with CosmJS + Keplr.

Challenges we ran into

There was not many documentation about how to construct/sign custom messages using cosmjs. We first had to generate the "codec" using protoc, then we had to extend the querier with our custom queries

/* Query Client */
export const setupLotteryQueryService = async () => {
  const tm = await TendermintClient.connect(chainConfig.rpc, adaptor34);

  const client = QueryClient.withExtensions(tm);
  const rpc = createRpc(client);

  return new LotteryQuery(rpc);
};

Accomplishments that we're proud of

Frontend is very easy to use and well-integrated with the blockchain, providing final users a smooth experience. The website dAPP is 100% statically build and uploaded on IPFS.

What we learned

We learned a lot about how to use CosmJS and Keplr, as well as the new transaction encoding system shipped with cosmos sdk v0.40 >

What's next for Cosmic Casino

We are going to do an airdrop to all ATOM holders to bootstrap the initial token supply, there will not be any selling and we are not allocating any special token for the "team". After that, we will launch the chain with the help of some validators, and everyone will be able to play. We are also still refining the UI, and creating a good-looking logo. The next game will be a "Quiz" game, where anyone can propose a quiz and anyone else can play and try to win the jackpot. We would like to integrate with Band Protocol for oracle prices and to better integrate other tokens in our game.

Built With

+ 19 more
Share this project:

Updates