
Learn Blockchain Programming with JavaScript
Build your very own Blockchain and decentralized network with JavaScript and Node.js
- 252 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Learn Blockchain Programming with JavaScript
Build your very own Blockchain and decentralized network with JavaScript and Node.js
About this book
Explore the essentials of blockchain technology with JavaScript to develop highly secure bitcoin-like applications
Key Features
- Develop bitcoin and blockchain-based cryptocurrencies using JavaScript
- Create secure and high-performant blockchain networks
- Build custom APIs and decentralized networks to host blockchain applications
Book Description
Learn Blockchain Programming with JavaScript begins by giving you a clear understanding of what blockchain technology is. You'll then set up an environment to build your very own blockchain and you'll add various functionalities to it. By adding functionalities to your blockchain such as the ability to mine new blocks, create transactions, and secure your blockchain through a proof-of-work you'll gain an in-depth understanding of how blockchain technology functions.
As you make your way through the chapters, you'll learn how to build an API server to interact with your blockchain and how to host your blockchain on a decentralized network. You'll also build a consensus algorithm and use it to verify data and keep the entire blockchain network synchronized. In the concluding chapters, you'll finish building your blockchain prototype and gain a thorough understanding of why blockchain technology is so secure and valuable.
By the end of this book, you'll understand how decentralized blockchain networks function and why decentralization is such an important feature for securing a blockchain.
What you will learn
- Gain an in-depth understanding of blockchain and the environment setup
- Create your very own decentralized blockchain network from scratch
- Build and test the various endpoints necessary to create a decentralized network
- Learn about proof-of-work and the hashing algorithm used to secure data
- Mine new blocks, create new transactions, and store the transactions in blocks
- Explore the consensus algorithm and use it to synchronize the blockchain network
Who this book is for
Learn Blockchain Programming with JavaScript is for JavaScript developers who wish to learn about blockchain programming or build their own blockchain using JavaScript frameworks.
Tools to learn more effectively

Saving Books

Keyword Search

Annotating Text

Listen to it instead
Information
Building a Blockchain
- Learning how to create a Blockchain constructor function
- Building and testing various methods such as createNewBlock, createNewTransaction, and hashBlock to add functionalities to the blockchain
- Understanding what proof of work is and learning how to implement it for our blockchain
- Creating and testing a genesis block
Before we get building...
- The JavaScript constructor function
- The prototype object
An explanation of the JavaScript constructor function


function User() {
} 
- The first user that we are going to create – let's call it user1 – will be defined as follows:
var user1 = new User('John','Smith',26,'male'); - Then press Enter, and user1 is in the system. Now, if we type user1 in the console, we'll be able to see what we just created in the previous step:

- For clarity, try adding one more user. This time, we'll create another user called user200 and pass in into the new User ( ) function with the user's properties, such as a first name of Jill, a last name of Robinson, an age of 25, and a female gender:
var user200 = new User('Jill', 'Robinson', 25, 'female'); - By pressing Enter, our new user200 will be in the system. Now, if we type user200 into the console and press Enter, we'll see the following output:

Explanation of the prototype object
Table of contents
- Title Page
- Copyright and Credits
- About Packt
- Contributors
- Preface
- Setting up the Project
- Building a Blockchain
- Accessing the Blockchain through an API
- Creating a Decentralized Blockchain Network
- Synchronizing the Network
- Consensus Algorithms
- Block Explorer
- In conclusion...
- Other Books You May Enjoy
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app