Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Blockchain Developer's Guide

You're reading from   Blockchain Developer's Guide Develop smart applications with Blockchain technologies - Ethereum, JavaScript, Hyperledger Fabric, and Corda

Arrow left icon
Product type Course
Published in Dec 2018
Publisher
ISBN-13 9781789954722
Length 564 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Authors (4):
Arrow left icon
Paul Valencourt Paul Valencourt
Author Profile Icon Paul Valencourt
Paul Valencourt
Brenn Hill Brenn Hill
Author Profile Icon Brenn Hill
Brenn Hill
Narayan Prusty Narayan Prusty
Author Profile Icon Narayan Prusty
Narayan Prusty
Samanyu Chopra Samanyu Chopra
Author Profile Icon Samanyu Chopra
Samanyu Chopra
Arrow right icon
View More author details
Toc

Table of Contents (37) Chapters Close

Title Page
Copyright
About Packt
Contributors
Preface
1. Blockchain 101 FREE CHAPTER 2. Components and Structure of Blockchain 3. Decentralization Versus Distributed Systems 4. Cryptography and Mechanics Behind Blockchain 5. Bitcoin 6. Altcoins 7. Achieving Consensus 8. Advanced Blockchain Concepts 9. Cryptocurrency Wallets 10. Alternate Blockchains 11. Hyperledger and Enterprise Blockchains 12. Ethereum 101 13. Solidity 101 14. Smart Contracts 15. Ethereum Accounts and Ether Tokens 16. Decentralized Applications 17. Mining 18. ICO 101 19. Creating Your Own Currency 20. Scalability and Other Challenges 21. Future of Blockchain 22. Understanding Decentralized Applications 23. Understanding How Ethereum Works 24. Writing Smart Contracts 25. Getting Started with web3.js 26. Building a Wallet Service 27. Building a Smart Contract Deployment Platform 28. Building a Betting App 29. Building Enterprise Level Smart Contracts 30. Building a Consortium Blockchain 1. Other Books You May Enjoy Index

Building the betting contract


In our betting application, two people can choose to bet on a football match with one person supporting the home team and the other person supporting the away team. They both should bet the same amount of money, and the winner takes all the money. If the match is a draw, then they both will take back their money.

We will use the FastestLiveScores API to find out the result of matches. It provides a free API, which lets us make 100 requests per hour for free. First, go ahead and create an account and then generate an API key. To create an account, visit https://customer.fastestlivescores.com/register, and once the account is created, you will have the API key visible at https://customer.fastestlivescores.com/. You can find the API documentation at https://docs.crowdscores.com/.

For every bet between two people in our application, a betting contract will be deployed. The contract will contain the match ID retrieved from the FastestLiveScores API, the amount of wei...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime