Skip to content

Instantly share code, notes, and snippets.

@melnikaite
Last active April 6, 2022 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melnikaite/22580dc315632973124834888003f409 to your computer and use it in GitHub Desktop.
Save melnikaite/22580dc315632973124834888003f409 to your computer and use it in GitHub Desktop.
Decentralized messenger

The following schema shows how we can build a decentralized messaging system where recipients are in charge of received data. Neither smart contracts, not calldata, not IPFS, nor shared pools are used to keep messages. All messages are encrypted for recipients.

router

It can be a global smart contract keeping mapping between recipient EOA and endpoint for receiving messages. The same information also can be saved in onchain metadata of a single smart contract. Possible format: {recipientAddress: {protocolName: {protocolVersion: {endpoint: "https://example.com/my-path", readme: "https://example.com/readme", publicKey: "0xabc...", supportedMethods: ["method1", "method2"]}}}}

server

The owner of the server can make white/black lists, decide what messages and how long to keep, can run hooks/bots, and can deduct utility tokens for paid functions. The server can be shared for many independent recipients (with just different paths of endpoints) or just for a single recipient. In the case of a group chat, the server will send messages to other participants. The only downside is the necessity to enable DDoS protection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment