Vigyata.AI
Is this your channel?

Day 3 of Blockchain | Creating a Decentralized Rock, Paper, Scissors Application

2.2K views· 64 likes· 13:59· Jan 3, 2022

🛍️ Products Mentioned (7)

So it turns out - blockchain is actually pretty cool. I’m super excited to be partnering with Reach and Algorand to create a YouTube series that tackles how to create decentralized applications with blockchain technology. In 10 Days of Blockchain, you’ll learn what a blockchain is, build a decentralized application, and deploy it to the Algorand blockchain. With Day 3 specifically, we'll create a decentralized Rock, Paper, Scissors application. Thank you for watching! ✅ NOTE: Reach documentation at the time of your viewing may be slightly different than when I recorded. When in doubt, follow the documentation, and if you have questions, connect with the Reach community in Discord. ⛓ Discord Community! Reach HQ: https://discord.gg/reachsh Got a question? Ask it here: https://discord.com/channels/628402598663290882/912484855789518848 ⛓ More about Reach! Website: http://reach.sh Links: https://reach.crd.co/ Documentation: https://docs.reach.sh Questions & Support: help@reach.sh ⛓ More about Algorand! Website: https://www.algorand.com/ My courses on LinkedIn Learning! https://www.linkedin.com/learning/instructors/kathryn-hodge Support me on Patreon! https://www.patreon.com/blondiebytes

About This Video

In Day 3 of my 10 Days of Blockchain series, I start wiring up the actual Rock, Paper, Scissors logic for a decentralized app using Reach (and deploying to Algorand). Before we even touch the “game,” I break it down into the components we need to represent in code: players (Alice and Bob), hands (rock/paper/scissors as 0/1/2), and outcomes (Bob wins/draw/Alice wins as 0/1/2). Then I define a shared participant interact interface called `Player` so the backend knows it can ask both participants for a move (`getHand`) and tell them the result (`seeOutcome`). On the frontend, I implement those behaviors: I set up arrays for hands and outcomes, build a reusable `Player` constructor, randomly pick a move using `Math.random()` + `Math.floor()`, and log what each player chose. On the backend in Reach, I show how decentralized “simultaneous reveal” isn’t really a thing, so we pick an order: Alice publishes first, then Bob publishes, and the consensus network computes the outcome using a clean modulo trick. Finally, I use `each` to send the outcome back to both frontends—because the whole point is that consensus guarantees everyone agrees on the result.

Frequently Asked Questions

🎬 More from blondiebytes