Week 10
Interoperability And The Open Web
- Decentralized systems from zero, week 10
- How independent systems exchange data, value, and posts.
Outcomes
What You Will Be Able To Do
- Explain oracles and the oracle problem.
- Describe cross-chain messaging and its trust.
- Compare ActivityPub and Nostr.
- Sign and verify an event in code.
- List local-first principles.
Motivation
Why Systems Must Talk
- Each system keeps its own state.
- Contracts need outside facts.
- Users want to move value between chains.
- People want to follow friends on other servers.
Outside data
Oracles
- A contract reads only its own chain.
- An oracle brings outside data on chain.
- Examples: prices, weather, sports results.
- The contract inherits the oracle's trust.
web price -> oracle -> chain data
chain data -> lending contract
Outside data
Narrowing The Oracle Problem
- Many independent reporters, median result.
- Time-averaged prices from on-chain markets.
- Bonded disputes in optimistic oracles.
- Signed data from the original publisher.
Checklist
Three Oracle Questions
- Who reports the data?
- What does it cost them to lie?
- How long do we wait before acting?
Bridges
Cross-Chain Messages
- Chain B cannot see chain A directly.
- Someone must report events from A to B.
- B must decide whether to believe the report.
- A bridge carries messages and assets.
chain A: lock 10 tokens
-> message
chain B: mint 10 wrapped tokens
Bridges
Four Bridge Designs
- External verifiers: trust a signer group.
- Light clients: trust the source chain consensus.
- Optimistic: trust watchers in a challenge window.
- Zero-knowledge: trust a proof.
| Bridge design | Trust |
|---|
| Multisig | A group of signers |
| Light client | Chain consensus |
| Optimistic | Challengers |
| Liquidity pool | Pool operators |
Bridges
Bridge Habits
- Move only the value you need.
- Prefer public trust assumptions.
- Limit what one bridge can hold.
- Plan for bridge failure.
Social protocols
Federation
- Many servers speak one protocol.
- Email is the classic example.
- Users pick a server and its rules.
- Servers exchange messages on behalf of users.
Social protocols
ActivityPub And Mastodon
- W3C standard published in 2018.
- Actors have an inbox and an outbox.
- Mastodon, PeerTube, and Pixelfed use it.
- The network of servers is the fediverse.
Ana@server1 posts note
server1 -> inbox of Bo@server2
server2 shows note to Bo
Social protocols
Nostr
- Your identity is a key pair.
- Posts are signed JSON events.
- Relays store and forward events.
- Clients verify every signature.
{"pubkey": "...", "kind": 1,
"content": "hello", "sig": "..."}Compare
Federation Or Keys
- ActivityPub: identity lives on a server.
- Nostr: identity lives in a key.
- Federation gives strong local moderation.
- Keys give portability and key safety duties.
Data ownership
Local-First Software
- Your data lives on your devices first.
- The app works offline.
- The network syncs copies.
- Written up in 2019 by Kleppmann and colleagues.
Data ownership
CRDTs
- Separately edited copies merge automatically.
- Order of merging does not change the result.
- Automerge and Yjs are popular libraries.
- Encryption keeps relays from reading content.
A edits offline: add 'x'
B edits offline: add 'y'
merge(A, B) == merge(B, A)
Summary
Recap
- Oracles import facts, so budget the cost of lying.
- Bridges differ in who they trust.
- Federation ties identity to servers, Nostr to keys.
- Local-first keeps data with its owner.
Coming up
Next Week: Communities And Institutions
- Network states and pop-up cities.
- Cooperatives and Ostrom's commons.
- Running a decentralized community.
Wrap up
Questions And Exercise
- Exercise: sign and verify a Nostr-style event.
- Test tampering and write what you see.
- Read the local-first essay.