Skip to content

Instantly share code, notes, and snippets.

@vrde
Created April 24, 2020 07:29
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 vrde/87b778338dcc120ab34819ed3bdd3e04 to your computer and use it in GitHub Desktop.
Save vrde/87b778338dcc120ab34819ed3bdd3e04 to your computer and use it in GitHub Desktop.

Service Dist0rtion Protocol

SDP offers different services to its members.

SDPFS private network

SDPFS is Social Dist0rtion Protocol File System. SDFPS is a private network of IPFS nodes. The network is private because we might share information about the future that would modify the course of events, causing a fork of our current branch of reality.

Prerequisite: install IPFS and the pre-shared key

Download the latest IPFS version from:

Unpack it, run ./install.sh or put it somewhere in your $PATH.

Create the sdpfs command by copying this script somewhere in your $PATH:

#!/usr/bin/env bash

LIBP2P_FORCE_PNET=1 IPFS_PATH=~/.sdp/ipfs ipfs "$@"

Private network setup

Create the home directory for sdpfs

mkdir -p .sdp/ipfs

Get the swarm key from another member and put it in ~/.sdp/ipfs/swarm.key.

Now run the following:

# Init the sdpfs repository
sdpfs init

# Enable experimental feature to not duplicate files
sdpfs config --json Experimental.FilestoreEnabled true

# Remove the bootstrap nodes, we have a private network
sdpfs bootstrap rm --all

# Add a new bootstrap endpoint
sdpfs bootstrap add /ip4/138.201.174.111/tcp/4001/ipfs/QmYuqXRt6HGEnD8vp5bcrDQJdhwt9q9innSWfU35d62qWD

Use sdpfs

Now you can use sdpfs as you would use ipfs. For example if you want to start the daemon run:

sdpfs daemon

And visit a member homepage by opening this friendly URL:

Bootstrapping a private network

You don't need to to this, someone else did it already.

Network bootstrap

A private network needs a pre-shared secret called swarm key. The key is generated once and shared across all members' nodes. To generate the key, run:

echo -e "/key/swarm/psk/1.0.0/\n/base16/\n`tr -dc 'a-f0-9' < /dev/urandom | head -c64`" > ~/.sdp/ipfs/swarm.key

Then share ~/.sdp/ipfs/swarm.key with SDP members.

Load web ui

curl https://ipfs.io/api/v0/get/Qmexhq2sBHnXQbvyP2GfUdbnY7HCagH2Mw5vUNSBn2nxip | tar -xf -
sdpfs add -r Qmexhq2sBHnXQbvyP2GfUdbnY7HCagH2Mw5vUNSBn2nxip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment