Building
Decentralized
Blockchain
Applications
Learn How to Use Blockchain as
the Foundation for Next-Gen Apps
Shahid Shaikh
www.bpbonline.com
FIRST EDITION 2021
Copyright BPB Publications, India
ISBN: 978-93-89898-620
All Rights Reserved. No part of this publication may be reproduced, distributed or transmitted in any form or by any means or stored in a database or retrieval system, without the prior written permission of the publisher with the exception to the program listings which may be entered, stored and executed in a computer system, but they can not be reproduced by the means of publication, photocopy, recording, or by any electronic and mechanical means.
LIMITS OF LIABILITY AND DISCLAIMER OF WARRANTY
The information contained in this book is true to correct and the best of authors and publishers knowledge. The author has made every effort to ensure the accuracy of these publications, but publisher cannot be held responsible for any loss or damage arising from any information in this book.
All trademarks referred to in the book are acknowledged as properties of their respective owners but BPB Publications cannot guarantee the accuracy of this information.
Distributors:
BPB PUBLICATIONS
20, Ansari Road, Darya Ganj
New Delhi-110002
Ph: 23254990/23254991
MICRO MEDIA
Shop No. 5, Mahendra Chambers,
DN Rd. Next to Capital Cinema,
V.T. (C.S.T.) Station, MUMBAI-400
Ph: 22078296/22078297
DECCAN AGENCIES
4-3-329, Bank Street,
Hyderabad-500195
Ph: 24756967/24756400
BPB BOOK CENTRE
Old Lajpat Rai Market,
Delhi-110006
Ph: 23861747
Published by Manish Jain for BPB Publications, Ansari Road, Darya Ganj, New Delhi-110002 and Printed by him at Repro India Ltd, Mumbai
www.bpbonline.com
Dedicated to
Satoshi Nakamoto,
The Inventor of Bitcoin and Blockchain
About the Author
Shahid Shaikh is a software architect with 6+ years of experience working with emerging technologies. He is also an author and has written three books, and he is an active open source contributor. He has expertise in Blockchain, distributed systems, and software architecture.
Apart from writing code and authoring books, he is a vintage bike enthusiast and rides his vintage Royal Enfield across various locations. He has a keen interest in carbon-free energy generation, space exploration, and electric vehicles.
About the Reviewer
Rahil is a computer engineer and is currently working as the VP of Architecture and Blockchain in one of Indias leading Crypto-currency exchanges.
He is currently helping his company implement and scale their Blockchain and Exchange technology.
Rahil completed his Bachelors in Engineering from Mumbai University in 2013 and has over years of experience in working with emerging technologies, including Blockchain. He is highly passionate about Blockchain. He believes that Bitcoin and other decentralized systems are going to change the world for the better, and they are absolutely the best way forward.
Rahil is also the creator of ciphertrick.com and the getting started Youtube channel, where he regularly shares his knowledge with the community.
He lives with his wife and family in Mumbai. You can reach out to him on twitter; his Twitter handle is
LinkedIn Profile:
https://www.linkedin.com/in/rahil-shaikh-38675978/
Check out his latest video course on Deno:
https://www.youtube.com/playlist?list=PL5YcOcm9rSqzUThvf1oHgx2EqLqlW-0vn
Acknowledgement
There are a few people I want to thank for their continued and ongoing support while I was writing this book. First and foremost, I would like to thank my family for putting up with me while I was spending many weekends and evenings on writingI couldnt have completed this book without their support.
I would also like to thank Rahil for providing his insight with a technical review of this book.
Finally, I would like to thank the entire BPB Publications team for giving me the opportunity to write this book.
Preface
Bitcoin, upon its inception in 2008, took the financial world by storm. It became the first alternative to the debt-based paper currency. Bitcoin is powered by the underlying technology that shocked the technology world. The core technology was named Blockchain - immutable proof of records linked together in a chain and distributed across every peer in the world.
This simple yet powerful concept opens a new branch in the computing world. Blockchain is being conceptualized to be used in sectors like supply chain, medical records, and land records.
I ventured into blockchain and cryptocurrency in early 2015. To learn more about it, I joined one of Indias largest crypto exchanges and helped them build and scale their infrastructure. I gained treasure knowledge while working on the exchange.
One of the branches of Blockchain is the decentralized application. This is the new set of applications that offer alternatives to the traditional client/server model of web development. Using this approach, developers can build next-generation applications with the core blockchain technology.
Decentralized applications are slowly venturing into the real-world applications, and this was my motivation to author this bookto provide in-depth information and knowledge about Blockchain and decentralized application to the readers.
Chapter discusses blockchain and explains the core technologies that power the blockchain. We will also learn about Bitcoin and how it works in depth.
Chapter looks at the Ethereum and smart contracts in detail. The smart contract is the turing complete programming language to build the application that can be executed on the Ethereum blockchain.
Chapter helps you learn about interplanetary file systems and how to use them to build decentralized applications. IPFS is the ground breaking technology to build next-generation blockchain applications.
Chapter introduces the first decentralized database of this bookOrbitDB. It is a serverless peer-to-peer decentralized database software that runs on top of IPFS. OrbitDB provides easy-to-use APIs to help developers integrate and build applications.
Chapter discusses the BigchainDBa blockchain based database. BigchainDB is an asset-focused database that provides all the blockchain features, along with modern database capabilities such as indexing, querying, and processing.