IOTA on the Ledger Nano S: Development Report 2

A good afternoon! I’m sitting here in front of family and friends who are playing Monopoly, waiting for the clock to hit 00:00. A new year will start. I’m also celebrating this yearly event, maybe a little different than I usually would, but in all honesty, I’m pretty damn happy about what I’m going to share with you, probably even more than if I did play along with them 🙂

Before we dive into the action again, I want to shed some light on the past 6 months. These 6 months, have been, in one word: Marvelous. It was the time I entered the IOTA community. During this time, so many things have happened. I cannot sum it all up in this post. Really, before I encountered IOTA, I had this year all planned out, I was working on a digital marketing company (it’s more exciting than it sounds) and will proceed to launch and raise funds during the end of this year.

But my focus totally shifted after finding out about IOTA. The level of excitement was simply too high to let this one slide. It was like when I first encountered Bitcoin in 2011. I just mailed some people from IOTA and joined their slack. I asked what I could do, it didn’t matter what, I just had to join in on this one.

From that point on, it brought me so many things. I was fortunate enough to work with Dom, Paul, Lewis and Chris on IOTA Flash, after my first IOTA talk and the first official meetup, I had so many offers that I couldn’t even react to them all! Of course, I had my ups and downs, but learning and growing doesn’t always have to feel good, what matters is what you let these experiences turn yourself into.

I also learned a freaking lot. I taught myself coding from 13y/o and never stopped since then. The same thing happened with machine learning 3 years ago. This year, the same happened with cryptography and math. I am a total noob when it comes to math, but I started a math course on EDx and learned myself the concepts of how crypto and math works and how you can apply it in real life. Not even Bitcoin got me to learn those things. All of this in just 6 months!

So, thanks a lot to the IOTA team, the community, and all the people I worked with on IOTA related projects, for being patient and give the energy and strength to people who are willing to contribute to something they believe in. And another huge thanks for bringing me the best year ever. I hope to make a great next 10 years out of that!

But what about the Ledger?

Enough with the chit-chat! I have to say: I wanted to post more, but I just really like to make 1 more post just before the end of the year 🙂

2 weeks ago we created a system to store 4 trits in 8 bits, requiring 25% of the memory originally required. If you want to know how, see the previous post of this series:

Today my plan was to do 2 things:

  • Port Kerl (IOTA’s hashing function) and the conversion functions (trit to word etc) to use the ternary store instead of raw integers (to save 75% of RAM)  [done 100%].
  • Implement the private key generator and see if we can create our private keys based on the seed [done 80%, see below]

Unfortunately, even after the 75% ram optimization, we still didn’t have enough memory to create the private key. We could store the first half of the private key at the PC during the key creation, but that info is obviously sensitive. We also could apply an encryption format to make sure that the PC can’t read the contents it is temporarily saving. That’s quite overkill, and should be avoided, yet considered when we have no options or memory left.

Fortunately a reddit user called ‘0x1A9E’ created this comment:

It shows us not how to store 4 trits in 8 bits, but 5! The memory required to store the private key is 13.122kb. The Ledger only has 4kb for app use. With my optimization we require 3.2805kb, which leaves rarely any memory for the rest. With 0x1A9E’s solution we would have enough with 2.6244kb, which is already much more doable!

I wanted to leave this optimization in the backlog, as with 4 trits in 8 bit we might already have enough, but I think it’s better to start using the 5 trits in 8 bit solution right away. The very good thing is that if we solve the private key generation, we have successfully implemented the hardest part (as far as I can tell, as it requires the most RAM).

Right now, I extended 0x1A9E’s solution to add an inversion function (to convert trits back to integers, see: ( which is required to change trits on the go.

So next up will be the actual implementation of the function mentioned above in C (will do probably tomorrow).

If you’re a developer or just like to see the insides of these updates, they are not posted (yet) on the master branch, but on a special branch, for as long as we progress with this (this is to avoid unexpected breaks in the software). All the related updates to this post are at:

Wrapping up

Would you like to donate or just say hi? Be sure to comment in this post below, or donate IOTA  at: ADLJXS9SKYQKMVQFXR9JDUUJHJWGDNWHQZMDGJFGZOX9BZEKDSXBSPZTTWEYPTNM9OZMYDQWZXFHRTXRCOITXAGCJZ

There is also a group forming a crowd-funding on Reddit at:

Would you like to contribute as a dev? You can by checkout the 5 trits per 8 bit function mentioned above and re-implement it in C in the ternary store (see: If you do, please contact me on Github, so I won’t redo all the work when I get at it again 🙂

Now I’m going to celebrate a happy new year, and you should too! Happy new year!

5 replies on “IOTA on the Ledger Nano S: Development Report 2”

This is great stuff, keep up the wonderful work! This is by far one of the most important projects from a community member for IOTA. Cheers!

CONGRATZ Thanks for the update, i cannot help you with the code but for sure i will donate i will keep a eye in the development, try the help of ppl inside slack at developers channel maybe someone there with the right skills can give you a hand

Thanks! We’ve been getting a lot of help already, and I think people on Slack will notice 🙂 (the project is quite hyped :))

The C port is already done as far as I’m concerned, I have yet to review all the work that’s been done but it certainly looks good!

I am just discovering all the work you already did to make iota supported on ledger nano s. Well done!
I am impressed and very interested as many of us to be able to buy and secure some iota soon. I also cannot help you for the code but hope that you have the necessary support from the community and also from the Ledger CT/team.
Keep us informed on the development!

Leave a Reply

Your email address will not be published. Required fields are marked *