Understanding Transaction Receipts
Transaction Receipts
Confirmed transactions come with a receipt under the result field when fetching the transaction in JSON format.
Basic Fields
The following are the fields a receipt may have. These fields generally apply to both payment and contract transactions.
Field | Type | Description |
---|---|---|
cumulative_gas | string | The total gas consumed in this transaction |
epoch_num | string | The epoch number in which this transaction was confirmed |
success | boolean | The result of this transaction (true on success) |
For example:
Additional Fields
For smart contract transactions, additional information relating to smart contract execution is contained in additional fields under the "receipt".
Successful Transactions
If a transaction is successful (i.e., the success field is true
), these fields will be present:
Field | Type | Description |
---|---|---|
accepted | boolean | Indicates whether the last transition in this transaction incurred a balance transfer |
event_logs | json-array | A list of event logs emitted by the contract during processing. Each log contains:
|
transitions | json-array | A list of internal transitions invoked during the processing of the transaction by the Scilla interpreter. Each transition contains:
|
For example:
Unsuccessful Transactions
If a transaction is unsuccessful (i.e., the success field is false
), no balance transfer will be executed. Additionally, these fields will be present:
Field | Type | Description |
---|---|---|
errors | json-object | An object containing a key-value field. The key [string] indicates the depth at which the error occurred. The value part is a JSON array that lists the error codes [int] reported. The list of possible error codes can be found here. |
exceptions | json-array | A list of exceptions returned by the Scilla interpreter. Each exception contains:
|
For example:
Recommended Steps for Exchanges Polling for Incoming $ZIL Deposit from Smart Contract Transactions
- Confirm that the success field is set to
true
. - Traverse the transitions JSON array. For each transition, for a successful deposit of
$ZIL
via the smart contract, the following must be fulfilled:- _recipient corresponds to a known deposit address controlled by the exchange.
- _tag is either
AddFunds
or empty.note
_tag
can be found undermsg
field. If either_tag
ormsg
is not present, there is no incoming deposit from this particular transition. - _amount is non-zero.
- Check the _recipient and _amount to complete the information on the balance transfer. In such a case, you can confirm that there is a deposit
to address _recipient with value _amount (in
Qa
). - Continue traversing the remaining transitions and checking for more deposits.