Vigyata.AI
Is this your channel?

Day 8 of Blockchain | Enhancing the Decentralized Rock, Paper, Scissors Functionality

785 views· 20 likes· 11:52· Jan 8, 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 8 specifically, we’ll make it so that the users continue to play against each other until there is a clear winner. If there's a draw, the players will keep playing. 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

Welcome back to Day 8 of my 10 Days of Blockchain series—this is the episode where our decentralized Rock, Paper, Scissors game finally behaves like a real game. Instead of ending after one round, I update the flow so Alice and Bob keep playing under the same wager until there’s a clear winner. If the outcome is a draw, we loop back and play again, which means the only thing changing is the order of actions: Alice publishes wager + deadline, Bob accepts, then we enter the repeatable “submit hands until not a draw” section. The big concept I teach here is how to implement a while loop in Reach, because the language is normally constant/static and doesn’t let variables change—except inside these loops via variable binding. Since Reach does automatic verification, I also add loop invariants to prove what stays true before and after every iteration (like the contract balance staying at 2 * wager, and the outcome always being valid). Then we commit inside consensus, collect hands, reveal, compute the winner, and explicitly use `continue` to repeat. By the end, the contract always results in a payout (no more “stuck in draw” weirdness), and you’ll see it run through both a first-round win and a draw-then-win scenario. Next up, I’ll move us out of testing mode and into an interactive game with real users.

Frequently Asked Questions

🎬 More from blondiebytes