-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) qip-0001: refactor to markdown
- Loading branch information
1 parent
4a8e372
commit 51d2a08
Showing
7 changed files
with
223 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
People wishing to submit QIPs, first should propose their idea to the [Quai forum](https://forum.qu.ai) (do *not* assign a number - read [QIP 1](qip-0001.md) for the full process). After discussion, please open a PR. After copy-editing and acceptance, it will be published here. | ||
|
||
We are fairly liberal with approving QIPs, and try not to be too involved in decision making on behalf of the community. The exception is in very rare cases of dispute resolution when a decision is contentious and cannot be agreed upon. In those cases, the conservative option will always be preferred. | ||
|
||
Having a QIP here does not make it a formally accepted standard until its status becomes Final or Active. | ||
|
||
Those proposing changes should consider that ultimately consent may rest with the consensus of the Quai users. | ||
|
||
| Number | Layer | Title | Owner | Type | Status | | ||
|--------|----------------------|---------------------------------|----------|---------|--------| | ||
| [1](qip-0001.md) | | QIP process | wizeguyy | Process | Active | | ||
| [2](qip-0002.md) | Consensus (hard fork) | Sharded ledger | wizeguyy | Standard| Draft | | ||
| [3](qip-0003.md) | Applications | Shard Specific Address Discovery | wizeguyy | Standard| Draft | | ||
| [4](qip-0004.md) | Applications | 9 Shard Address Mapping | wizeguyy | Standard| Draft | | ||
|
||
<!-- IMPORTANT! See the instructions at the top of this page, do NOT JUST add QIPs here! --> |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,42 @@ | ||
<pre> | ||
QIP: 3 | ||
Layer: Applications | ||
Title: Shard Specific Address Discovery | ||
Author: wizeguyy <[email protected]> | ||
Comments-Summary: No comments yet. | ||
Comments-URI: https://github.com/quainetwork/qips/wiki/Comments:QIP-0003 | ||
Status: Draft | ||
Type: Standards Track | ||
Created: 2023-09-12 | ||
License: BSD-2-Clause | ||
</pre> | ||
``` | ||
QIP: 3 | ||
Layer: Applications | ||
Title: Shard Specific Address Discovery | ||
Author: wizeguyy <[email protected]> | ||
Comments-Summary: No comments yet. | ||
Comments-URI: https://github.com/quainetwork/qips/wiki/Comments:QIP-0003 | ||
Status: Draft | ||
Type: Standards Track | ||
Created: 2023-09-12 | ||
License: BSD-2-Clause | ||
``` | ||
|
||
==Abstract== | ||
## Abstract | ||
|
||
This QIP defines an address discovery algorithm for deterministic [https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki BIP44] wallets, which is compatible with Quai's <a href="qip-0002.mediawiki">QIP2</a> sharded address space. | ||
This QIP defines an address discovery algorithm for deterministic [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) wallets, which is compatible with Quai's [QIP2](qip-0002.mediawiki) sharded address space. | ||
|
||
==Motivation== | ||
## Motivation | ||
|
||
The hierarchy proposed in BIP44 is well defined, but the gap limit technique for address discovery is insufficient for wallets operating in Quai's sharded address space, described in <a href="qip-0002.mediawiki">QIP2</a>. This specification discribes an algorithm to discover addresses mapped to each shard, within the BIP44 hierarchy. | ||
The hierarchy proposed in BIP44 is well defined, but the gap limit technique for address discovery is insufficient for wallets operating in Quai's sharded address space, described in [QIP2](qip-0002.mediawiki). This specification describes an algorithm to discover addresses mapped to each shard, within the BIP44 hierarchy. | ||
|
||
==Specification== | ||
## Specification | ||
|
||
===Relationship to BIP44=== | ||
### Relationship to BIP44 | ||
|
||
BIP44 defines the following 5 levels in the BIP32 path: | ||
<pre> | ||
``` | ||
m / purpose' / coin_type' / account' / change / address_index | ||
</pre> | ||
``` | ||
|
||
Additionally BIP44 describes an account discovery and address gap limit techniques to standardize how wallet software can identify keys for use on a given blockchain. This QIP adheres to BIP44 in all ways except for the gap limit technique. Since each address is valid in one and only one chain, and that validity cannot be known by path alone (validity is determined by address prefix), the wallet must grind addresses until it finds addresses which are valid in each shard. In place of BIP44's gap limit, we define the shard discovery technique below. | ||
|
||
===Shard Address Discovery=== | ||
### Shard Address Discovery | ||
|
||
To perform address discovery, a wallet software should search through the BIP44 <code>address_index</code> level of the BIP32 path and record which shard each address belongs to. This creates a secondary mapping on the <code>address_index</code>, which we denote <code>shard_address_index</code>. Precisely, the i<sup>th</sup> <code>shard_address_index</code> in <code>shard-k</code> is the i<sup>th</sup> address from the subset of addresses which are valid in <code>shard-k</code>. | ||
To perform address discovery, a wallet software should search through the BIP44 `address_index` level of the BIP32 path and record which shard each address belongs to. This creates a secondary mapping on the `address_index`, which we denote `shard_address_index`. Precisely, the i<sup>th</sup> `shard_address_index` in `shard-k` is the i<sup>th</sup> address from the subset of addresses which are valid in `shard-k`. | ||
|
||
We give the following search algorithm in pseudo code for reference: | ||
<pre> | ||
|
||
```plaintext | ||
// A BIP32 type to represent a full BIP32 path for address derivation | ||
struct bip32 { | ||
uint64 purpose; | ||
|
@@ -83,24 +84,23 @@ vec<vec<addresses>> generateShardAddresses(n int, path bip32) { | |
// Return the full list of addresses we've discovered | ||
return address_lists; | ||
} | ||
</pre> | ||
|
||
===Gap Limit=== | ||
``` | ||
### Gap Limit | ||
|
||
For an account ledger there is no need to search for additional addresses beyond the first 256 (QIP2 defined maximum number of shards). For a UTXO ledger, we follow BIP44's gap limit definition applied to each shard, instead of applied to the raw <code>address_index</code>. | ||
|
||
Precisely, BIP44 has defined a gap limit of 20. In keeping with that, a UTXO wallet in the Quai network should keep searching for addresses until a gap of 20 unused addresses is found '''in each shard'''. It can be assumed that there are no used addresses in a shard beyond the 20<sup>th</sup> unused address in that shard. | ||
|
||
Software should warn when the user is trying to exceed the gap limit on any given shard chain, by generating a new address. | ||
|
||
====Examples==== | ||
#### Examples | ||
|
||
TBD... | ||
|
||
==Copyright== | ||
## Copyright | ||
|
||
This QIP licensed under the BSD 2-clause license. | ||
|
||
==References== | ||
## References | ||
* https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki | ||
* https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
``` | ||
QIP: 4 | ||
Layer: Applications | ||
Title: 9 Shard Address Mapping | ||
Author: wizeguyy <[email protected]> | ||
Comments-Summary: No comments yet. | ||
Comments-URI: [https://github.com/quainetwork/qips/wiki/Comments:QIP-0004](https://github.com/quainetwork/qips/wiki/Comments:QIP-0004) | ||
Status: Draft | ||
Type: Standards Track | ||
Created: 2023-09-15 | ||
License: BSD-2-Clause | ||
``` | ||
|
||
## Abstract | ||
|
||
This QIP defines an address mapping to be used in a 9 shard hierarchy of the Quai protocol. | ||
|
||
## Motivation | ||
|
||
This defines the address mapping used in early testnets of the Quai protocol. Early testnets use a lighter 9-shard hierarchy. It has already been concluded that the mainnet should accommodate more than 9 shards, so this mapping is no longer recommended. We documented it here for wallet compatibility with early testnets. | ||
|
||
## Specification | ||
|
||
### Overview | ||
|
||
The address space is divided into subsets according to address prefix. The account state for each subset of addresses will be maintained wholly by one and only one shard. Intra-shard transactions may only be processed by the blockchain which maintains that shard. Inter-shard transactions are possible, but the specification for those will be left to another QIP. | ||
|
||
### Address Mapping | ||
|
||
All addresses are mapped to exist in one of nine shards according to the MSB of the address. The Address groupings are given below: | ||
|
||
| Name | Region | Zone | Min Address | Max Address | | ||
|---------|---------|---------|-----------------------------------------|-----------------------------------------| | ||
| cyprus1 | region-0| zone-0-0| 0x0000000000000000000000000000000000000000| 0x1DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF| | ||
| cyprus2 | region-0| zone-0-1| 0x1E00000000000000000000000000000000000000| 0x3AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF| | ||
| cyprus3 | region-0| zone-0-2| 0x3B00000000000000000000000000000000000000| 0x57FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF| | ||
| paxos1 | region-1| zone-1-0| 0x5800000000000000000000000000000000000000| 0x73FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF| | ||
| paxos2 | region-1| zone-1-1| 0x7400000000000000000000000000000000000000| 0x8FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF| | ||
| paxos3 | region-1| zone-1-2| 0x9000000000000000000000000000000000000000| 0xABFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF| | ||
| hydra1 | region-2| zone-2-0| 0xAC00000000000000000000000000000000000000| 0xC7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF| | ||
| hydra2 | region-2| zone-2-1| 0xC800000000000000000000000000000000000000| 0xE3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF| | ||
| hydra3 | region-2| zone-2-2| 0xE400000000000000000000000000000000000000| 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF| | ||
|
||
## Copyright | ||
|
||
This QIP is licensed under the BSD 2-clause license. |
Oops, something went wrong.