Morra Game DApp using Reach

Charles Livuza
4 min readSep 16, 2022

--

By Team 48: Collins Amayo & Charles Livuza

Umoja Bounty Hack 3

Introduction

The project objective was to build a decentralized morra game dApp using Reach running on top of the Algorand blockchain network to show how the decentralized technology works.

Morra Game

This is a hand game that dates back thousands of years to ancient Roman and Greek times. Currently, the game is popular around the world, especially in Italy. Each player simultaneously reveals their hand, extending any number of fingers, and calls out a number. The player who successfully guesses the total number of fingers revealed by all players combined scores a point.

Morra Game
morra game

About Reach

Reach is a Cross-Blockchain deployment and development tool built on both the frontend and backend. This provides the ability to interact between the backend calling functions in the frontend. Reach deploys the dApp to the Algorand blockchain and provides verification via mathematical proofs and assertions. Blockchain enthusiasts even with a little programming background can get started by Reach using the Rock Paper Scissor tutorial as the baseline. The tutorial is very simple to understand and follow in the implementation as your first-time Decentralized App development.

Reach is a Domain Specific Language (DSL) that makes it easy to write and verify smart contracts. Reach programs can be formally verified to prove facts that the dApp does not lock away funds or does not spend more than it has.

Building the dApp, Backend and Frontend Approach

The Backend provides the implementation of the dApp and determines what is published to the blockchain and how. The backend handles solution implementation, Frontend interfaces, Participant definitions, verification, and commitment as well as dApp logic. The code for the completed backend for the Morra solution can be found in the index.rsh.

The Frontend provides functions on accounts such as creating accounts, interact method logic, dApp deployment, and any blockchain-specific code. The frontend can be created in a variety of high-level languages using Remote Procedure Calls (RPC) such as JavaScript, Python, Go, and C# and deployed to platforms such as iOS, Android, websites, and console apps. The code for the completed frontend for the Morra solution can be found in the index.mjs.

The Reach RPC Server provides access to compiled JavaScript backends via an HTTPS-accessible JSON-based RPC protocol. The server allows frontends to be written in any programming language. Reach provides client libraries for JavaScript, Python, and Go. It is easy to implement a client library yourself.

Reach Architecture with Algorand

Reach dApp Life Cycle

Unlike other blockchain development environments that typically include several different tools, Reach dApp Life Cycle creation is done entirely within the product.

  • Protocol Design — Reach programming language
  • Smart Contract– Reach compiler
  • Middleware — Reach API
  • Frontend — Build with JavaScript
  • Testing — Reach Run
  • Verification — Every Reach compilation includes a thorough formal verification of the dApp using an SMT-based theorem prover.
  • Deployment — Reach compiler configurations to deploy to Algorand Blockchain

A Reach dApp is blockchain agnostic. The focus for a developer using Reach is business logic. Reach takes care of the internals on contract storage, protocol diagrams, state validation, and network details in general.

Conclusion

The kickoff session and Rock Paper Scissor tutorial gave us the baseline on how to approach our project. We also had to research further by visiting the YouTube channel videos and the Reach site to get the best understanding of how Reach projects can be developed. These insights as well as guidance from the mentor made it simpler and easy for us to select the project, brainstorm, and develop the morra game dAPP.

Moreover, the frequent updates from the Reach team that kept us in check also positively impacted our development process. The working in groups approach is very key and indeed worked for us as we shared a lot based on the different skills & backgrounds of the team members. Especially as beginners in Reach programming, we learned much from each other.

Developers Profile

Collins Amayo: Frontend Developer with keen passion and experience. Have worked on projects that span different sectors like e-commerce, logistics, marketing platform, and health. Proficient in React Js, Next JS, and Typescript. Always embrace challenges and seek areas for improving creativity, problem-solving, and skills as a web developer.

Charles Livuza: Experienced project/product manager with a demonstrated history of working in the computer software industry. Skilled in ERPNext, Financial Accounting, Project Management, Python, Google Data Studio, and Power BI. Strong finance professional with a Bachelor’s degree focused in Economics and Finance from Kenyatta University and Data Science skills from Africa Data School. ML, AI, NLP, and Blockchain enthusiasts.

Watch the Youtube video to know more about the Morra Game Dapp:

Complete code for this Morra Game simulation can be found here:

https://github.com/Livuza/Umoja_Morra_Project_By_Collins_And_Charles

--

--