tencent cloud

Tencent Cloud Blockchain as a Service

Release Notes
Product Introduction
Overview
Product Features
Underlying Engine
Strengths
Scenarios
Basic Concepts
Purchase Guide
Purchase Page Description
Overdue Payment Instructions
Pricing and Specification Description
Getting Started
Hyperledger Fabric
Operation Guide
Consortium
Event Center
Network Overview
Connection Management
Contract Management
Organization Management
Node Management
Blockchain Browser
Certificate management
Audit Log
Node Monitoring and Logs
Development Guide
Hyperledger Fabric
Application System Integration
API Documentation
History
Introduction
API Category
Making API Requests
Hyperledger Fabric 2.3 APIs
Data Types
Error Codes
FAQs
Product Policy
Data Processing And Security Agreement
Contact Us

Contract API List

PDF
Focus Mode
Font Size
Last updated: 2025-04-10 00:41:07
The smart contract of Fabric Java language version has various API interfaces. For the specific code implementation, see API interface code implementation. Logically, the API interfaces can be divided into the following types:

Transaction Information Extraction

API
Description
byte[] getBinding()
Return the binding information of the transaction
String getChannelId()
Get the current channel name.
byte[] getCreator()
Retrieve the transaction submitter information
SignedProposal getSignedProposal()
Retrieve related data of the transaction proposal.
Map<String, byte[]> getTransient()
Retrieve temporary information of the transaction
String getTxId()
Retrieve the transaction ID of the transaction
Instant getTxTimestamp()
Retrieve the transaction timestamp

Ledger Interaction

API
Description
void putState(String key, byte[] value)
Add or update a key-value pair in the ledger
void putStringState(String key, String value)
Add or update a key-value pair in the ledger
byte[] getState(String key)
Retrieve the value corresponding to the specified key.
String getStringState(String key)
Retrieve the value of the specified key.
void delState(String key)
Remove the corresponding key-value pair in the ledger.
QueryResultsIterator<KeyValue> getStateByRange(String startKey, String endKey)
Query the key-value pairs in the specified range.
QueryResultsIteratorWithMetadata<KeyValue> getStateByRangeWithPagination(String startKey, String endKey, int pageSize, String bookmark)
Paging query for key-value pairs in a specified range.
QueryResultsIterator<KeyValue> getStateByPartialCompositeKey(String compositeKey)
Query all key-values that match a partial composite key.
QueryResultsIterator<KeyValue> getStateByPartialCompositeKey(String objectType, String... attributes)
Query all key values that match a partial composite key.
QueryResultsIterator<KeyValue> getStateByPartialCompositeKey(CompositeKey compositeKey)
Query all key-values that match a partial composite key.
QueryResultsIteratorWithMetadata<KeyValue> getStateByPartialCompositeKeyWithPagination(CompositeKey compositeKey, int pageSize, String bookmark)
Paging query all key-values that match a partial composite key.
QueryResultsIterator<KeyValue> getQueryResult(String query)
Query the state database. The state database requires support for rich query features.
QueryResultsIteratorWithMetadata<KeyValue> getQueryResultWithPagination(String query, int pageSize, String bookmark)
Paging query the state database. The state database requires support for rich query features.
QueryResultsIterator<KeyModification> getHistoryForKey(String key)
Return all historical values of the corresponding key.
void setStateValidationParameter(String key, byte[] value)
Set the endorsement policy for a specific key.
byte[] getStateValidationParameter(String key)
Retrieve the endorsement policy for a specific key.
byte[] getPrivateData(String collection, String key)
Retrieve the value of the specified key in the assigned private data set
String getPrivateDataUTF8(String collection, String key)
Retrieve the value of the specified key in the centralized private data set
byte[] getPrivateDataHash(String collection, String key)
Retrieve the hash of the value of the specified key in the centralized private data set
void putPrivateData(String collection, String key, byte[] value)
Set the value of the middle button for the specified private data set
void putPrivateData(String collection, String key, String value)
Set the value of the middle button for the specified private data set
void delPrivateData(String collection, String key)
Delete specified key in the centralized private data set
void setPrivateDataValidationParameter(String collection, String key, byte[] value)
Set the endorsement policy for the middle button of the specified private data set
byte[] getPrivateDataValidationParameter(String collection, String key)
Retrieve the endorsement policy for the specified middle button in the private data set
QueryResultsIterator<KeyValue> getPrivateDataByRange(String collection, String startKey, String endKey)
Retrieve the key-value of keys in a specific range of a specified private data set
QueryResultsIterator<KeyValue> getPrivateDataByPartialCompositeKey(String collection, String compositeKey)
Retrieve the key-value that matches the partial composite key in the specified private data set.
QueryResultsIterator
getPrivateDataByPartialCompositeKey(String collection, CompositeKey compositeKey)
Retrieve the key-value that matches the partial composite key in the specified private data set.
QueryResultsIterator<KeyValue> getPrivateDataByPartialCompositeKey(String collection, String objectType, String... attributes)
Retrieve the key-value that matches the partial composite key in the specified private data set.
QueryResultsIterator<KeyValue> getPrivateDataQueryResult(String collection, String query)
Retrieve the key-value of a specific query in the specified private data set. The state database requires support for rich query features.

Parameter Handling

API
Description
List<byte[]> getArgs()
Get the calling parameters in the smart contract.
List<String> getStringArgs()
Retrieve the calling parameters in the smart contract.
String getFunction()
Retrieve the function name called by the smart contract. The first parameter is the function name by default.
List<String> getParameters()
Retrieve the parameters called by the smart contract.

Other Auxiliary Classes

API
Description
CompositeKey createCompositeKey(String objectType, String... attributes)
Composite attributes form a composite key.
CompositeKey splitCompositeKey(String compositeKey)
Split the composite key into a series of attributes.
Response invokeChaincode(final String chaincodeName, final List<byte[]> args, final String channel)
Call other smart contracts' invoke methods
Response invokeChaincode(String chaincodeName, List<byte[]> args)
Call other smart contracts' invoke methods
Response invokeChaincodeWithStringArgs(String chaincodeName, List<String> args, String channel)
Call other smart contracts' invoke methods
Response invokeChaincodeWithStringArgs(String chaincodeName, List<String> args)
Call other smart contracts' invoke methods
Response invokeChaincodeWithStringArgs(final String chaincodeName, final String... args)
Call other smart contracts' invoke methods
void setEvent(String name, byte[] payload)
Set Sent Events
ChaincodeEvent getEvent()
Retrieve Sent Events


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback