Contract
A Contract Blockchain API allows you to interact with smart contracts on a Zetrix blockchain network programmatically. Smart contracts are agreements that execute automatically when certain conditions are met, and they are stored on the blockchain.
With a Contract Blockchain API, developers can automate the interaction with these smart contracts, allowing them to build decentralized applications (DApps) and more complex blockchain-based systems.
This API typically uses a set of methods to interact with smart contracts, including methods to write data to the blockchain, read data from the blockchain, and execute smart contract functions.
Query Contract
HTTP POST /ztx/contract/queryCURL Command
curl POST https://{endpoint}/ztx/contract/queryFunction
To query all the contract based contract key.
The body is in json format
Here body transfer is the transaction data. For specific json format and parameters, see Transaction Structure. Example:
{
"contractKey": "string",
"inputParameters": {},
"method": "string"
}Return Value
{
"messages": [
{
"errorCode": 0,
"message": "string",
"type": "INFO"
}
],
"object": {
"result": {
"type": "string",
"value": "string"
}
}
}Invoke Contract - Generate Blob
HTTP POST /ztx/contract/generate-blobCURL Command
curl POST https://{endpoint}/ztx/contract/generate-blobFunction
Generate a blob.
The body is in json format
Here body transfer is the transaction data. For specific json format and parameters, see Transaction Structure. Example:
{
"contractKey": "string",
"inputParameters": {},
"method": "string",
"txInitiator": "string"
}Return Value
{
"messages": [
{
"errorCode": 0,
"message": "string",
"type": "INFO"
}
],
"object": {
"blob": "string",
"hash": "string",
"platformSignData": {
"publicKey": "string",
"signBlob": "string"
}
}
}Invoke Contract - Submit
HTTP POST /ztx/contract/submitCURL Command
curl POST https://{endpoint}/ztx/contract/submitFunction
To invoke data to contract.
The body is in json format
Here body transfer is the transaction data. For specific json format and parameters, see Transaction Structure. Example:
{
"blob": "string",
"hash": "string",
"initiator": "string",
"listSigner": [
{
"publicKey": "string",
"signBlob": "string"
}
]
}Return Value
{
"messages": [
{
"errorCode": 0,
"message": "string",
"type": "INFO"
}
],
"object": {
"hash": "string"
}
}Last updated