Skip to content

Latest commit

 

History

History
62 lines (53 loc) · 2.82 KB

qip-0010.md

File metadata and controls

62 lines (53 loc) · 2.82 KB
 QIP: 10
 Layer: Consensus (hard fork)
 Title: Network Object Identifiers
 Author: wizeguyy <wizeguyy+qip@quai.org>
 Comments-Summary: No comments yet.
 Comments-URI: https://github.com/quainetwork/qips/wiki/Comments:QIP-0010
 Status: Draft
 Type: Standards Track
 Created: 2024-02-09
 License: BSD-2-Clause

Abstract

The Quai protocol comprises a network of merge-mined blockchains, each running two ledgers (Quai EVM ledger & Qi UTXO ledger), as described in qip-0002. As a result of this, some unique challenges arise with regard to network identifiers. Specifically in cases where transactions are referenced by hash, there is ambiguity about the processing context of that data, which adds complexity to the protocol and external systems which interact with the protocol.

This specification proposes a scheme for creating unique object identifiers which also encode some contextual information that alleviates the aforementioned challenges.

Motivation

Since the network supports a cross-chain transaction type (aka ETX), it is possible for one transaction to have an existing record in multiple chains. The origin chain which emits the ETX will have a record of it. The destination chain which must process the ETX will eventually have a record of it. And any dominant chain between the two may have a reference to it as a pending ETX crossing through its context.

When servicing an API request for a transaction by hash, there is no way to determine which blockchain to query for that transaction hash. Ultimately some search algorithm will exist, which queries multiple chains until the record is found (if it exists at all). This lookup challenge exists for other node APIs as well as other systems external to the protocol (e.g. Block explorers), and results in complex and inefficient solutions.

This could be entirely mitigated if the transaction ID encoded the source and destination chain information, which this specification intends to address.

Specification

Transaction Identifiers

Transaction identifiers will consist of a permuted transaction hash. Specifically, the first four bytes of the hash will be bit-masked with the origin and destination shard identifiers respectively. qip-0002 describes the encoding of shard identifiers. For this specification, we only care that they are 9 bits in length.

bits 0..8 bits 9..15 bits 16..24 bits 25..255
src shard id hash(transaction)[9..15] dst shard id hash(transaction)[25..255]

Note: since shard identifiers are 9 bits, we include a 7 bits of the actual transaction hash as a spacer, so that the destination shard id starts at a round byte position.

Copyright

This QIP licensed under the BSD 2-clause license.