Book Image

Building Blockchain Projects

By : Narayan Prusty
Book Image

Building Blockchain Projects

By: Narayan Prusty

Overview of this book

Blockchain is a decentralized ledger that maintains a continuously growing list of data records that are secured from tampering and revision. Every user is allowed to connect to the network, send new transactions to it, verify transactions, and create new blocks, making it permission-less. This book will teach you what blockchain is, how it maintains data integrity, and how to create real-world blockchain projects using Ethereum. With interesting real-world projects, you will learn how to write smart contracts which run exactly as programmed without any chance of fraud, censorship, or third-party interference, and build end-to-e applications for blockchain. You will learn about concepts such as cryptography in cryptocurrencies, ether security, mining, smart contracts, solidity, and more. You will also learn about web sockets, various API services for Ethereum, and much more. The blockchain is the main technical innovation of bitcoin, where it serves as the public ledger for bitcoin transactions.
Table of Contents (16 chapters)
Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface

Block time


The block difficulty formula we saw earlier uses a 10-second threshold to make sure that the difference between the time a parent and child block mines is in is between 10-20 seconds. But why is it 10-20 seconds and not some other value? And why there such a constant time difference restriction instead of a constant difficulty?

Imagine that we have a constant difficulty, and miners just need to find a nonce to get the hash of the block less and equal to the difficulty. Suppose the difficulty is high; then in this case, users will have no way to find out how long it will take to send ether to another user. It may take a very long time if the computational power of the network is not enough to find the nonce to satisfy the difficulty quickly. Sometimes the network may get lucky and find the nonce quickly. But this kind of system will find it difficult to gain attraction from users as users will always want to know how much time it should take for a transaction to be completed, just...