Hands-On Blockchain with Hyperledger
上QQ阅读APP看书,第一时间看更新

Developer interaction

As discussed in the introduction of Hyperledger Fabric Explored section, blockchain developers can have many roles including creating applications for users (client-side) and developing smart contracts. Developers also write code to enable the blockchain to interact with legacy applications:

A blockchain developer's primary role is to create an application (and integration) and Smart Contracts and their respective interaction with ledgers and other enterprise systems of the business network and their participants. Due to the separation of the Hyperledger Fabric infrastructure, there is a clear separation between infrastructure constructs, such as peers, consensus, security, channels, policies, and developer-led activities, such as smart contract development, deployment, enterprise integration, API management, and front end application development.

From a developer's point of view, the following outline represents an example of developer interaction with Hyperledger Fabric constructs:

  • The developer creates an application and a smart contract
  • The application can invoke calls within the smart contract through an SDK
  • The calls are processed by the business logic built into the smart contract through various commands and protocols:
    • A put or delete command will go through the selected consensus protocol and will be added to the blockchain
    • A get command can only read from the world state but is not recorded on the blockchain
  • An application can access block information using rest APIs such as get block height

Note the use of delete here—delete can delete keys from the world state database, but not transactions from the blockchain, which we've already established are immutable.

The following diagram summarizes all key roles: