Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

This library is deprecated as it's intended to be a PoC. Please use the new session mode in NKN SDK multiclient (e.g. and for library, or for ready to use application.

NKN File Transfer

A decentralized file transfer application using NKN client.

This application uses simple control mechanism similar to TCP. If you want to use it in production, it's recommended to implement more advanced mechanism (such as erasure coding) to achieve higher performance and reliability.

Get Started

You need Go 1.12+ to build from source:

go get -u

Then you can use

go run -$MODE

to run it, where $MODE can be one of send, receive, get, host. send mode should be used with receive mode to send file to peer, while get mode should be used with host mode to fetch file to peer.

When starting as receive mode or host, you will see something like Start receiver in receive mode at xxx or Start sender in host mode at xxx, where xxx will be your NKN address, and you will need that address when sending or getting files from other peers.

You can enable multiple modes together. For example, you can enable receive mode together with host mode to create a file storage server that can accept both send request (equivalent to HTTP PUT) and get request (equivalent to HTTP GET), and you can use send mode with get mode to create a client that can upload to (send) and download from (get) the aforementioned server. Actually if you enable both send mode and get mode together, you can use

GET hostAddress/fileName

to download file, and

PUT receiveAddress/fileName localFilePath

to upload file.

There is also a HTTP mode that can be enabled by -http together with host and receive mode. By default it will start a HTTP server at and can accept HTTP GET/PUT/HEAD request with route remoteAddr/fileName. It accepts HTTP GET request with Range header so browser can stream video while downloading.

By default a random NKN address (key pair) will be generated each time. You can use a specific address by passing -seed and -identifier argument, same as a NKN client. Use -help argument to see all supported arguments.


Can I submit a bug, suggestion or feature request?

Yes. Please open an issue for that.

Can I contribute patches to NKN project?

Yes, we appreciate your help! To make contributions, please fork the repo, push your changes to the forked repo with signed-off commits, and open a pull request here.

Please follow our Golang Style Guide for coding style.

Please sign off your commit. This means adding a line "Signed-off-by: Name " at the end of each commit, indicating that you wrote the code and have the right to pass it on as an open source patch. This can be done automatically by adding -s when committing:

git commit -s



Decentralized file transfer app using NKN client







No releases published


No packages published