Skip to content

Example: HyperSwarm

Lorenzo Mangani edited this page Oct 16, 2021 · 2 revisions

Decentralized paStash with HyperSwarm

Hyperswarm powered pipes for paStash

In this decentralized tracing example, we'll use Hyperswarm for many paStash instances to discover each other's streams using the HyperSwarm DHT and securely connecting and exchanging data via peer-to-peer bidirectional pipes.

Bonus: The secure pipe can handle anything paStash can handle! 🔒

🔧 Install

Install pastash and the required plugin on two separate systems:

npm install -g @pastash/pastash @pastash/input_hyperswarm @pastash/output_hyperswarm

📍 Example

Create a recipe on the sender and receiver, sharing the same hyper key.

📢 Sender
input {
  stdin {}
}

output {
  hyperswarm {
    path => supersecretkeyword
  }
}
pastash --config_file=/tmp/sender.conf
📻 Receiver
input {
  hyperswarm {
    path => supersecretkeyword
  }
}

output {
  stdout {}
}
pastash --config_file=/tmp/receiver.conf
🔔 Try it!

Type something in the sender console and you should see corresponding events on the receiver. Et Voila'!

Multiple senders and receivers are chainable for one-to-many or many-to-one pipes

Next: use it to create a decentralized, p2p log and event distribution with a simple key exchange 🚀


Clone this wiki locally