otxn_id
Behaviour
Section titled “Behaviour”- Write the canonical hash of the originating transaction to the output buffer.
- If flags = 1 and the transaction is an EMIT_FAILURE transaction then write the canonical hash of the originating transaction that caused the emission.
- Output the canonical hash of the originating transaction.
- Returns the transaction hash as an array of numbers, or an ErrorCode if the retrieval fails.
Definition
Section titled “Definition”int64_t otxn_id ( uint32_t write_ptr, uint32_t write_len, uint32_t flags);
function otxn_id(flag: number): ErrorCode | ByteArray
Example
Section titled “Example”uint8_t txn_id[32];int64_t bytes_written = otxn_id(txn_id, 32, 0);
const tx_id = otxn_id(0)
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
write_ptr | uint32_t | Pointer to a buffer of to store the hash. |
write_len | uint32_t | Length of the output buffer. Should be at least 32 bytes. |
flags | uint32_t | If |
Name | Type | Description |
---|---|---|
flags | number | If |
Return Code
Section titled “Return Code”Type | Description |
---|---|
int64_t | The number of bytes written |
Type | Description |
---|---|
ErrorCode | ByteArray | Returns the transaction hash as an array of numbers, or an ErrorCode if the retrieval fails. |