[Prepare for PBA] pba_book: blockchain from scratch (c1_state_machine) #7
chungquantin
started this conversation in
Activities
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Required reading: https://polkadot-blockchain-academy.github.io/pba-book/blockchain-contracts/services-as-state-machines/page.html
What's intriguing is that the majority, if not all, of the systems we are concerned with can be conceptualized as state machines. A state machine isn't a tangible, touchable machine in the physical sense; rather, it's a model consisting of a defined set of states and a set of rules governing the transitions between those states. In visualizing this, imagine my state machine initiating from state one, and then an external trigger, perhaps akin to a specific action or transaction in blockchain terms, propels it into state two.
Therefore, our objective with the blockchain is to meticulously record the entire sequence of these transitions. By maintaining a comprehensive history of all transitions, we gain the ability to discern our current state in the system.
Below are the solutions for the exercise
c1_state_machine
inpba_book
. Please use this as a reference if you get any blockers. I still recommend working through the problem set on your own so you can fully understand the concept of the state machine.Other learning materials
Answer
p1_switches.rs
p2_laundry_machine.rs
p3_atm.rs
p4_accounted_currency.rs
p5_digital_cash
p6_open_ended.rs
Beta Was this translation helpful? Give feedback.
All reactions