Skip to content

Commit 842e0c9

Browse files
committed
Added Polykey Node IDs documentation
1 parent 5079b6d commit 842e0c9

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

docs/reference/polykey-node-ids

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: 'How Polykey Handles Node IDs'
3+
date: "2025-03-09"
4+
author: 'Your Name'
5+
tags: ["Node ID", "Base32", "Key Management", "Polykey"]
6+
---
7+
8+
# How Polykey Handles Node IDs
9+
10+
## The Basics
11+
12+
Polykey uses **Base32 Hex encoding** for Node IDs, and here is why:
13+
14+
- **Fixed Length:** A raw 32-byte Node ID always encodes to a 52-character string.
15+
- **Multibase Prefix ('v')**: The 'v' prefix tells us this is base32hex.
16+
- **Simple Alphabet:** No special characters - easy to copy, paste, and use anywhere.
17+
- **Sort Order Matters:** Unlike some encodings, base32hex keeps the same lexicographic sort order as the raw 32-byte data. This ensures Node IDs stay consistent whether they are stored in memory or displayed in a human-readable format.
18+
19+
## Why This Works Well for Polykey
20+
21+
- **Database-Friendly:** The 32-byte raw format is small enough to work as a database key without adding unnecessary bulk.
22+
- **Consistent Encoding:** Since Base32 Hex preserves sorting, we do not run into mismatches between encoded and raw representations.
23+
24+
## Recovery Code & Root Keypair
25+
26+
- **Not Stored by Polykey:** Users **must** back up their 24-word recovery code, or they will not be able to recover their root keypair.
27+
- **Same Recovery Code = Same Keypair:** If a user sets up a new node with the same recovery code, it regenerates the same root keypair. This ensures continuity in node identity.
28+
29+
## The Takeaway
30+
31+
We use Base32 Hex because it is clean, consistent, and efficient. Users need to take responsibility for their recovery codes, and if they ever want to recreate a node, using the same recovery phrase will generate the same root keypair.
32+
33+
Simple, secure, and reliable.

0 commit comments

Comments
 (0)