Go-ipfs: how to create IPFS private network

Created on 12 Nov 2018  路  11Comments  路  Source: ipfs/go-ipfs

i was trying to create a private IPFS network
Ubuntu linux
go version1.10.4
ipfs: 0.4.18
i got "ipfs-swarm-key-gen: command not found" when i was trying install swarm.key

kinquestion

Most helpful comment

@zhongzhouli Get ipfs-swarm-key-gen in https://github.com/Kubuxu/go-ipfs-swarm-key-gen and generate swarm.key by it.

Finally, you need put swarm.key into ~/.ipfs or IPFS_PATH.

All 11 comments

@zhongzhouli Get ipfs-swarm-key-gen in https://github.com/Kubuxu/go-ipfs-swarm-key-gen and generate swarm.key by it.

Finally, you need put swarm.key into ~/.ipfs or IPFS_PATH.

(closing for tracking)

@zhongzhouli Get ipfs-swarm-key-gen in https://github.com/Kubuxu/go-ipfs-swarm-key-gen and generate swarm.key by it.

Finally, you need put swarm.key into ~/.ipfs or IPFS_PATH.

yes, i tried to follow the step, i got this problem after ipfs-swarm-key-gen > ~/.ipfs/swarm.key.
could you please show me what should i do?

@zhongzhouli Did you execute go get -u github.com/Kubuxu/go-ipfs-swarm-key-gen/ipfs-swarm-key-gen successfully?

@zhongzhouli Did you execute go get -u github.com/Kubuxu/go-ipfs-swarm-key-gen/ipfs-swarm-key-gen successfully?

I am not able to run this command. getting error : package github.com/Kubuxu/go-ipfs-swarm-key-gen/ipfs-swarm-key-gen: cannot download, $GOPATH not set. For more details see: go help gopath

Even I have set the GOPATH in .bashrc

export GOPATH=/usr/lib/go/
export PATH=$PATH:$GOPATH/bin

please help..

@npatni0102 please ask on https://discuss.ipfs.io.

@zhongzhouli
You need to specify the directory of ipfs-swarm-key-gen before executing the command, but it is generally installed in this directory as below, you can try this command:

./go/bin/ipfs-swarm-key-gen > ~/.ipfs/swarm.key

If it doesn't work, then search for the directory of ipfs-swarm-key-gen and change the part that says ./go/bin/ to the specified directory of ipfs-swarm-key-gen

Another alternative (only works on Ubuntu) run this command in the terminal:

image

It's good! Save the go complie time~

ipfs-swarm-key-gen.sh

#!/bin/bash
set -eu

function main() {
  echo -e "/key/swarm/psk/1.0.0/\n/base16/\n$(tr -dc 'a-f0-9' < /dev/urandom | head -c64)"
}

main "$@"

Another simple way

#!/bin/bash
set -eu

function main() {
  echo -e "/key/swarm/psk/1.0.0/\n/base16/\n$(hexdump -n 32 -e '16/1 "%02x"' /dev/urandom)"
}

main "$@"

there needs to have more doc for these 'features', based on what I see, it is just this

  1. swarm.key being a file in the ipfs repo root and would be checked if exists
  2. content format - 3 lines as below where the second one say the encoding of the last line(which is just byte stream of 32 that can be generated in whatever one wants so long it is hex formatted string per the second line /base16/)
    /key/swarm/psk/1.0.0/
    /base16/

Better docs is the blocker for graduating this feature as "stable": https://github.com/ipfs/go-ipfs/issues/7086.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lidel picture lidel  路  3Comments

Mikaela picture Mikaela  路  3Comments

whyrusleeping picture whyrusleeping  路  4Comments

magik6k picture magik6k  路  3Comments

0x6431346e picture 0x6431346e  路  3Comments