Error When Set IPFS Private Network

Following by go-ipfs doc, private-networks, I tried to setup a private network.
After all steps finished, I launched ipfs daemon and got a error. It says:

cmd/ipfs: error from node construction: psk header error: multicodec did not match daemon.go:335
Error: psk header error: multicodec did not match

I am new to p2p network and IPFS. Maybe I didn’t set the swarm.key correctly. Using the ipfs-swarm-key-gen tool, I created a swarm.key file and put it in my $IPFS_PATH folder and copied it to my peer node. Here is my swarm.key.


Is there anything I did wrong or missed and how can I fix this problem?

I have the same problem. More details:

  • I have a x64 node,running 0.4.13, and it has no problem starting ipfs daemon
  • I have another Pi 3 node, also running 0.4.13, and it has this problem. Its swarm key is copied from node above

Tried some other machines (Linux and Windows 10) and all of them except the original one have the same problem.

I am having the same error. Any luck with this?

Maybe report a bug here:

Filed bug:

@ShaneGit, I’m having the same issue. Have you come across any solution for that yet?

@tirtha4 are you on Windows by chance?

Hey, sorry for the very delayed reply. Yes, I’m working on Windows. Has any solution come up on this front?

As suggested by Kubuxu in the linked Github issue, try replacing the windows line endings in the swarm.key file with unix ones. I can reproduce this error on Windows if I have the wrong line endings in it.

It’s not stated how the key is being copied, so I’m guessing this might be happening due to copying the text from swarm.key into something like notepad on Windows which uses windows-style line feeds.

This can be done in Notepad++.

  1. Open the swarm.key file in Notepad++
  2. In the bottom of the window, right click on Windows (CR LF)
  3. Change it to Unix (LF) and save the file

1 Like

Thanks you - this worked me when connect from a Windows 10 machine to a Ubuntu VM