Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify deposit IDs #314

Merged
merged 8 commits into from
May 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion specs/protocol/identifiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [UTXO ID](#utxo-id)
- [Coin ID](#coin-id)
- [Deposit ID](#deposit-id)
- [Deposit Asset ID](#deposit-asset-id)
- [Fee ID](#fee-id)

This document defines how to compute unique identifiers.
Expand All @@ -23,9 +24,14 @@ For a transaction of type `TransactionType.Create`, `tx`, the contract ID is `sh

Is represented as an _outpoint_: a pair of [transaction ID](#transaction-id) as `byte[32]` and output index as a `uint8`.


### Deposit ID

The UTXO ID of a deposit is computed as the [hash](./cryptographic_primitives.md#hashing) of TODO.
The ID of a deposit is computed as the [hash](./cryptographic_primitives.md#hashing) of the [Deposit Asset ID](#deposit-asset-id) `byte[32]`, recipient address `byte[32]`, amount `uint64` and deposit nonce `uint64`: `hash(byte[32] ++ byte[32] ++ uint64 ++ uint64)`. All value types are serialized according to the standard [transaction serialization](./tx_format.md#transaction).

#### Deposit Asset ID

The ID of a deposit asset is computed as the [hash](./cryptographic_primitives.md#hashing) of the token address `byte[32]` and token precision `uint8`: `hash(byte[32] ++ uint8)`. The address value is serialized as a byte array of length 32 left-padded with zeroes, and all other value types are serialized according to the standard [transaction serialization](./tx_format.md#transaction).

### Fee ID

Expand Down