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 |
|
string | Y |
amount |
|
string | Y |
data | For smart contract transactions, this is the contract function name and the contract function parameter information.
|
json |
|
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
curl -X 'POST' \ 'https://sandbox-bc-api.qpyou.cn/core/v1/tx' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb20yd...' \ -d '{ "from": "0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765", "to": "0xFBd488D1b00604d3b05124d80E35FeA9A39C3296", "amount": "0.001", "data": "", "encoded": true }' |
Response Sample
1 2 3 4 5 6 7 8 9 10 |
{ "code": 0, "message": "success", "data": { "rawTx": "02f68301388182013484618b021e84618b0235827b0c94fbd488d1b00604d3b05124d80e35fea9a39c329687038d7ea4c6800080c0808080", "requestId": "93ff43f7-3e19-42e1-a7d0-bbff40be1361" } } |
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
1 2 3 4 5 |
curl -X 'GET' \ 'https://sandbox-bc-api.qpyou.cn/core/v1/tx/0x5a0ca3a7eebbafa946da6ed0160930fc4f334887dbf11a9b38937ab8831fd125' \ -H 'accept: application/json' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb20yd...' \ -H 'x-network: polygon' |
Response Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
// Polygon Transaction { "code": 0, "message": "success", "data": { "txhash": "0x5a0ca3a7eebbafa946da6ed0160930fc4f334887dbf11a9b38937ab8831fd125", "blockNumber": 33457511, "contractAddress": "0x4377C1bE43Db73561f1179e2637CFf0bbD617eFC", "status": "success", "fee": { "gas": 151232, ... }, "data": { "from": "0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765", .. }, "logs": [ { "transactionHash": "0x5a0ca3a7eebbafa946da6ed0160930fc4f334887dbf11a9b38937ab8831fd125", .... } ] } } // Xpla Transaction { "code": 0, "message": "success", "data": { "txhash": "E21E0CC37CD1BCACADFDEBD4C7AF2F68257EA4591D670F4AA0A725B21422C29F", "blockNumber": 4818400, "contractAddress": "0x4377C1bE43Db73561f1179e2637CFf0bbD617eFC", "status": "success", "fee": { "gasUsed": 21000, ... }, "data": { "memo": "", ... }, "logs": [ { "msg_index": 0, ... } ] }} |
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
|
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
1 2 3 4 5 6 7 8 9 10 |
curl -X 'POST' \ 'https://sandbox-bc-api.qpyou.cn/core/v1/send' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb20yd...' \ -d '{ "signedTx": "0x02f8b58301388181b985016d14154585016d1415578289219494853bdc9c...", "sync": false }' |
Response Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
// Polygon { "code": 0, "message": "success", "data": { "txhash": "0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556c79076", "status": "pending" } } // Xpla { "code": 0, "message": "success", "data": { "txhash": "84655BB965D709A4AAD4104C7FFBD8E42F52F0BB313493FFDCA02B01FE983A8F", "status": "pending" } } |