File size: 5,943 Bytes
a5f6536 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | ---
license: apache-2.0
tags:
- knowledge-graph
- wiki-data
- wikipedia
language:
- en
pretty_name: GetNID — Neurofold Identity Registry v1.0
size_categories:
- 1M<n<10M
---
```
# GetNID — Neurofold Identity Registry v1.0
**A deterministic, cryptographically-immutable identifier registry for 6.7 million Wikipedia concepts.**
GetNID mints a canonical **Neurofold ID (NID)** for every resolved Wikipedia article, bridging human-readable titles and Wikidata QIDs through a trustless, serverless resolution protocol. The registry is designed to function as foundational namespace infrastructure for decentralized knowledge systems.
---
## What is a NID?
A Neurofold ID is a deterministic 13-character identifier derived directly from the SHA-256 hash of a concept's Wikidata QID.
```
"Mathematics" → Q395 → N5336CE94E17E
"Albert Einstein" → Q937 → N6F2A8C14B301
```
NIDs are **permanent**, **content-addressed**, and **collision-resistant**. They require no central authority to issue or resolve.
---
## Resolution Architecture
The registry implements a **double-sharding scheme** for O(1) lookup with no index scans, no search, and no server-side compute.
```
Title lookup (double-hop):
sha256(normalize(title))[:2] % 256 → router shard → NID
NID[1:5] % 8192 → data shard → record
QID / NID lookup (single-hop):
sha256(QID)[:4] % 8192 → data shard → record
NID[1:5] % 8192 → data shard → record
```
| Layer | Shards | Purpose |
|---|---|---|
| Data shards | 8,192 | `ledger(nid, qid, title, lang)` |
| Router shards | 256 | `routes(key_hash, target_nid)` |
All shards are static SQLite files (~100KB each). The full registry is ~1.5GB. Every shard is independently verifiable against a cryptographic `manifest.json` generated at genesis time.
---
## Live Demo
**[getnid.org](https://getnid.org)** — resolve any Wikipedia title, QID, or NID in the browser.
Resolution runs entirely client-side via a Web Worker using sql.js (SQLite compiled to WebAssembly). Resolved shards are cached locally via the browser's **Origin Private File System (OPFS)**, enabling zero-latency offline resolution after first access. Users can opt into a full global sync to permanently mirror the entire registry locally.
---
## Dataset Structure
```
v1/
├── manifest.json # SHA-256 hash of every shard (trustless verification)
├── meta.json # Version, genesis timestamp, master checksum, metrics
├── shards/
│ ├── shard_0000.db # SQLite — ledger table
│ ├── shard_0001.db
│ └── ... (8,192 total)
└── routers/
├── router_000.db # SQLite — routes table
├── router_001.db
└── ... (256 total)
```
### `ledger` schema (data shards)
```sql
CREATE TABLE ledger (
nid TEXT PRIMARY KEY, -- e.g. N5336CE94E17E
qid TEXT UNIQUE, -- e.g. Q395
title TEXT, -- e.g. Mathematics
lang TEXT -- e.g. en
);
```
### `routes` schema (router shards)
```sql
CREATE TABLE routes (
key_hash TEXT PRIMARY KEY, -- sha256(norm_title)[:16]
shard_id INTEGER,
norm_title TEXT,
target_nid TEXT
);
```
---
## Usage
### Python (local resolution)
```python
from getnid.registry import LocalRegistryClient
from pathlib import Path
client = LocalRegistryClient(Path("./v1"))
# Resolve by title
client.get_by_title("Mathematics")
# → {"nid": "N5336CE94E17E", "qid": "Q395", "title": "Mathematics", "lang": "en"}
# Resolve by QID
client.get_by_qid("Q42")
# → {"nid": "N...", "qid": "Q42", "title": "Douglas Adams", "lang": "en"}
# Resolve by NID
client.get_by_nid("N5336CE94E17E")
# → {"nid": "N5336CE94E17E", "qid": "Q395", "title": "Mathematics", "lang": "en"}
```
### Direct shard query (any language)
```python
import hashlib, sqlite3
def resolve_qid(qid: str, shard_dir: str) -> dict:
h = hashlib.sha256(qid.upper().encode()).hexdigest().upper()
shard_id = int(h[:4], 16) % 8192
db_path = f"{shard_dir}/shard_{shard_id:04d}.db"
with sqlite3.connect(db_path) as conn:
row = conn.execute(
"SELECT nid, qid, title, lang FROM ledger WHERE qid = ?",
(qid.upper(),)
).fetchone()
return dict(zip(["nid", "qid", "title", "lang"], row)) if row else None
```
### JavaScript / Browser
```javascript
const sha256 = async (text) => {
const buf = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text));
return Array.from(new Uint8Array(buf)).map(b => b.toString(16).padStart(2,'0')).join('').toUpperCase();
};
async function resolveQID(qid) {
const hash = await sha256(qid.toUpperCase());
const shardId = parseInt(hash.slice(0, 4), 16) % 8192;
const fileName = `shard_${String(shardId).padStart(4,'0')}.db`;
// Fetch shard, query with sql.js
}
```
---
## Metrics
| Metric | Value |
|---|---|
| Minted NIDs | ~6.7M |
| Languages | en (v1.0) |
| Data shards | 8,192 |
| Router shards | 256 |
| Avg shard size | ~100 KB |
| Total payload | ~1.5 GB |
| Lookup complexity | O(1) |
---
## Licensing
| Component | License |
|---|---|
| Registry code & protocol | [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) |
| Ledger data (derived from Wikidata) | [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) |
Wikidata content is made available by the Wikimedia Foundation under CC BY-SA 4.0. Use of the registry data is subject to those upstream terms.
---
## Repository
[github.com/neurofold/getnid](https://github.com/neurofold/getnid)
---
## Citation
```bibtex
@misc{getnid2026,
author = {Larson, JB},
title = {GetNID: Neurofold Identity Registry v1.0},
year = {2026},
url = {https://huggingface.co/datasets/Neurofold/getnid},
note = {Deterministic identifier registry for 6.7M Wikipedia concepts}
}
``` |