chirpdat

Joe Todd
Chirp
Published in
3 min readOct 29, 2018
http://imgs.xkcd.com/comics/file_transfer.png

chirpdat combines dat with Chirp to seamlessly and securely share files of any size.

I’m sure we have all experienced the pain of transferring a file from one computer to another. In a world with billions of interconnected devices, why is it this still seems to be a laborious process?

Well, the dat project has come up with a neat solution — a P2P transfer mechanism that allows large amounts of data to be easily shared between devices.

The dat protocol is also used by the Beaker browser — a peer-to-peer web browser which aims to harness a completely decentralised internet. If you would like to read more about the dat protocol, go here.

Dat is installed with npm and controlled via the command line, like so

npm install -g dat
dat share ~/Pictures
dat://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

It provides a 32byte identifier for your chosen shared directory, in this case is my pictures folder. Then the recipient will clone this folder using the identifier, and keep it in sync with any further updates like so

dat clone dat://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ~/Downloads/pix
dat sync ~/Downloads/pix

Which is great, the recipient now has a direct clone of all the pictures! But it does suffer from the same signalling issue as many other sharing mechanisms. How do I transmit my address to the recipient? This is where Chirp comes in to play.

Chirp uses sound to transfer data, allowing me to broadcast the address of my pictures to everyone nearby in one simple sonic transmission. Chirp encodes the 32byte identifier as a sequence of tones (which could be audible or inaudible/ultrasonic) and plays these through the device’s speakers. With Chirp, any recipient’s microphone can then detect these tones, and decode them back into the data payload.

So now you can share any kind of file with one simple command. To get started, you will need to first install dat as above, then install chirpdat. This requires nodejs and Python to be installed.

npm install -g dat
pip3 install chirpdat

chirpdat uses the Chirp Python SDK, which requires portaudio to be installed, on macOS this can be installed with brew.

// macOS
brew install portaudio
// Linux
sudo apt-get install portaudio19-dev

You will also need to create a ~/.chirprc file with your app key, secret and config, please follow the getting started guide at the Chirp developer hub. You can skip this step if you are already set up with Chirp on the command line.

[default]
app_key = xXxXXxxxXXXxxXXXxXxXXxXxx
app_secret = xxXxXXXxXxxXXXxXXXXxXxXxxxXxxxXXxXxXxxxXXxXxXXxXxX
app_config = XxXXXXxXxXxxxXxxxXXxXxXxxxXXxXxXXxXxXxxXxXXxxxXXXxxXxx

You can then share a folder with the following command

chirpdat -s ~/Pictures

And the recipient will specify the receiving folder to download the files to with

chirpdat -d ~/Downloads/pix

Of course the recipients will need to be listening before you can start sharing.

This tool uses the Chirp Python SDK to send and receive data-over-sound, you can view the source code over at GitHub. Please submit any issues or pull requests there.

For further documentation for the Python SDK and other platforms including iOS, Android, and JavaScript, you can visit developers.chirp.io. Chirp is distributed with a generous free plan for developers and start up businesses, so you can start using data-over-sound in your own projects right away!

joe@chirp.io

--

--