Skip to content

Commit 6382674

Browse files
authored
Merge branch 'master' into dynamic_mpt
2 parents c557ad4 + 916d373 commit 6382674

File tree

14 files changed

+1662
-62
lines changed

14 files changed

+1662
-62
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ concurrency:
1616

1717
jobs:
1818
build:
19+
if: github.repository == 'XRPLF/XRPL-Standards'
1920
runs-on: ubuntu-latest
2021
steps:
2122
- name: Checkout
@@ -52,6 +53,7 @@ jobs:
5253
path: "site/_site"
5354

5455
deploy:
56+
if: github.repository == 'XRPLF/XRPL-Standards'
5557
environment:
5658
name: github-pages
5759
url: ${{ steps.deployment.outputs.page_url }}

XLS-0018-bootstrapping/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<pre>
2+
xls: 18
3+
title: Standard For Bootstrapping XRPLD Networks
4+
description: An experimental procedure to bootstrapping XRP Ledger Network
5+
author: Richard Holland (@RichardAH)
6+
created: 2021-03-25
7+
status: Stagnant
8+
category: Community
9+
</pre>
10+
11+
This procedure is experimental and additions amendments or recommendations based on experience to this standard draft are welcome.
12+
13+
### Problem Definition
14+
`Xrpld` / `rippled`[[1]](https://github.com/ripple/rippled) is the software that processes, achieves consensus upon and serves the decentralised public XRP Ledger, as well as numerous other public and private ledgers.
15+
16+
From time to time a decentralised network may stall, fork, or otherwise fail to achieve consensus because of a bug, network instability, unreliable nodes or operators, a deliberate attack, or any combination of these. In this event the bootstrapping procedure to return the network to normal operation is important and should be followed correctly to avoid (further) forks and halts.
17+
18+
### Terminology
19+
`Validator` refers to a rippled instance configured to publish validations of ledgers.
20+
`UNL` refers to a list of validator public keys that the network has collectively agreed are allowed to validate ledgers.
21+
`Node` refers to a validator currently listed in the network's `UNL`.
22+
23+
24+
### Procedure — Cold Start
25+
Cold start describes a situation in which *none* of the validators in a network are currently running. This situation can arise because they crashed, were terminated automatically or were terminated manually (or any combination of these.)
26+
27+
1. Select a node from your UNL to be the `leader`. The remaining nodes will be referred to as `followers`.
28+
2. On the `leader` run rippled from your terminal in the foreground with the following flags:
29+
`./rippled --valid --quorum 1 --load`
30+
3. On each follower run rippled from your terminal in the foreground with the following flags:
31+
`./rippled --net --quorum 1`
32+
4. In a seperate terminal, on each of the `followers` and on the `leader` you may monitor whether or not ledgers are closing correctly using:
33+
`./rippled ledger closed`
34+
In particular ensure the ledger index is incrementing and the ledgers are validated.
35+
5. On the `leader` terminate the foreground rippled process. (Ctrl + C)
36+
6. On the `leader` run rippled normally as a daemon.
37+
7. On the `leader` in the second terminal continue to monitor the last closed ledger until validation is consistently achieved, as per 4.
38+
8. Select one `follower` node.
39+
9. Terminate the foreground process on the selected `follower` and start rippled normally.
40+
10. Monitor for LCL validation as per 4.
41+
11. Repeat from step 8 until all nodes are running normally.
42+
43+
### Troubleshooting
44+
Small networks may require the `quorum` size to be permanently overridden for network stability. To do this modify the control script that runs rippled to include `--quorum X` where X is the number of nodes in your UNL less 1.
45+
46+
47+
### Other cases TBD
48+
49+
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<pre>
2+
xls: 25
3+
title: Enhanced Secret Numbers
4+
description: Enhances XLS-12 secret number format by introducing an additional block for encoding ancillary information, and supporingt for longer secrets.
5+
author: Nik Bougalis (nikb@bougalis.net)
6+
status: Final
7+
category: Community
8+
created: 2021-12-10
9+
</pre>
10+
11+
# Enhanced Secret Numbers
12+
13+
## Abstract
14+
The Secret Numbers proposal **<a href="https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-12">XLS-12</a>** introduces a new format for secrets - based on blocks of numbers/digits (0-9) with block-level checksums - to generate XRP Ledger account keys and address. This draft proposes augmenting and enhancing **XLS-12** to make the format more flexible and more robust.
15+
16+
### Motivation
17+
The XRP Ledger typically uses 128-bit seeds as the cryptographic material from which cryptographic keys for accounts are derived. Such seeds are generally too long for humans to remember and the existing formats are hard to <em>transcribe</em>. Prior to XLS-12, there were 4 canonical encoding for the seed data:
18+
19+
1. A Base58-based encoding scheme beginning with the letter `s` (in this format, the result is often, but _incorrectly_, referred to as a private key); or
20+
2. A word-based "mnemonic", encoded using a variant of RFC 1751; or
21+
3. A raw hex string, directly representing the 128-bit seed; or
22+
3. A passphrase, an arbitrary string of words which is hashed to produce a seed.
23+
24+
By way of example, let's use the well-known [genesis account](https://xrpl.org/accounts.html#special-addresses), `rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh`, which has an associated **`secp256k`** key:
25+
26+
1. The seed for the account is `snoPBrXtMeMyMHUVTgbuqAfg1SUTb`;
27+
2. The mnemonic is `I IRE BOND BOW TRIO LAID SEAT GOAL HEN IBIS IBIS DARE`;
28+
3. The raw hex is `DEDCE9CE67B451D852FD4E846FCDE31C`; and
29+
3. The corresponding passphrase is `masterpassphrase`.
30+
31+
The **XLS-12** standard introduced a new format, secret mumbers, which consists of 8 blocks of 6 digits, where the first five digits correspoding to a 16-bit number (from 0 to 65535) and the 6th digit is a checksum based on the five preceding digits and the index of the block. The **XLS-12** secret numbers for the genesis account are: `570521-598543-265488-209520-212450-201006-286214-581400`.
32+
33+
### Issues with XLS-12
34+
35+
The **XLS-12** specification, while convenient and easier to transcribe, has several drawbacks:
36+
37+
First, it encodes no ancillary information about the information encoded (e.g. whether it is meant to derive a **secp256k1** or an **Ed25519** key) and is limited to only encoding seeds, from which keys are then derived. Second, the block-level checksum is inefficient and detects only a small percentage of errors.
38+
39+
Lastly, it's unclear whether the secret numbers should be used to create a **secp256k1** or an **Ed25519** key. For example, given the above `570521-598543-265488-209520-212450-201006-286214-581400` secret numbers, an implementation could derive an **Ed25519** and, therefore, an account that is not the well-known genesis account. Tools that support secret numbers typically resort to detecting the type of account, usually in a semi- automated fashion, but on occasion by resorting to asking the user to confirm their intended public address.
40+
41+
### Enhancements to XLS-12
42+
43+
This proposal aims to address these problems by proposing extensions to **XLS-12** which retaining backwards compatibility. There are three primary changes:
44+
45+
1. Using a simplified but more powerful per-block checksum;
46+
2. Introducing an additional block, which is used to encode ancillary information; and
47+
3. Support for longer blocks, allowing encoding of 128-bit and 256-bit secrets.
48+
49+
Secret numbers compatible with this specification will always be composed of an odd number of blocks; secret numbers compatible with the **XLS-12** specification will always be composed of an even number of blocks&mdash;or more specifically, precisely 8 blocks. This makes it possible to seamlessly detect which standard was used and allows for backwards compatibility.
50+
51+
#### Per-block checksusm
52+
53+
Under **XLS-12** the Nth block consists of 16 bits of raw key material, and an additional checksum digit. Assuming the keying material has value `X` the N<sub>th</sub> block would be: `(X * 10) + ((X * (N * 2 + 1)) % 9)`.
54+
55+
In theory, the checksum digit can take any value from [0,...,9] but, by construction, not all checksum digits are equally likely across all blocks, reducing their usefulness. For blocks at positions 2 and 8, the only valid checksum digits are `0`, `3` and `6`; blocks at position 5 are worse, with `0` being the _only_ valid checksum digit.
56+
57+
This proposal simplifies the checksum function for key blocks by reducing it to a simple multiplication by 13, a prime number. That is, the N<sub>th</sub> key block simply becomes: `X * 13`. Under this scheme, the possible values are multiple of 13 and and the range is from [0,...,851955]. This scheme avoids the position-dependent behavior observed with the existing scheme and allows for more efficient error detection.
58+
59+
#### Information Block
60+
61+
This proposal _prepends_ an additional 6-digit block, composed of two 16-bit values, that encodes ancillary information about the content and a checksum of the blocks that can be used to detect whole-block transposition, or incorrect blocks.
62+
63+
First, calculate the checksum of all blocks as `(∑(𝑥[i] * π[i]>)) mod 256`, where `𝑥[i]` is the i<sup>th</sup> 16-bit block of data being encoded and `π[i]` is the i<sup>th</sup> prime number. The result is an 8-bit value, `C`.
64+
65+
##### Flags
66+
The proposal also defines an 8-bit field, that can be used to specify details or ancillary information about the key. This proposal defines this as a bitfield named `F`. The following flags are defined:
67+
68+
|Value | Meaning |
69+
|------|----------------------------------------------------------------------------------------------------------------------------|
70+
| `0x01` |The data block represents a raw 128-bit _seed_, from which private keys can be derived using the derivation algorithm defined in `rippled`. |
71+
| `0x02` |The private key calculated or derived from this block of data is used with the **secp256k1** algorithm. |
72+
| `0x04` |The private key calculated or derived from this block of data is used with the **Ed25519** algorithm. |
73+
| `0x08` |The data block represents an **Ed25519** validator master key. This flag cannot be combined with any other flags. |
74+
| `0x10` |The data block represents the fulfillment of a `PREIMAGE-SHA256` cryptocondition. This flag cannot be combined with any other flags. |
75+
76+
##### Using Flags
77+
78+
The different flags used with extended keys make it possible to directly encode different types of keys as well as allow for 128-bit and 256-bit keys.
79+
80+
For example:
81+
82+
- A 256-bit **`secp256k`** (or **`Ed25519`**, if the `0x08` flag is included) key can be directly encoded as 17 groups, if they information block does not include the `0x01` flag.
83+
- A 256-bit preimage for a cryptocondition can be encoded as 17 groups, if the information block includes the `0x10` flag.
84+
85+
Other flags may be added in the future. A compliant implementation of this proposal _SHOULD_ fail if any flags other than the ones it understands are used.
86+
87+
88+
##### Information Block Checksum
89+
90+
By construction, no valid XLS12 block can have a value greater than 655356 (i.e. 65535 * 10 + (65535 % 9)). This means that any block that begins with a 7, 8 or 9 cannot be a valid XLS12 block. This means that we can construct the first block in such a way so as to allow for automatic detection of "classic" XLS-12 keys and "extended" keys as defined in this proposal.
91+
92+
Again, assume that C is the checksum described above and F is the flag bitfield, then the information block checksum `X` is defined as:
93+
94+
X = (F ^ C) % 3
95+
96+
The information block itself is then calculated as:
97+
98+
A = ((X + 7) * 100000) + (C * 256 + F)
99+
100+
The end result is an A block that begins with 7, 8 or 9, which means it cannot be a valid XLS12 block, while still retaining a checksum in the A block.
101+
102+

0 commit comments

Comments
 (0)