Protocol Reference
The Engram wire protocol — synapse types, CID specification, scoring formulas, and network constants.
Synapse types
Engram uses two Bittensor synapse types for neuron communication:
IngestSynapseValidator → MinerCarry text and metadata to the miner for embedding and storage.
textstrText to embed (max 8192 chars)metadatadictKey-value metadata (max 4 KB)→ cidstrAssigned content identifier→ errorstr | NoneError message if failedQuerySynapseValidator → MinerCarry a query text and top_k. Miner returns ranked results.
query_textstrNatural language querytop_kintMax results (1–100)→ resultslist[dict]Ranked {cid, score, metadata}→ errorstr | NoneError message if failedCID specification
CIDs are deterministically derived from the embedding vector using SHA-256:
python
# CID derivation (simplified)import hashlibdef derive_cid(embedding: list[float]) -> str:raw = b"".join(struct.pack(", x) for x in embedding) digest = hashlib.sha256(raw).hexdigest()return f"v1::{digest[:32]}"# Examplecid = "v1::a3f2b1c4d5e6f7a8b9c0d1e2f3a4b5c6"
Note
The same text always produces the same CID regardless of which miner stores it. This is the core content-addressing guarantee.
Scoring formulas
python
# Composite score (computed by validator, per miner)composite_score = (0.50 * recall_at_10 # fraction of challenge vectors correctly returned+ 0.30 * latency_score # normalized inverse latency+ 0.20 * proof_success_rate # HMAC challenges passed / total)# Latency score — 1.0 at ≤100ms, 0.0 at ≥500mslatency_score = max(0.0, 1.0 - (latency_ms - 100) / 400)# Miners below 50% proof success rate → weight = 0if proof_success_rate < 0.50:composite_score = 0.0# Weights are proportional to normalized scoresweights = softmax(composite_scores)
Constants
| Constant | Value | Description |
|---|---|---|
| NETUID | 42 | Subnet UID on testnet |
| EMBEDDING_DIM | 1536 | Vector dimension (text-embedding-3-small) |
| MAX_TEXT_LENGTH | 8192 | Max characters per ingest |
| REPLICATION_FACTOR | 3 | Target copies across miners |
| SCORING_INTERVAL | 120s | Time between scoring rounds |
| WEIGHT_INTERVAL | 600s | Time between on-chain weight updates |
| CHALLENGE_SAMPLE_SIZE | 10 | CIDs challenged per miner per round |
| MIN_PROOF_RATE | 0.50 | Proof success rate floor |
| MIN_STAKE_TAO | 0.001 τ | Minimum stake to pass stake check |
| RATE_LIMIT_RPM | 60 | Max requests per minute per hotkey |
| CID_VERSION | "v1" | Current CID scheme version |
engram docs · v0.1edit on github →