هذه الصفحة غير متوفرة حاليًا بلغتك المحلية. نحن نعمل جاهدين على إضافة المزيد من اللغات. شاكرين تفهمك ودعمك المستمر لنا.
- What's New
- Function Overview
- Service Overview
- Billing
- Getting Started
-
User Guide
- Enhanced Hyperledger Fabric BCS Management
- Best Practices
-
Developer Guide
- Overview
- Chaincode Development
- Application Development
- Demos
-
Blockchain Middleware APIs
- Overview
- Chaincode Invoking (OBT)
-
Chaincode Management
- Obtaining a Token
- Installing a Chaincode
- Instantiating a Chaincode
- Listing Installed Chaincodes
- Querying Version of a Specified Chaincode
- Querying Chaincode Installation Information
- Querying Chaincode Instantiation Information
- Querying an Appchain
- Listing Blocks
- Listing Transactions
- Querying Transaction Quantity
- Listing Block Transactions
- Querying Transaction Details
- Querying Peers
- Querying diskUsage of a Node
- Querying the System-Hosted Certificate Status
- Deleting a Chaincode
- Downloading a Report
- Distributed Identity (OBT)
- Trusted Data Exchange (OBT)
- Appendix
-
API Reference
- Before You Start
- API Overview
- Examples
- Calling APIs
-
APIs (Enhanced Hyperledger Fabric)
-
BCS Management
- Creating a BCS Service
- Querying Creation Status of a BCS Service
- Querying a BCS Service
- Modifying a BCS Service
- Creating Channels
- Querying Channel Information
- Adding Peers to a Channel
- Removing Organizations from a Channel
- Downloading Certificates
- Downloading the SDK Configuration
- Generating a User Certificate
- Unfreezing a User Certificate
- Freezing a User Certificate
- Querying Quotas
- Querying Flavors
- Querying Peer Information
- Querying Asynchronous Operation Results
- Querying the BCS Service List
- Deleting a BCS Service
- Removing a Peer from a Channel
- Deleting a Channel
- BCS Consortium
- BCS Monitoring
-
BCS Management
- Permissions Policies and Supported Actions
- Appendix
- Change History
- SDK Reference
-
FAQs
-
Enhanced Hyperledger Fabric
- Billing
-
Instance Management
-
Consultation
- How Do I Determine Whether a Blockchain Is Necessary?
- What Underlying Framework Is Used for Huawei Cloud BCS?
- Can BCS Instances Deployed on the Public Cloud Access Blockchain Nodes on Other Clouds?
- What Competitive Advantages Does Huawei Cloud BCS Have?
- In Which Direction and What Capabilities Will Huawei Cloud BCS Develop?
- What Are the Specifications of VMs to Be Purchased for BCS?
- How Do I Get Access to the Partners of Huawei Cloud BCS for More Services?
- What Are the Differences Between Channel Isolation and Privacy Protection?
- How Well Does BCS Perform?
- Does BCS Support Customized Development?
- When Do I Need to Hibernate or Wake an Instance?
-
Service Usage
- Which Ports of a Security Group Are Opened When I Create a BCS Instance?
- How Do I Check Whether the ICAgent Is Installed for the Cluster?
- What Can I Do If I Can't Open the Blockchain Management Console?
- What Should I Do If My BCS Instance Remains in the Creating State?
- What Should I Do If a Peer Restarts Frequently with the Error Message "PanicDB not exist"?
- What Can I Do If the CPU Usage of a Blockchain Node Reaches 100%?
- Why Can't I Log In to the Blockchain Management Console?
- BCS.4009100: System Error
- How Can I Obtain Private Keys and Certificates for Enhanced Hyperledger Fabric Blockchains?
- Why Does Chaincode Instantiation Fail When I Deploy a Fabric v1.4 Instance Using a v1.19 CCE Cluster?
- Can All Blocks Be Saved As More and More Blocks Are Created?
-
What Can I Do If I Fail to Purchase a BCS Instance?
- General Checks
-
Detailed Checks
- CCE Cluster Quota Used Up
- Failed to Create a Cluster
- Failed to Create a PVC
- Cluster Already In Use
- SFS Turbo File System Quota Exceeded
- No EIP Bound
- CCE Is Abnormal
- Cluster Status Is Abnormal
- Subnet Unavailable
- Quick Deployment in Progress
- CCE Status Check Times Out
- Insufficient Master Nodes in the AZ of the CCE Cluster
-
Abnormal Instance Statuses
- What Can I Do If a BCS Instance Is in the Abnormal State?
- What Can I Do If a BCS Instance Is in the Unknown State?
- What Can I Do If a BCS Instance Is in the EIP abnormal State?
- What Can I Do If a BCS Instance Is in the Frozen or Cluster frozen State?
- What Can I Do If the BCS Instance and the peer-xxx StatefulSet Are Abnormal After an Organization or a Peer Is Added?
- Other Issues
-
Consultation
- Chaincode Management
- Data Storage to the Blockchain
- Demos and APIs
- O&M and Monitoring
- Consortium Management
-
Enhanced Hyperledger Fabric
- Videos
-
More Documents
-
User Guide (ME-Abu Dhabi Region)
- Service Overview
- Managing Enhanced Hyperledger Fabric Instances
-
FAQs
-
BCS FAQs
-
Instance Management
-
Consultation
- How Do I Determine Whether a Blockchain Is Necessary?
- What Underlying Framework Is Used for BCS?
- What Competitive Advantages Does BCS Have?
- What Are the Specifications of VMs to Be Created for BCS?
- What Are the Differences Between Channel Isolation and Privacy Protection?
- How Well Does BCS Perform?
- When Do I Need to Hibernate or Wake an Instance?
-
Service Usage
- How Do I Check Whether the ICAgent Is Installed for the Cluster?
- What Can I Do If I Can't Open the Blockchain Management Console?
- What Should I Do If My BCS Instance Remains in the Creating State?
- What Should I Do If a Peer Restarts Frequently with the Error Message "PanicDB not exist"?
- What Can I Do If the CPU Usage of a Blockchain Node Reaches 100%?
- Why Can't I Log In to the Blockchain Management Console?
- BCS.4009100: System Error
- How Can I Obtain Private Keys and Certificates for Enhanced Hyperledger Fabric Blockchains?
- Can All Blocks Be Saved As More and More Blocks Are Created?
- Abnormal Instance Statuses
- Other Issues
-
Consultation
- Chaincode Management
- Data Storage to the Blockchain
- Demos and APIs
- O&M and Monitoring
- Consortium Management
-
Instance Management
-
BCS FAQs
- Change History
- Developer Guide (ME-Abu Dhabi Region)
-
User Guide (ME-Abu Dhabi Region)
- General Reference
Copied.
Chaincode Invoking (OBT)
Function
This API is used to invoke and query the instantiated chaincodes of deployed BCS services.
URI
POST /v1/chaincode/operation
Request
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
channelId |
Yes |
String |
Channel ID in a blockchain. |
chaincodeId |
Yes |
String |
Chaincode ID. |
chaincodeVersion |
No |
String |
Chaincode version. |
userId |
Yes |
String |
User ID issued by the organization CA. Currently, the default value generated for BCS is User1. |
orgId |
Yes |
String |
Organization ID in a blockchain. |
orgPeers |
Yes |
String |
A character string consisting of the organization ID and domain name of each peer in an organization. The format is as follows: [{"orgId":"7258adda1803f4137eff4813e7aba323018200c5","peerDomainName":"peer-7258adda1803f4137eff4813e7aba323018200c5-0.peer-7258adda1803f4137eff4813e7aba323018200c5.default.svc.cluster.local"}] |
opmethod |
Yes |
String |
Purpose, that is, to invoke or query chaincodes. |
args |
Yes |
String |
Arguments, for example, ["Invoke", "a", "b", "1"] |
timestamp |
Yes |
String |
For example, 2018-10-31T17:28:16+08:00. |
cert |
Yes |
String |
User certificate file, which is uploaded in the form of a character string. |
For details about how to obtain the values of the preceding parameters, see Chaincode Management and Block Browser.
- On the Chaincode Management page, click
in front of a chaincode to view its details, including the version, installation, and instantiation information.
- On the Block Browser page, select a channel to view real-time blockchain information, including the block quantity, transaction quantity, block details, transaction details, performance, and peer statuses.
- To ensure transaction security, you must use the private key in the Fabric user certificate (downloaded by following instructions in Downloading the User Certificate) to sign the request body. Currently, only the ECDSA encryption method is supported. Other encryption algorithms such as OSCCA-published cryptographic algorithms are not supported. Then, place the signature result in the x-bcs-signature-sign field in the request header.
Table 2 lists the request header parameters customized for the chaincode invoking RESTful API.
Parameter |
Mandatory |
Description |
---|---|---|
x-bcs-signature-sign |
Yes |
Signature of the chaincode invoking request message body |
x-bcs-signature-method |
Yes |
Encryption type, which is fixed at SW now. |
x-bcs-signature-sign-gzip |
Yes |
Indication of whether GZIP compression is enabled. 0: disabled; 1: enabled. |
x-bcs-signature-sign: To ensure that only authorized invocation entities can invoke chaincodes, the user private key (downloaded by following instructions in Downloading the User Certificate) and the ECDSA encryption method must be used to encrypt and sign the SHA256 hash of the entire request body. The value of x-bcs-signature-sign is the encrypted and signed hash.
Downloading the User Certificate
Download the user certificate that is configured in BCS to call the APIs.
- Log in to the Huawei Cloud BCS console.
- On the Instance Management page, check the BCS instances.
- Click Download Client Configuration, and select Peer Certificates. Specify the peer organization and select User certificate.
- Click Download.
- Decompress the certificates. In the msp folder, the private key of the organization is stored in keystore, and the user certificate (public key) in signcerts.
Response
- If opmethod is invoke, the transactionID encrypted and encoded using Base64 is returned.
- If opmethod is query, the query result returned by the chaincode is also encrypted and encoded using Base64.
Examples
The following is an example of invoking a chaincode:
- Example request
{ "channelId": "testchannel", "chaincodeId": "zmmcode", "chaincodeVersion": "1.0", "userId": "User1", "orgId": "7258adda1803f4137eff4813e7aba323018200c5", "orgPeers": "[{\"orgId\":\"7258adda1803f4137eff4813e7aba323018200c5\",\"peerDomainName\":\"peer-7258adda1803f4137eff4813e7aba323018200c5-0.peer-7258adda1803f4137eff4813e7aba323018200c5.default.svc.cluster.local\"}]", "opmethod": "invoke", "args": "[\"invoke\",\"a\",\"b\",\"1\"]", "timestamp": "2018-10-31T17:28:16+08:00", "cert": "-----BEGIN CERTIFICATE-----\nMIIDBzCCAq2gAwIBAgIQEXPZlMsReamxVtVNnKwCCzAKBggqhkjOPQQDAjCCAQQx\nDjAMBgNVBAYTBUNISU5BMRAwDgYDVQQIEwdCRUlKSU5HMRAwDgYDVQQHEwdCRUlK\nSU5HMXkwdwYDVQQKE3A3MjU4YWRkYTE4MDNmNDEzN2VmZjQ4MTNlN2FiYTMyMzAx\nODIwMGM1LnBlZXItNzI1OGFkZGExODAzZjQxMzdlZmY0ODEzZTdhYmEzMjMwMTgy\nMDBjNS5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsMVMwUQYDVQQDE0pjYS5wZWVy\nLTcyNThhZGRhMTgwM2Y0MTM3ZWZmNDgxM2U3YWJhMzIzMDE4MjAwYzUuZGVmYXVs\ndC5zdmMuY2x1c3Rlci5sb2NhbDAeFw0xODEwMzAwMjQ5MjZaFw0yODEwMjcwMjQ5\nMjZaMIG1MQ4wDAYDVQQGEwVDSElOQTEQMA4GA1UECBMHQkVJSklORzEQMA4GA1UE\nBxMHQkVJSklORzF/MH0GA1UEAwx2VXNlcjFANzI1OGFkZGExODAzZjQxMzdlZmY0\nODEzZTdhYmEzMjMwMTgyMDBjNS5wZWVyLTcyNThhZGRhMTgwM2Y0MTM3ZWZmNDgx\nM2U3YWJhMzIzMDE4MjAwYzUuZGVmYXVsdC5zdmMuY2x1c3Rlci5sb2NhbDBZMBMG\nByqGSM49AgEGCCqGSM49AwEHA0IABPMrzoJL/MHeSFPFOJWLqnJ0sqB0it7wDIOq\n+eTSvvPpGk1BIDmb2n13K5V04RO8xNezDQ7I6rW4LF2elq14eH+jTTBLMA4GA1Ud\nDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIFBXQ5TC4acFeTlT\nJuDZg62XkXCdnOfvbejSeKI2TXoIMAoGCCqGSM49BAMCA0gAMEUCIQCadHIKl0Mk\nYn0WZizyDZYR4rT2q0nzjFaiW+YfV5FBjAIgNalKUe3rIwXJvXORV4ZXurEua2Ag\nQmhcjRnVwPTjpTE=\n-----END CERTIFICATE-----\n" }
- Example response
After invoke the count of a is 188 b is 262
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot