Overview
The hash on chain API can help you push key business data on the blockchain through interface docking.By adding the corresponding request parameters to the request according to the interface instructions, the system will return the processing results after the call. The request and response are encoded using the UTF-8 character set.
API | Description |
---|---|
v2/vid/generate | Generate tag VID in batche |
v2/provenance/hash/create | Upload hashdata to blockchain |
v2/provenance/hash/query | Query the latest on-chain information |
v2/provenance/hash/queryHistory | Query historical on-chain information |
-
Generate tag VID in batches
POST v2/vid/generate
Generate VID in batches, up to 2000 per request. The unique identifier of the request: requestNo, which is a random number generated by the requester, and the same identifier is treated as the same request. The length of the requestNo character is greater than 8 and less than 50.
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
quantity | integer | Y | requested quantity, up to 2000 |
requestNo | string | Y | request number, length is greater than 8 and less than 50, only letters and numbers are allowed |
Request Example
{
"requestNo": "generate20220530001",
"quantity":5
}
Response Example
{
"data": {
"requestNo": "generate20220530001",
"orderStatus": "SUCCESS",
"errorMsg": null,
"errorMsgDetailList": null,
"quantity": 5,
"url": "https://v-test1.vetoolchain.com/v1/artifacts/",
"vidList": [
"0x7c9e62bf001653894810c0505501404b10dcbe19025302327b3c861f0e06d16f",
"0x7c9e62bf0016538948104d0f0971cbb75c96b61ca692f9f144aadb96b82b0123",
"0x7c9e62bf001653894810f3d4b0bb2005eb504e0c0d54f0889373e712c0d5183b",
"0x7c9e62bf00165389481076d25cbb39da5faa1e2c932ba65848abd1a82abf1abb",
"0x7c9e62bf00165389481045244359de977fc14673b3184ca3949deacffd7dcb37"
],
"failureList": null,
"successList": null,
"status": "SUCCESS"
},
"code": "common.success",
"message": null
}
Response Parameters
Name | Type | Description |
---|---|---|
quantity | string | requested quantity |
requestNo | string | request number |
url | string | VID access url |
vidList | array(string) | list of successfully requested VIDs |
status | string | request status(PROCESSING,SUCCESS) |
-
Upload hashdata to blockchain
POST v2/provenance/hash/create
After the data is bound to the VID, the hashdata is uploaded to the blockchain, and each request can be up to 1000. The unique identifier of the request: requestNo, which is a random number generated by the requester, the same identifier is treated as the same request.
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
requestNo | string | Y | request number, length is greater than 8 and less than 50, only letters and numbers are allowed |
operatorUID | string | Y | UID, starting with '0x', 32 bytes. Created by the administrator in the system (refer to here) or returned by the creation operator interface. |
+ hashList | Array | Y | hash data |
└ vid | string | Y | VID, starts at '0x', 32 bytes |
└ dataHash | string | Y | Hash value starting with 0x, hexadecimal |
Request Example
{
"requestNo": "createhash20220530001",
"operatorUID": "0x9cf444b53f15bc7b72fdac79e36f508f7662a26cc49f1a0b7e8bdacedd6779c8",
"hashList":
[
{
"dataHash": "e323e330e10f645051f3c6ea0d20f95e38ae1402fbbffc8a3878674a09b11f3a",
"vid": "0x7c9e62bf00165389481045244359de977fc14673b3184ca3949deacffd7dcb37"
},
{
"dataHash": "e323e330e10f645051f3c6ea0d20f95e38ae1402fbbffc8a3878674a09b11f3b",
"vid": "0x7c9e62bf00165389481076d25cbb39da5faa1e2c932ba65848abd1a82abf1abb"
}
]
}
Response Example
{
"data": {
"requestNo": "createhash20220530001",
"orderStatus": "SUCCESS",
"errorMsg": null,
"errorMsgDetailList": null,
"operatorUID": "0x9cf444b53f15bc7b72fdac79e36f508f7662a26cc49f1a0b7e8bdacedd6779c8",
"txList": [
{
"txId": "0xdc5b8566038607a742db3db2d241d33ab9a9bc072154606136df818ac1f5e362",
"vid": "0x7c9e62bf00165389481045244359de977fc14673b3184ca3949deacffd7dcb37",
"clauseIndex": 0,
"dataHash": "e323e330e10f645051f3c6ea0d20f95e38ae1402fbbffc8a3878674a09b11f3a",
"data": null,
"submitTime": 1653897828,
"duplicated": false
},
{
"txId": "0xdc5b8566038607a742db3db2d241d33ab9a9bc072154606136df818ac1f5e362",
"vid": "0x7c9e62bf00165389481076d25cbb39da5faa1e2c932ba65848abd1a82abf1abb",
"clauseIndex": 1,
"dataHash": "e323e330e10f645051f3c6ea0d20f95e38ae1402fbbffc8a3878674a09b11f3b",
"data": null,
"submitTime": 1653897828,
"duplicated": false
}
]
},
"code": "common.success",
"message": null
}
Response Parameters
Name | Type | Description |
---|---|---|
requestNo | string | request number |
operatorUID | string | operator UID |
status | string | request status(PROCESSING,SUCCESS) |
+ txList | List | transaction information |
└ txId | string | blockchain transaction ID |
└ dataHash | string | hash value , hex string |
└ submitTime | integer | time of on-chain |
└ clauseIndex | integer | clause index of this blockchain transaction ID |
└ duplicated | integer | Whether the hash value has a historical on-chain record |
-
Query the latest on-chain information
POST v2/provenance/hash/query
You can query the latest on-chain record by VID.
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
vid | string | Y | VID, starting at '0x', 32 bytes |
smartcontractId | string | N | smart contract address |
Request Example
{
"vid":"0x7c9e62bf00165389481045244359de977fc14673b3184ca3949deacffd7dcb37"
}
Response Example
{
"data": {
"txId": "0x22d3c3be5133be664d1a6db005be3a3e69b612fc756ea95e1ad112660c36ab9f",
"vid": "0x7c9e62bf00165389481045244359de977fc14673b3184ca3949deacffd7dcb37",
"dataHash": "e323e330e10f645051f3c6ea0d20f95e38ae1402fbbffc8a3878674a09b11f3d",
"clauseIndex": 0,
"submitTime": 1653898440
},
"code": "common.success",
"message": null
}
Response Parameters
Name | Type | Description |
---|---|---|
txId | string | blockchain transaction ID |
dataHash | string | hash value , hex string |
submitTime | integer | time of on-chain |
clauseIndex | integer | clause index of this blockchain transaction ID |
duplicated | integer | Whether the hash value has a historical on-chain record |
-
Query historical on-chain information
POST v2/provenance/hash/queryHistory
You can query the historical on-chain record by VID. This interface is implemented by the logic of page turning query. For example, if you need to query the latest 120 pieces of data from the blockchain, you can use page=1, size=100, sort=desc and page=2, size=100, sort=desc to request the interface respectively, and get the first 20 pieces of data in the second request.. Similarly, you can also use page=1, size=60, sort=desc, and page=2, size=60, sort=desc to request the interface to obtain data twice.
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
vid | string | Y | VID, starting at '0x', 32 bytes |
page | integer | Y | page number, ex: page 3 |
size | integer | Y | row number displayed per page, up to 100 |
sort | string | Y | blockchain on-chain time sorting (desc, asc) |
smartcontractId | string | N | smart contract address |
Request Example
{
"vid": "0x7c9e62bf00165389481045244359de977fc14673b3184ca3949deacffd7dcb37",
"page": 1,
"size": 10,
"sort": "asc"
}
Response Example
{
"data": {
"vid": "0x7c9e62bf00165389481045244359de977fc14673b3184ca3949deacffd7dcb37",
"page": 1,
"size": 2,
"rows": 2,
"history": [
{
"txId": "0xdc5b8566038607a742db3db2d241d33ab9a9bc072154606136df818ac1f5e362",
"vid": "0x7c9e62bf00165389481045244359de977fc14673b3184ca3949deacffd7dcb37",
"clauseIndex": 0,
"dataHash": "e323e330e10f645051f3c6ea0d20f95e38ae1402fbbffc8a3878674a09b11f3a",
"data": null,
"submitTime": 1653897828,
"duplicated": null
},
{
"txId": "0x22d3c3be5133be664d1a6db005be3a3e69b612fc756ea95e1ad112660c36ab9f",
"vid": "0x7c9e62bf00165389481045244359de977fc14673b3184ca3949deacffd7dcb37",
"clauseIndex": 0,
"dataHash": "e323e330e10f645051f3c6ea0d20f95e38ae1402fbbffc8a3878674a09b11f3d",
"data": null,
"submitTime": 1653898440,
"duplicated": null
}
],
"smartcontractId": null,
"datasetAddress": null
},
"code": "common.success",
"message": null
}
Response Parameters
Name | Type | Description |
---|---|---|
vid | string | VID |
page | integer | page number |
rows | integer | total rows |
smartcontractId | string | smart contract address |
+ history | array(HashHistoryModel) | collection of on-chain history |
└ txId | string | blockchain transaction ID |
└ dataHash | string | hash value, hex string |
└ submitTime | integer | time of on-chain |
└ clauseIndex | integer | clause index of this blockchain transaction ID |
└ duplicated | integer | Whether the hash value has a historical on-chain record |
Comments
0 comments
Please sign in to leave a comment.