Get full access to Beginning Ethereum Smart Contracts Programming: With Examples in Python, Solidity, and JavaScript and 60K+ other titles, with a free 10-day trial of O'Reilly.
There are also live events, courses curated by job role, and more.
Now that you have seen how Smart Contract works and how to interact with them through the use of the web3.js APIs, it is now a good time to explore an application from end to end – from the Smart Contract to the front end, and perhaps give you some ideas for building your own decentralized applications.
How the Lottery Game Works
For this chapter, we will build a lottery game using a Smart Contract. For this contract, we will allow players to place a bet on a number. Figure 10-1 shows how the game works.
In the figure, there ...
Get Beginning Ethereum Smart Contracts Programming: With Examples in Python, Solidity, and JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.
Dive in for free with a 10-day trial of the O’Reilly learning platform—then explore all the other resources our members count on to build skills and solve problems every day.