For beginners: Upload Images onto the IOTA Tangle

Roberto Rey
Coinmonks
3 min readApr 7, 2019

--

This is the image I uploaded to the Tangle

Purpose of this program: to upload and store images 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 image to be uploaded

To upload an image you need to convert is to a Base64 String first. There are several web pages where you can do this. I used Code Beautify (https://codebeautify.org/base64-decode).

The result will look as follows:

On the top right you see the Base64 String which we will need later.

3. The program to upload images

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

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

  1. Insert your IOTA address
  2. Insert the Base64 String of your image
  3. Insert your Tag so you can bundle images (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-images.py

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

Potential error “BadApiResponse: 500 response from node”. You might encounter the following error message. In that case wait a few hours and then try again or build a delay into the code:

The number is the count of transactions that are being generated (to calculate the total number copy the Base64 String into for example Word and check the number of characters. Divide that number by 1000 and you will have an idea how many transactions you will generate). In my example 53 transactions were generated.

It will take around 10 minutes for the transfer to be finished.

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:

Download Images

Do you want to download your images again? Here you find a very simple code: For beginners: Download Images from the IOTA Tangle.

REDDIT.com/r/IOTA

Great discussion in regards to this program on Reddit:

Get Best Software Deals Directly In Your Inbox

--

--