Skip to Content
Mastering Blockchain Programming with Solidity
book

Mastering Blockchain Programming with Solidity

by Jitendra Chittoda
August 2019
Intermediate to advanced
486 pages
13h 52m
English
Packt Publishing
Content preview from Mastering Blockchain Programming with Solidity

State machine pattern

In a state machine, the initial state and the final state are known for the machine/process. Between these two states, there could be more intermediate states. In each state, different behaviors or functions are allowed on the machine. For example, a vending machine is a state machine, in which it first asks for the user to select the item number, and, once selected, it moves to the collect amount state. Once the amount is paid by the user, it dispenses the item requested by the user and, at last, the process ends. 

The state machine pattern allows a contract to transition from different states and enables certain functions to be executed in each state.

A Solidity contract can be designed in such a way that it represents ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Ethereum

Mastering Ethereum

Andreas M. Antonopoulos, Gavin Wood
Complete Cryptocurrency and Blockchain Course | Learn Solidity

Complete Cryptocurrency and Blockchain Course | Learn Solidity

Ravinder Deol, Codestars By Rob Percival, Thomas Wiesner

Publisher Resources

ISBN: 9781839218262Supplemental Content