Direct Publishing
This endpoint accepts an input object containing data and alerts, processes it, and publish it to all supported blockchains
URL :
/merkle-hash/publish
/merkle-hash/publish?blockchain={blockchain}
Method : POST
X-HMAC required : YES
Request Query Parameters :
blockchainoptional
BTCorETH
If the blockchain param is not provided, it is going to be published to both blockchains
Request Body Parameters : Base Input Object
Response
The response will be a JSON object containing the calculated Merkle root hash, layers and the data itself (see Base Input Object).
interface Response {
publishes: {
root: string
layers: string[][],
txHash: string
blockchain: BlockChain
explorerLink: string
date: Date
}[],
errors: {
blockchain: BlockChain
error: any
}[]
}
Status Codes
The endpoint will return the following status codes based on the operation outcome:
- 200
OK: The request was successful, and the Merkle hash was calculated. - 400
Bad Request: The request was invalid. This usually occurs if the request body is not properly formatted. - 500
Internal Server Error: An error occurred on the server while processing the request.
Example Request
POST /merkle-hash/publish HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Content-Length: 315
{
"data": [
{
"bin": "521739b1-5f51-4245-b80b-e45465925347",
"data": {
"vlt": 1,
"amp": 2,
"tmp": 3,
"ts": "2024-01-25T10:00:00Z"
},
"alerts": [
{
"code": "SE001001",
"ts": "2024-01-25T10:00:00Z"
}
]
}
]
}
Example Response
{
"publishes": [
{
"root": "d7da2a6fdcbf73dbace7b5de468fb37669593ce435d89322af65a291ac2679c9",
"layers": [
[
"d7da2a6fdcbf73dbace7b5de468fb37669593ce435d89322af65a291ac2679c9"
]
],
"txHash": "03f0ed9ff8b7e174432747da9fc11ef3bf0b2560bbd5a4cb6ee509986d75f659",
"blockchain": "BTC",
"explorerLink": "https://blockstream.info/testnet/tx/03f0ed9ff8b7e174432747da9fc11ef3bf0b2560bbd5a4cb6ee509986d75f659",
"date": "2024-03-15T14:00:25.754Z"
},
{
"root": "d7da2a6fdcbf73dbace7b5de468fb37669593ce435d89322af65a291ac2679c9",
"layers": [
[
"d7da2a6fdcbf73dbace7b5de468fb37669593ce435d89322af65a291ac2679c9"
]
],
"txHash": "0x42a5ce7d65c59331fd781fb583ee96bc315495f7483d41493edced6dad8263a5",
"blockchain": "ETH",
"explorerLink": "https://sepolia.etherscan.io/tx/0x42a5ce7d65c59331fd781fb583ee96bc315495f7483d41493edced6dad8263a5",
"date": "2024-03-15T14:00:27.051Z"
}
],
"errors": []
}
Table of Contents
