📇 🏠 - Turn plain-English food descriptions into structured, content-addressed data blocks for ingredients,…
FoodBlock
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
The smallest language strangers in food need to agree on, with no boss. Everything else is data.
A block is three fields, signed by its author on their own device:
This is an offer: it is signed by its from side. Its id is the hash of its canonical form (one exact way of writing
it as text: RFC 8785). The author signs the same bytes with Ed25519 (the default suite; p256 and sm are two more). Nobody's clock decides who has authority. The
other side can check that authority. Nothing can be lost or forged without it showing.
- **The spec:** spec/protocol.md, FoodBlock 1.6. It is normative: where anything else here
disagrees, it governs. Beside it: protocol.json (every list, for code to load), the
canonical form, transport (email is the envelope, FoodBlock the
letter) and the conformance vectors. There is no earlier version in the protocol: 1.6 is
year zero. Old data enters once, through a converter that is not part of the protocol.
- **The paper:** spec/whitepaper.md (PDF), the published v1.5
whitepaper: why the protocol exists. Where it and the spec differ, the spec is current.
The language
**Seven types**, in three moods:
| | Type | Meaning |
|---|---|---|
| What exists | actor | A person, an agent or machine, a circle, or a contact |
| | thing | Anything held, found or written: food, tools, places, recipes, shares, schemas |
| Is | observe | A claim that something is so |
| | transform | A thing changes: inputs become outputs, or a thing is kept and stays itself |
| | transfer | A thing changes owner, holder or place |
| Must | promise | A commitment, offered or asked |
| May | grant | Authority given to someone |
**Seven verbs**, the refs that link blocks: updates, answers (the only way to consent), confirms, defeats,
for, derives_from, same_as. prev and after say what came before.
**Strict.** Only four types carry authority and are closed (actor, promise, transfer, grant); any other word
is an open type that a node stores and passes on. A node writes and reads only 1.6 shapes: no nulls, no floats
(money is { minor, currency }, an amount { value, unit } with a decimal string), exact UTC times, sets written
sorted, every block in its key's chain (state.seq, refs.prev). It never repairs a block: it refuses it, and the
author signs a new one.
Three sizes of peer
Every peer speaks the protocol itself: a phone, a robot kitchen, a delivery van, a drone, a smart fridge, a
sensor. Machines are peers like people. Any food machine can take an SDK, make its own identity, and act within the
grants it holds. Each peer is one of three sizes (protocol.json peers):
- **Micro**, a device: a soil or fridge sensor, a scale, an oven, a robot's body. It needs the canonical form,
SHA-256, Ed25519, the write check, its own chain, and the vectors for these. One that acts in the world also
checks its grants and stops the moment a stop arrives.
- **Edge**, the local operator: the computer at a farm, in a kitchen, in a van or a shop. It adds local discovery,
pull and push with the peers near it, the promise fold for its own deals, and it keeps working offline.
- **Node**, the lasting level: adds sealed envelopes and commitments, serving pull and push to anyone, signed
answers, internet discovery, and the folds for every record it holds.
Only people and machines hold nodes. A business, a household or a community is a **circle** of them: it has an id