Book Image

Blockchain for Enterprise

By : Narayan Prusty
Book Image

Blockchain for Enterprise

By: Narayan Prusty

Overview of this book

The increasing growth in blockchain use is enormous, and it is changing the way business is done. Many leading organizations are already exploring the potential of blockchain. With this book, you will learn to build end-to-end enterprise-level decentralized applications and scale them across your organization to meet your company's needs. This book will help you understand what DApps are and how the blockchain ecosystem works, via real-world examples. This extensive end-to-end book covers every blockchain aspect for business and for developers. You will master process flows and incorporate them into your own enterprise. You will learn how to use J.P. Morgan’s Quorum to build blockchain-based applications. You will also learn how to write applications that can help communicate enterprise blockchain solutions. You will learn how to write smart contracts that run without censorship and third-party interference. Once you've grasped what a blockchain is and have learned about Quorum, you will jump into building real-world practical blockchain applications for sectors such as payment and money transfer, healthcare, cloud computing, supply chain management, and much more.
Table of Contents (14 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

Building a client for the ownership contract


In the previous chapter, we wrote Solidity code for the ownership contract. And in both the previous chapter and this one, we learned about web3.js and how to invoke the methods of the contract using web3.js. Now, it's time to build a client for our smart contract so that users can use it easily.

We will build a client where an enterprise's user selects a file, enters owner details, and then clicks on Submit to broadcast a transaction to invoke the contract's set method with the file hash and the owner's details. Once the transaction is successfully broadcasted, we will display the transaction hash. The user will also be able to select a file and get the owner's details from the smart contract. The client will also display the recent set transactions mined in real time.

We will use sha1.js to get the hash of the file on the frontend, jQuery for DOM manipulation, and Bootstrap 4 to create a responsive layout. We will use Express.js and web3.js on...