Transaction API sends transactions and gets their information.

Create Transaction

Create a transaction to be sent to the blockchain network. You can create transactions for sending native tokens or executing smart contracts.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/tx
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/tx
HTTP Method POST
Content-Type application/json

Header Parameters

Field Name Description Type Required
x-network Blockchain network string Y
Authorization Authentication token for calling the API string Y

Request Body

Field Name Description Type Required
from The account address that will send the transaction to the blockchain. string Y
to
  • For smart contract transactions, such as a transaction calling a contract function: the smart contract address
  • For transactions sending native tokens: the account address that will receive tokens
string Y
amount
  • For smart contract transactions, such as a transaction calling a contract function: enter 0
  • For transactions sending native tokens: enter the amount of tokens to send
string Y
data For smart contract transactions, this is the contract function name and the contract function parameter information.

json
  • For smart contract transactions: Y
  • For transactions sending native tokens: N
encoded Whether the transaction returned should be encoded (true: Encoded Raw Transaction String, false: Decoded JSON result) boolean N

Responses

Field Name Description Type
code API call result code, 0: Success number
message Result message string
data API response data json
data.rawTx Transaction data string or json
data.hashedTx The hashed data.rawTx. You receive this value only if the API header x-network is polygon and the Request Body from is a multi-signature wallet address. string
data.requestId A unique identifier for the API request string

Request Sample

Response Sample

Get Transaction Information

Gets the transaction information using a transaction hash (txhash). Only the information of the transactions recorded on a blockchain can be returned.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/tx/{txhash}
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/tx/{txhash}
HTTP Method GET
Content-Type application/json

Path Parameters

Field Name Description Type Required
txhash the transaction hash string Y

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y
Authorization Authentication token required to call the API string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.txhash the transaction hash string
data.blockNumber the block number of the block that contains the transaction number
data.contractAddress The contract address if the transaction involves deploying a contract string
data.status the transaction status (success after the transaction was successfully recorded on a block of a blockchain) string
data.fee the applied fee json
data.data the transaction data

json
data.logs the transaction log json

Request Sample

Response Sample

Send Transaction

Sends the signed transaction to a blockchain.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/send
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/send
HTTP Method POST
Content-Type application/json

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y
Authorization Authentication token required to call the API string Y

Request Body

Field Name Description Type Required
signedTx the signed transaction string Y
sync the synchronous/asynchronous process of the transaction

  • true: The transaction will be processed in a sychronous way, meaning that the API will wait until the transaction is finished being recorded on a blockchain. After sending the API request, the API waits until it gets the response value (txHash).
  • false: The transaction will be processed in an asychronous way, meaning that you may not get the result of transaction transferral at the moment. You need to use Get Transaction Information API to verify the transferral result of the transaction.
boolean Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.txhash the transaction hash string
data.status the transaction status string

Request Sample

Response Sample