Cyber•Fund is introducing a series of publications that provide an overview of some of the best speaker topics we’ve hosted at our meetups. Alex Davidov—a developer at DAO Casino—spoke about the use of open source blockchain data for various projects, including the development of smart contracts. According to Davidov, “to date, only a small amount of enthusiasts understand open source code.” That’s why our main goal is to attract new users and widen the open source community by simplifying the user’s experience.

Are you “Crypto-friendly”?

Many projects don’t even interact with the blockchains they are built on. That being said, we have several solutions to breach the barrier between the user’s browser and blockchain. Web3, Toshi and MetaMask are all great existing solutions that ameliorate this problem.

CryptoKitties: an example of how MetaMask can be implemented to reach millions of loyal customers. Users are enamoured by this game because they don’t need to attempt any chimerical tasks like researching or registering transactions. Instead, with three buttons they can earn a unique digital kitty.

DAO Casino’s Smart Contracts

A fairly straightforward way of better understanding the process of how to work smart contracts is in the context of a game.

A player and the bankroll take part in a game where communication occurs off-chain. The logic of the game is also constructed off-chain, and all participants communicate via pending transactions. The rules are stored as logic concurrently formulated by the player, bankroller and smart contract. The game commences as the player’s browser sends JS code—the logic in the form of JS—and once the logic is summarized and processed. For example, if the player rolls a 1, but the bankroller and random both roll a 2, the bankroller wins.

Davidov further explained that “the logic may not converge due to updates or deception, and in the case of no convergence the system records the event and commences the process via a smart contract.” At this point a problem would only exist if the deviations randomly occur, in which case the smart contract simply credits the win to the bankroller.

How the System Avoids Random Deviations

Solidity has a view function that is easily applied to the game’s logic. The view function receives the data that includes the numbers chosen by player 1, player 2 and the randomly generated number. The function then returns the answer as who won the game. The code looks like this:

As we see the code displays the determined profit of 10 tokens, random numbers 1 or 2 and the corresponding logic of the game. If player 1’s number matches the randomly generated number, but player 2’s number doesn’t, then player 1 wins the profit. The interaction occurs within the bounds of the game’s logic, but embedded in a smart contract.

Smart contracts are one of the main functional tools among blockchain systems, and we continue to see new innovative solutions that simplify how we use blockchain technology.

For more information please contact: [email protected]

The above references an opinion and is for information purposes only. It is not intended to be investment advice. Seek a duly licensed professional for investment advice.