25

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.

1
  • I’m voting to close this question because it is about the legacy protocol and given the latest updates it might make sense to only keep recent Shimmer, ShimmerEVM and IOTA Chrysalis questions Commented Apr 28, 2023 at 7:01

1 Answer 1

35

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.

3
  • 1
    OK thanks, but how do I convert a picture to trytes?
    – Tobi MZ
    Commented Nov 29, 2017 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
    Commented Nov 29, 2017 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
    Commented Nov 29, 2017 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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