Skip to content

Latest commit

History

History
32 lines (19 loc) 路 1.58 KB

identifiers.md

File metadata and controls

32 lines (19 loc) 路 1.58 KB

Identifiers

This document defines how to compute unique identifiers.

Transaction ID

The transaction ID (also called transaction hash) of a transaction is computed as the hash of the serialized transaction with fields zeroed out for signing (see different inputs and outputs for which fields are set to zero).

Contract ID

For a transaction of type TransactionType.Create, tx, the contract ID is sha256(0x4655454C ++ tx.data.salt ++ root(tx.data.witnesses[bytecodeWitnessIndex].data)), where root is the Merkle root of the binary Merkle tree with each leaf being an 8-byte word of bytecode. If the bytecode is not a multiple of 8 bytes (i.e. if there are an odd number of instructions), the last opcode is padded with 4-byte zero.

UTXO ID

Coin ID

The UTXO ID of a transaction's output (i.e. a coin) is computed as the hash of the concatenation of the transaction ID and the output index as a uint8.

Deposit ID

The UTXO ID of a deposit is computed as the hash of TODO.

Fee ID

The UTXO ID of collected fees in a block is the block height as a 32-byte big-endian unsigned integer (i.e. the first byte of the 32-byte array is the most significant byte, and so on).