Since a number of people were quite excited about the idea of having more Plutus smart contract examples I decided to create a SC “series”. This series goes step by step in setting up a Jellybean Guessing Game from an empty SC all the way to automating closing the game and user input error checking. There are 8 contracts in total and each file has a short explanation commented in. Eventually this may end up becoming a full-fledged tutorial with detailed instructions on all of the specifics, but for now due to time-constraints this ‘series’ is geared for the more dedicated individual.
In this ‘series’ the topics that are covered include:
- How to lock funds in a smart contract (with a DataScript attached)
- How to attempt to redeem funds from a smart contract (with a RedeemerScript attached)
- How on-chain code works/how it validates whether a collectFromScript call is valid.
- How to hash the winning number and validate the hashed guess.
- How to set up wallet triggers/handlers to automate closing the game after block #10 if the player failed to guess the answer in time.
- How to check data inputed via the UI to make sure it is valid, else throw an error.
I look forward to seeing more devs jump in and start using Plutus, so if you have any questions feel free to ask them here and I’m sure it’ll end up helping out a lot of other people too.