Hands-On Smart Contract Development with Hyperledger Fabric V2
by Matt Zand, Xun (Brian) Wu, Mark Anthony Morris
Chapter 4. Smart Contract Development
In this chapter, you will learn about Fabric smart contract development by examining a simple smart contract and the Fabric APIs used to implement Fabric smart contracts. Once you understand the basics of coding a smart contract and the APIs, we can move on to Chapter 5, where we will take the content from this chapter and apply it to invoking smart contracts. To get started, we first need to download the Hyperledger Fabric development tools. They provide a rapid start to developing Fabric smart contracts by encapsulating a complete two-organization Fabric runtime with scripts to bring it up and take it down.
We are going to use the Hyperledger-provided binaries and sample projects from the Fabric project. These binaries and sample projects will help us start a Fabric test network, and the sample projects provide several example smart contracts from which to learn how to develop your own. This chapter examines an example smart contract from a sample project called Fabcar. The binaries we use have the same name on all supported operating systems.
This chapter will help you achieve the following practical goals:
Writing a Fabric smart contract by using the JavaScript programming language
Installing and instantiating a Fabric smart contract
Validating and sanitizing inputs and arguments in a smart contract
Creating and running simple or complex queries
Working with a private data collection in Fabric
Installing Prerequisites and Setting Up ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access