Skip to main content

2018 | Buch

Building Games with Ethereum Smart Contracts

Intermediate Projects for Solidity Developers

insite
SUCHEN

Über dieses Buch

Learn how to take your existing knowledge of Ethereum and Solidity to the next level. Hone your development skills and become more familiar with the syntax of the Solidity language by working through well-tested, well-documented intermediate-level sample projects.

You will begin by covering the basics of Ethereum, Solidity, and gaming theory. From there, you will move onto sample projects that use smart contract engineering to create fun casino-style games that you can deploy and test on your friends and colleagues with real ether. All games are provably fair and auditable, so that players know the house won’t always win!

Ideal for any reader with exposure to Ethereum, the techniques this book teaches are applicable to game developers, software engineers, web developers, and cryptocurrency enthusiasts.

What You'll Learn

Use various features and best practices for smart contract programming in Ethereum and SolidityDevelop and deploy games of chance, similar to the kind you’d find in a casino

Create fun, easy projects with Ethereum

lntegrate the Ethereum blockchain into games

Who This Book Is For

Entry-level programmers with some exposure to Ethereum; game developers, Blockchain and cryptocurrency enthusiasts looking to add Ethereum and Solidity development to their skill set; software engineers and Web developers

Inhaltsverzeichnis

Frontmatter
Chapter 1. Conceptual Introduction
Abstract
This chapter provides a high-level overview of the Ethereum blockchain. The blockchain is an ordered series of blocks, each of which is an ordered series of transactions. A transaction runs on the Ethereum Virtual Machine and executes code that modifies the state tree. We will explore each of these concepts in more detail in the following sections.
Kedar Iyer, Chris Dannen
Chapter 2. The Ethereum Development Environment
Abstract
This chapter walks you through the setup and installation of tools required to run the Ethereum blockchain. We cover hardware requirements, operating system requirements, and software requirements. After covering the installation of the software, we provide the basic commands required to interact with the Ethereum network.
Kedar Iyer, Chris Dannen
Chapter 3. First Steps with Ethereum
Abstract
This chapter is the first of our applied practice chapters. It walks through the two fundamental Ethereum interactions. In the first project, we will broadcast a transaction to three Ethereum networks. In the second project, we will deploy a simple Hello World contract.
Kedar Iyer, Chris Dannen
Chapter 4. Smart Contracts in the Abstract
Abstract
This chapter covers the theory behind smart contract programming, with a special focus on Truffle, Solidity, and the Ethereum protocol. The chapter is laid out in a fashion that allows it to be used as a reference while we’re coding the games in the later chapters of the book. This chapter is intended for readers who have prior exposure to programming.
Kedar Iyer, Chris Dannen
Chapter 5. Contract Security
Abstract
Strong security is the foundation of blockchain technology. Without it, blockchains offer no advantage over traditional software. This chapter, covers security best practices for Solidity. Security of the Ethereum blockchain itself is covered in Chapter 6. Thousands of ether have been lost or hacked from smart contracts because of poorly written code. Following the best practices in this chapter will minimize the chances of that happening to your own contracts.
Kedar Iyer, Chris Dannen
Chapter 6. Crypto-economics and Game Theory
Abstract
In this chapter, we cover block production methods, blockchain security, consensus, the importance of good incentives, and the most common attack vectors on a typical blockchain.
Kedar Iyer, Chris Dannen
Chapter 7. Ponzis and Pyramids
Abstract
This is the first of the project and game chapters that will take us through the remainder of the book. The first six chapters covered the basics of Ethereum and Solidity. We will now move away from theory and dive in to practical examples of Solidity code. Admittedly, Ponzi schemes do not seem at first glance to be the most practical of examples. Surprisingly, though, some of the first interactive smart contracts released on Ethereum were verifiable Ponzi schemes. In this chapter, we will first write a simple Ponzi contract and then explore examples that were deployed on the Ethereum mainnet.
Kedar Iyer, Chris Dannen
Chapter 8. Lotteries
Abstract
Lotteries are an excellent use case for Ethereum. Like pyramids, lotteries were among the first contracts on the Ethereum blockchain. Results are provably fair, enabling the lottery to be run without a central authority taking a cut of the winnings, and without anchoring its operation in any single legal jurisdiction. It is highly likely that the lotteries of the future will be conducted on a blockchain. This chapter covers the primary roadblock to running a good lottery—random-number generation—and develops a series of increasingly complex lottery contracts.
Kedar Iyer, Chris Dannen
Chapter 9. Prize Puzzles
Abstract
Prize puzzles are a unique use case for smart contracts and a great example of blockchains unlocking new functionality. The idea behind a prize puzzle is for a benefactor to put up a bounty for answering a question, using a smart contract to verifiably lock up the reward so that only the correct answer can unlock the contract.
Kedar Iyer, Chris Dannen
Chapter 10. Prediction Markets
Abstract
They don’t enjoy the full legitimacy of stock markets, but they tend to be less silly and address more serious matters than your standard prop bet. Prediction markets start by posing a yes/no question about a future event with a verifiable answer. Users can then bet on the possibility of the event by buying or selling shares in the market.
Kedar Iyer, Chris Dannen
Chapter 11. Gambling
Abstract
Online casinos and gambling sites are notorious for rigging their games. Blockchain-based gambling games offer users a chance to play games with provably fair odds and minimal or no house fees. In this chapter, we cover two gambling games: Satoshi dice and roulette.
Kedar Iyer, Chris Dannen
Backmatter
Metadaten
Titel
Building Games with Ethereum Smart Contracts
verfasst von
Kedar Iyer
Chris Dannen
Copyright-Jahr
2018
Verlag
Apress
Electronic ISBN
978-1-4842-3492-1
Print ISBN
978-1-4842-3491-4
DOI
https://doi.org/10.1007/978-1-4842-3492-1