Purpose of this program? It is NOT to have a way to store audio or video files on the Tangle. I had two things in mind. To show the potential of the IOTA Tangle. Most people think of IOTA as a “competitor” to Bitcoin, as a blockchain. BUT: there are only few interfaces between the two systems. The second thing I had in mind: there is the need to transfer data between entities (for example the settings of a process). Within a company, this is simple. But across borders, or companies, or organizations, or platforms, this is difficult and subject to problems. Storing data on a medium that is censorship resistant and immutable is of significant importance.

This is the audio file I uploaded to the Tangle. It is a voicemail somebody left me a while ago.

Purpose of this program: to upload and store audio files onto the IOTA Tangle.

This article assumes you have Python installed on your machine (I used a Raspberry Pi). To install python and/or use a terminal refer to any of my previous articles.

Contact me if you are stuck. Also please let me know if you see anything that needs improvement.

1. Activate IOTA

To communicate with the IOTA tangle you need to install the PyOTA library (https://github.com/iotaledger/iota.lib.py):

cd ~/

sudo apt-get install libffi-dev (to avoid the error: “failed building wheel for cryptography”)

sudo pip install pyota[ccurl]

git clone https://github.com/iotaledger/iota.lib.py.git

To test if the installation was successful (this will take around 10 minutes):

cd iota.lib.py

python setup.py test

2. Preparing the audio file to be uploaded

To upload an audio file you need to convert is to a Base64 String first. There are several web pages where you can do this. I used Base64.Guru (https://base64.guru/converter/encode/audio).

The result will look as follows:

3. The code to upload audio files

Copy and use the following program (I called it iota-audio.py):

There are three changes you need to make (they are all highlighted in the code):

Insert your IOTA address Check that you are using the best Node Insert the Base64 String of your audio file Insert your Tag so you can bundle files (only the following characters are allowed: A…Z and only number 9)

You will need an IOTA address. For this I recommend installing the trinity wallet on your computer (https://trinity.iota.org) and get a new address that way.

Run the program:

python iota-audio.py

While the program is running you will see the following output:

Go to THETANGLE.ORG, insert your IOTA address and you will see all the transactions you generated. To check click on one of the transactions and you will see something like this:

The code to download audio files

Copy and use the following code (I called it iota-audio-download-read.py):

There are three changes you need to make (they are all highlighted in the code):

Select a good IOTA node Insert your IOTA address Insert your Tag

Run the program:

python iota-audio-download.py

You will see the following output:

Highlight the output and copy it.

Use the following website to decode the base64 code to generate the audio file: https://base64.guru/converter/decode/audio. Paste the text into the Base64 field and click on “Decode Base64 to Audio”.

Error?

There are a few possible problems when trying to decode the data: