REST API

REST API of the Anchor node

Authorization

A node can be configured with an authorization token. This can be done in case the api of the node is exposed publicly. Once the token is configured the anchoring of hash on the chain requires an authorization header

Authorization: bearer <token>

post
Anchor a hash on the blockchain

https://lto.example.com/hash
Request
Response
Body Parameters
hash
required
string
encoding
required
string
200: OK
{
"chainpoint": {
"@context": "https://w3id.org/chainpoint/v2",
"type": "ChainpointSHA256v2",
"targetHash": "8c4b53f85243892edcbb3ccec947269f95ba3da2e84fee84fcc277b19fb68044",
"anchors": [
{
"type": "LTODataTransaction",
"sourceId": "6KVLV6zRSVR8tqCZZ9cqsbUJkP8fNDiY12CmXrGnrwTd"
}
],
"block": {
"height": "483025"
},
"transaction": {
"position": "0"
}
}
}
400: Bad Request
invalid body given
no hash given
invalid hash given
invalid encoding given
500: Internal Server Error
failed to anchor '[reason]'

get
Verify if a hash was anchored

https://lto.example.com/hash/:hash/encoding/:encoding
Request
Response
Path Parameters
hash
required
string
hash you are looking
encoding
optional
string
The encoding in which the hash is given. Options are (hex, base58, base64)
200: OK
{
"chainpoint": {
"@context": "https://w3id.org/chainpoint/v2",
"type": "ChainpointSHA256v2",
"targetHash": "8c4b53f85243892edcbb3ccec947269f95ba3da2e84fee84fcc277b19fb68044",
"anchors": [
{
"type": "LTODataTransaction",
"sourceId": "6KVLV6zRSVR8tqCZZ9cqsbUJkP8fNDiY12CmXrGnrwTd"
}
],
"block": {
"height": "483025"
},
"transaction": {
"position": "0"
}
}
}
400: Bad Request
no hash given
invalid encoding given
404: Not Found
500: Internal Server Error
Failed to get transaction by hash and encoding '[reason]'

get
Verify if a hash was anchored

https://lto.example.com/hash/:hash
Similar to the previous method however the encoding is now set to hex by default
Request
Response
Path Parameters
hash
required
string
hash you are looking
200: OK