Application and transaction stages

The first step in the creation of an application is the instantiation of the blockchain, or the shared ledger itself. In Fabric parlance, an instance of a blockchain is referred to as a channel, and therefore the first step in a blockchain application is the creation of a channel and the bootstrapping of the network ordering service with the channel's genesis block.

The next step is the initialization of the peer network, whereby all the peer nodes selected to run the application must be joined to the channel, a process that allows each peer to maintain a copy of the ledger, which is initialized to a blank key-value store. Every peer that's joined to the channel will possess ledger commitment privileges and may participate in a gossip protocol in order to sync ledger state with each other.

After the creation of the peer network comes the installation of the smart contract on that network. A subset of the peers joined to the channel preceding it will be selected to run the smart contract; in other words, they will possess endorsement privileges. The contract code will be deployed to these peers and built for subsequent operation. As you know, by this point, the contract is referred to as chaincode in Fabric parlance, and that is the term that will be used for the rest of this chapter.

Once the chaincode has been installed on the endorsing peers, it will be initialized as per the logic that has been embedded in it (see Chapter 4Designing a Data and Transaction Model with Golang, for examples).

At this point, unless something has gone wrong in one or more of the preceding steps, the application is up and running. Now, transactions may be sent to the chaincode to either update the state of the ledger (invocations) or to read the ledger state (queries) for the lifetime of the application.

The application may change or evolve over time, requiring special operations to be carried out that are not captured in Figure 5.1: The stages in the creation and operation of a blockchain application. Those will be described in Chapter 9Life In A Blockchain Network.

In the section titled Building the Application and onward, we will show how a trade application can be built around the chaincodes developed in Chapter 4Designing a Data and Transaction Model with Golang, using suitable code and instructions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.249.174