24

As we all know, it is easily possible to convert ASCII to trytes. See this converter in the IOTA github: Converter If I now want to convert a whole picture like one of the Iota logo to trytes, how is this possible? Is it possible at all?

Here is the picture I want to send to the tangle: Iota Logo This picture should be small enough to send it via one transaction.

34

Yes, you can upload images or any files or other data to the tangle.

As long as their size is less than 2187 trytes you can put them into one tx (=transaction). If they are bigger (=more trytes) than that, you can still send them by just putting them into multiple txs that reference each other (similar to a bundles for value txs).

So for example if you want to send data that is 3000 trytes, you have to put it into 2 txs.

You can use this tool to find out how many transactions you need for a certain picture/file.

Keep in mind that you have to do the POW for each tx which can be insanely high for big files/images.

You have to put the data into the place where you would put the signature for a spending tx: the signature message fragment

signatureMessageFragment : String 2187-trytes signature message fragment.
In case there is a spent input, the signature of the private key is stored here. If no signature is required, it is empty (all 9's) and can be used for storing the message value when making a transfer.

https://domschiener.gitbooks.io/iota-guide/content/chapter1/transactions-and-bundles.html

Convert binary image files (png, jpg, bmp) to trinary messages and vice versa

If you want to convert a picture to a IOTA message, you have to read the file and save it into a byte-array or similar (byte[] in Java/C#, char* in C, bytes() in python, Uint8Array()in JavaScript). I will not explain how to do that here as you can look it up on Stackoverflow or just duckduckgo/google it.

function String[] btop(bytes[]){
    // binary to presentation
}

converts the bytes[] to a string representation of the tryte message or multiple strings in case message > 2187
Now you can add this message/these messages to a transaction and attach them to the Tangle.

The receiver reads the message(s) from the Tangle and then uses a function like this:

function bytes[] ptob(String[]){
    // presentation to binary
}

to convert the trytes back to a byte[], which can be written to a file.

Practice

Using iota-storage.net, I was able to upload your picture to the Tangle. Checkout their GitHub.

  • 1
    OK thanks, but how do I convert a picture to trytes? – Tobi MZ Nov 29 '17 at 15:34
  • It depends on the format of the picture (jpg,png,svg,etc.). Basically just convert binary to ternary/trinary... I'll try to find something and edit the answer. – Zauz Nov 29 '17 at 15:37
  • 2
    There is a site doing this iota-storage.net they have a github repository at github.com/iota-storage/storage-web – Cryptlex Nov 29 '17 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.