pzp-wiki/guide/intro.md

100 lines
3.3 KiB
Markdown

---
sidebar_position: 1
---
# PZP Docs
What is "PZP":
- A local-first P2P protocol with 10 years of learnings baked in
- Message formats + Message validation + RPC methods
- If scuttlebutt is :slightly_smiling_face: then pzp is :sunglasses:
What it doesn't specify:
- Disk storage
## Features
- sig-chains - you know what the messages are
- first class multi-device support
- partial replication (using lipmaa links)
- message deletion (can leave nothing, or only metadata)
### How PZP is different from SSB (Secure Scuttlebutt)
- Storage is designed to not grow indefinitely. By default (of course overridable) an app's storage shouldn't go above 100MB.
- Multi device/app support from the start. Every device/app has its own keypair. They're connected together into one identity using an Account tangle. The Account tangle's root message ID is the account's identifier.
- One account or even keypair can post messages concurrently (forking) without problem. Because there aren't linear feeds, everything is in tangles.
- Deletion is possible. The data contents of a message is separate from the message metadata, and only the metadata + hash of the data is signed.
### How PZP is different from Nostr
- keys are not shared across devices
- sig-chains - you know if you're missing content in PZP
## Tangles
Tangles control how messages are organised. They provide a way to group, and causally sort (partially), which is important for replication.
Basics of tangles in PZP: it's a directed acyclic graph (DAG) which aims to be as linear as possible
```mermaid
flowchart RL
E --> D --> C --> A
D --> B --> A
```
There are 3 sorts of tangles:
- Account - a tangle which weaves (device) keys and defines capabilities / permissions of these
- Feed - a tangle where all messages are from valid devices (as defined by an Account), and scoped to a particular domain
- e.g. all post messages from "mix"
- e.g. all chess messages from "happy0"
- Thread - a tangle where multiple Accounts are collaborating on some state
- e.g. all the messages making up a "10th birthday gathering"
- e.g. all the messages in a discussion
- e.g. all the messages in a shared shopping list
### Account Tangle
The account tangle starts with a message which says "This key is allowed to author messages on behalf of this account, and add further keys".
Subsequent messages in this tangle may add / remove capabilities for existing / new keys.
Messages in this tangle are verified by checking state they're extending on
### Feed Tangle
_Domain Tangle, AccountDomain Tangle_
### Thread Tangle
All tangles have
- a root / root message
- an ID (the id of the root message of the tangle)
- have tangle-data for causal ordering
How the tangles differ
- the Account tangle has strict validation of messages (it is only valid to write to it if you've been given permission to)
- a Feed root is deterministic! (only inputs are accountId + domain)
## Messages
https://github.com/staltz/ppppp-db/blob/master/protospec.md
## RPC methods
- [Replication](https://github.com/staltz/ppppp-sync/blob/master/protospec.md)
## Other
- [ppppp-invite](https://github.com/staltz/ppppp-invite/blob/master/protospec.md)
- [ppppp-set](https://github.com/staltz/ppppp-set/blob/master/protospec.md)
- [ppppp-dict](https://github.com/staltz/ppppp-dict/blob/master/protospec.md)