Receipt Store
The REST API Gateway contains a built-in reliable store for your receipts, once the come back from the node.
Obtaining a receipt
The id
from this request can then be used to query the receipt store we provide:
/replies?limit=10
returns the last 10 replies received/replies/4696c9f7-2163-4237-7b58-0884fff5fbaf
returns the individual receipt
If the request is still queued for delivery to the node, you will receive:
Once the transaction is mined, you will receive either a TransactionSuccess
or TransactionFailure
Example of an async success receipt
{
"_id": "8b64ba81-091f-48fc-4064-16ac2aa9a1f8",
"headers": {
"type": "TransactionSuccess",
"id": "3252c08d-2773-4308-6ce1-3ffd2579042b",
"requestId": "8b64ba81-091f-48fc-4064-16ac2aa9a1f8",
"requestOffset": "u0j6rld2ka-u0uk478rin-requests:0:4",
"timeElapsed": 3.736754245,
"timeReceived": "2019-10-05T18:17:21.023227703Z"
},
"blockHash": "0x0262dd112045eaa3cd57c9e8bd4208857148a549f198bd2a7d4062832a2ceedf",
"blockNumber": "566119",
"contractAddress": "0xd42fc221e715ed54e7fb7adddd498adb8dcb8fd5",
"cumulativeGasUsed": "313514",
"from": "0xb863185c6361a226edc3ec11eb891a2cfddc5685",
"gasUsed": "313514",
"nonce": "0",
"receivedAt": 1570299445314,
"status": "1",
"to": null,
"transactionHash": "0xaa34f788b83746290571ca4a044bf2c407446521c1d41b82c09f13560fc524ec",
"transactionIndex": "0"
}
Example of an async failure receipt
{
"_id": "aa680136-dfdd-4bee-72ec-c411d2eb8a63",
"headers": {
"type": "TransactionFailure",
"id": "89955481-fd25-40cd-4894-a115e9457acd",
"requestId": "aa680136-dfdd-4bee-72ec-c411d2eb8a63",
"requestOffset": "u0j6rld2ka-u0uk478rin-requests:0:6",
"timeElapsed": 2.053656159,
"timeReceived": "2019-10-05T18:19:02.284173767Z"
},
"blockHash": "0x6cd03b143fa4ad4f48e9008af98b63662dea21a161df8e0ba6ac9831286c7879",
"blockNumber": "566129",
"cumulativeGasUsed": "42877",
"from": "0xb863185c6361a226edc3ec11eb891a2cfddc5685",
"gasUsed": "42877",
"nonce": "0",
"receivedAt": 1570299544842,
"status": "0",
"to": "0xd42fc221e715ed54e7fb7adddd498adb8dcb8fd5",
"transactionHash": "0xe16d0e00f63a60177955adc2a0b9fb8656c25d2d8ff1d471668cb6e5def46800",
"transactionIndex": "0"
}
Example of an async error
If the transaction could not be submitted to a node in asynchronous mode, then you will still get a receipt. However, that receipt will contain details of the error.
For example:
{
"_id": "4696c9f7-2163-4237-7b58-0884fff5fbaf",
"errorMessage": "Method 'constructor' param 0: Could not be converted to a number",
"headers": {
"type": "Error",
"id": "786492a7-1032-473b-55ee-4dc74d1fa174",
"requestId": "4696c9f7-2163-4237-7b58-0884fff5fbaf",
"requestOffset": "u0j6rld2ka-u0uk478rin-requests:0:1",
"timeElapsed": 0.000349413,
"timeReceived": "2019-10-05T18:08:28.492341544Z"
},
"receivedAt": 1570298908996,
"requestPayload": "...."
}
The receipt also contains the full input of the transaction in the
requestPayload
field, so do you debug or re-submit