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 /contract/query

CURL Command

curl POST https://{endpoint}/contract/query
  • Function

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 /contract/generate-blob

CURL Command

curl POST https://{endpoint}/contract/generate-blob
  • Function

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 /contract/submit

CURL Command

curl POST https://{endpoint}/contract/submit
  • Function

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