Jacek Sieka
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
Whisper-PSS comparison == Whisper and PSS are two messaging procotols currently being developed in the Ethereum stack - here's a side-by-side comparison that can help guide your choice between them. ### Similarities * Online-first protocols - no built-in offline capability / expectation * Symmetric and asymmetric encryption available * Implemented on top of DevP2P * DevP2P offers encryption between directly connected peers in the underlying overlay network, but this [encryption is broken](https://github.com/ethereum/devp2p/issues/32) * A second layer of encryption is done in an end-to-end fashion at the Whisper/PSS level * 4-byte topic acts as hint for decryption * clients have to agree on topics out-of-band * Recipient anonymity: ability to decrypt makes you a recipient * Bloom filters and addressing limit anonymity in Whisper and PSS respectively * Sender anonymity: peers generally can't tell if neighbour peer is message originator * Being fully surrounded by cooperating adverserial nodes breaks this (similar to an eclipse attack) * Light clients that don't repeat traffic will leave more obvious metadata trail * When used without bloom filters or without addressing, routing is equivalent for Whisper and PSS respectively ### Differences | Feature | Whisper | PSS | | ------- | ------- | --- | | Routing | [Gossip](#Gossip) | [Kademlia](#Kademlia) | | DoS protection | [Proof of work](Proof-of-work) | [Swap incentives](#Swap-incentives) | | Bandwidth vs darkness | [Topic-based bloom filters](#Bloom-filtering) - intermediary / recipient decides | [Partial addressing](Partial-addressing) - sender decides | | Encryption in API | Mandatory | Optional | | Key exchange | N/A | Optional Diffie-Hellman | | Message lifetime | [Time-to-live](#Time-to-live) (sender decides) | One pass through each intended node | ## Whisper Whisper is a gossip-based combination of a messaging protocol and ephemeral value store - values circulate in the system until expiry. The value store view is perhaps more apt - you throw messages into the cloud of participating nodes and they keep getting replicated until expiry, even when new nodes join. ### Gossip * Connected peers form a "random" subset of all nodes in network * Each message is sent to all connected peers * Each time a message is sent to a peer, it's also added to a seen list for that peer * Multiple peers will send you the same message - only propagated to those that don't have it on the seen list already * Scalability issues: * each node sees each message multiple times * too many restricted nodes will cause low propagation probability * see https://hackmd.io/B-W4T1SzSgCAbYS2CfoIPg for further analysis ### Proof of work * PoW calculated over `expiry, ttl, topic, data, nonce` meaning that you need both a timestamp and contents of message to create the PoW * `pow = (2^BestBit) / (size * TTL)` meaning that large messages or those with long TTL are penalized * Tricky for heterogenous devices ### Bloom filtering * Topics are compressed to a bloom filter that is sent to directly connected peers * Peers only forward messages to you that match filter * Violators are disconnected * Recipient decides how "dark" it wants to be by revealing a more or less accurate bloom filter * Aggressive bloom filtering can cause network partitioning, makes nodes less valuable in network * Nodes repeat messages to peers in order to achive sender metadata safety * Works as long as you're not surrounded by coordinated malicious peers * Bloom filters limit efficiency ### Key exchange * Must be done out-of-band ### Time to live * Sender decides on a time-to-live for messages, and pays PoW for it * Messages are kept/cached in every node until their TTL expires * If a new node connects, it will receive all messages whose TTL has not yet expired * Together with topics and capability to decrypt, this can be seen as an ephemeral key-value store of sorts ## PSS PSS wraps whisper and adds the swarm routing protocol to add deteministic routing. With PSS, routing is done along the kademlia path up to the partial address that was supplied - then gossip takes over. Unlike Whisper, there is no DHT-like functionality where new nodes are updated on the "current" database of messages. https://swarm-guide.readthedocs.io/en/latest/pss.html https://swarm-guide.readthedocs.io/en/latest/resources.html ### Kademlia * Overlay networked addressed by ethereum public key hash * Kademlia defines a measure of distance between arbirary nodes * You connect to a subset of all nodes based on these distances so as to reach a good balance between connectivity and distance * Each hop gets you closer to final destination, similar to a binary search ### Swap incentives * TODO - not implemented ### Partial addressing * Place in kademlia overlay determined by ethereum key * by specifying part of key, we can narrow down the number of hosts that "could" be recipients of message and route towards them - the neighbourhood * Gossip the remaining bit, among neighbourhood peers * Path through network depends on source address and the partial address supplied * Kademlia assumed to consist of mostly stable nodes with long-term connections - thus one can assume a deterministic path up to the partial addressing point ### Key exchange * Rudimentary ephemeral diffie hellman exchange part of the API ## Other resources ### Code * [parity/whisper](https://github.com/paritytech/parity-ethereum/tree/master/whisper) * [go-ethereum/whisper](https://github.com/ethersphere/go-ethereum/tree/master/whisper) * [go-ethereum/PSS](https://github.com/ethersphere/go-ethereum/tree/master/swarm/pss) ### Random links * [When whisper/PSS instead of traditional messaging](https://ethereum.stackexchange.com/questions/47109/when-should-i-use-whisper-or-pss-over-traditional-message-channel-like-aws-sqs) * [initial pss description](https://gist.github.com/zelig/d52dab6a4509125f842bbd0dce1e9440) * [go-ethereum p2p samples](https://github.com/nolash/ethereum-samples/tree/master/p2p/devp2p) ## Appendix: Examples ### Whisper message propagation ```graphviz graph nodes { 00 -- 01; 00 -- 10 ; 10 -- 11; 01 -- 11; 01 -- 10; {rank=same; 00 01} {rank=same; 10 11} } ``` ```graphviz digraph step1 { 00 -> 01; 00 -> 10; {rank=same; 00 01} {rank=same; 10 11} } ``` ```graphviz digraph step2 { 00; 01 -> 10; 10 -> 11; 01 -> 11; 10 -> 01; {rank=same; 00 01} {rank=same; 10 11} } ``` Notice how `10`, `01` potentially receive message twice (depending on timing) and `11` is guaranteed to recieve twice (in this setup, due to locally limited knowledge in `01`, `10` nodes) ### PSS message propagation Example propagation to address `1*`: ```graphviz graph nodes { 00 -- 01; 00 -- 10 ; 10 -- 11; 01 -- 11; 01 -- 10; {rank=same; 00 01} {rank=same; 10 11} } ``` ```graphviz digraph step1 { 00 -> 10; {rank=same; 00 01} {rank=same; 10 11} } ``` ```graphviz digraph step1 { 00; 10 -> 11; {rank=same; 00 01} {rank=same; 10 11} } ``` Either of `10`, `11` could be recipient, message reaches both!

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully