Application Configuration and Development
Before developing an application, you need to download certificates and SDK configuration file. Then, you can use Golang to develop your application and use the available APIs in Hyperledger Fabric SDK Go to invoke the chaincode to complete transaction processing in the blockchain network.
Two types of certificates are now supported: administrator certificate and user certificate. The administrator certificate is required to create, join, and update a channel, and install, instantiate, upgrade, and delete a chaincode. For transactions and query, you are advised to use the user certificate.
The administrator certificate differs between an orderer and a peer. For management within a channel, you need to use the administrator certificate for peers instead of that for orderers.
- Download the certificates of a service on the Service Management page, as shown in the following figure.
- Decompress the downloaded certificate files and store the files in an application directory for the application to access.
For the example application, the files are stored in the api-server/src/api-server/conf/crypto directory for your reference.
Download the SDK Configuration
- On the Service Management page, choose More > Download SDK Configuration, as shown in the following figure.
- Configure the SDK file parameters, as shown in the following figure.
Table 1 Parameters
Set it as required.
Set it as required.
Certificate Root Path
Enter the root path of the certificates specified during application compilation.
For the example application, the certificates are stored in the /opt/gopath/src/github.com/hyperledger/api-server/conf/crypto directory by default during compilation for your reference.
Select a channel.
Select a peer organization in the channel.
- Click Download. The downloaded file package is named test-sdk-config.zip.
- Decompress the file package and store the retrieved test-sdk-config.yaml file
Develop an Application
You need to develop the service logic. Fabric APIs can be used to invoke the chaincode for transaction processing.
The Chinese cryptographic algorithm SDK and homomorphic encryption library can be used for the application development. For details, see Encryption Using Chinese Cryptographic Algorithms and Homomorphic Encryption.
Configure the Application
The chaincode_id and channel_id values in the app.conf file must be the same as the chaincode and channel IDs specified during chaincode installation.