Skip to main content

Protocol

Architecture overview

The parts that make up Humanity Ledger, where each one runs, and what each one can see.

Humanity Ledger is a web application that connects your device to a small set of our own services and to two open networks. The most useful way to understand it is to ask, for each part, what it holds and what it can read.

Your device
  • Ledger Chat in your browser
  • Message keys and history
  • Your wallet, which signs
Accounts and communities
Humanity Ledger servers
  • Sign in and sessions
  • Profiles and contacts
  • Communities
  • Fallback relay, readable
Encrypted messages
XMTP network
  • Stores encrypted messages
  • Cannot read them
Payments you sign
Blockchains
  • Ethereum and layer 2 networks
  • Aztec, experimental
Your device talks to our servers for accounts and communities, to XMTP for messages, and to blockchains for payments you sign.

The parts

PartWhat it holdsCan it read your direct messages?
Your browserThe Ledger Chat app, your message keys and your conversation history.Yes. This is where messages are encrypted and decrypted.
Your walletThe private key for your address. It signs sign in messages and payments.No. It is never given message content.
Humanity Ledger serversAccounts, sessions, profiles, contacts, communities, the hash of your PIN and the fallback relay.Only messages that took the fallback path, which are labelled.
XMTP networkEncrypted messages waiting to be collected.No.
Ethereum and layer 2 networksPublic payments you send from your wallet.No. Payments themselves are public.
Aztec networkPrivate payment notes, in our experimental integration.No.

Our servers

The web application runs on Next.js. A PostgreSQL database holds accounts and community data, and a Redis cache holds short lived state such as rate limits, online status and fallback messages waiting for delivery.

The identity perimeter

Every request passes through one piece of code before it reaches any route. It deletes any identity headers the browser sent, verifies the session cookie, and only then attaches the verified address for the route to use. A route cannot be tricked into acting for someone else by a forged header or a parameter in the address bar.

  • Requests that change data must come from our own origin, which blocks cross site request forgery.
  • A content security policy with a fresh nonce on every request limits which scripts the page can run.
  • Sign in, email codes and PIN checks are rate limited.

Services we rely on

ServiceUsed forWhat it receives
XMTPDelivering direct messagesEncrypted messages and the time they were sent.
Reown WalletConnectConnecting wallets on other devicesYour wallet address and connection requests.
ResendSending sign in codes by emailYour email address and the code.
Cloudflare TurnstileStopping automated email sign upsBrowser signals used to tell people from bots.
Cloudflare R2Storing attachmentsThe files you attach.
PeerJS, Google STUN, OpenRelay TURNSetting up and relaying callsConnection details and, for relayed calls, encrypted media.
Public blockchain RPC providersReading balances and sending transactionsYour address and the transactions you send.

Known limits at scale

The web servers are stateless and can be run as many copies as needed. A few parts are not ready for that yet, and we list them so nobody is surprised:

  • Device linking codes and some rate limit counters live in the memory of a single server, so they do not follow a request to another copy.
  • Some views refresh by polling rather than by push, which adds load as the number of people online grows.
  • Community posts are served from the database on every request without a cache in front.