For beginners: Upload Images onto the IOTA Tangle
The full article was originally published by Coinmonks on Medium. Read the full article here.
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):
sudo apt-get install libffi-dev (to avoid the error: “failed building wheel for cryptography”)
sudo pip install pyota[ccurl]
To test if the installation was successful (this will take around 10 minutes):
python setup.py test
2. Preparing the image to be uploaded
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):
- Insert your IOTA address
- Insert the Base64 String of your image
- Insert your Tag so you can bundle images (only the following characters are allowed: A…Z and only number 9)
Run the program:
While the program is running you will see the following output:
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.