Categories
IOTA Uncategorized

IOTA Ledger Nano S: Alpha on testnet!

Hello guys!

We are very pleased to announce that the IOTA Ledger App is now ready for alpha testing and we would like you to help us by testing it and providing feedback!

!!! IMPORTANT NOTICE – READ FIRST !!!

This alpha version is working on the IOTA testnet. DO NOT TRANSFER REAL FUNDS FROM THE MAIN NET to your Ledger Nano S yet! You would never receive these funds, because mainnet is not compatible to testnet!! We will provide you some nice fresh testnet IOTA for that purpose. Claim your testnet funds here.

DISCLAIMER

This project is 100% community driven! We are not related to the IOTA foundation, so please wait until there is an official audit until you trust this with all your funds! We are just hobbyists, we are not responsible if there are any bugs which leads to the loss of your funds. Please be patient with us if you have some questions.

Lets get started!

First you must install the IOTA-Ledger App onto your Ledger Nano S.

We created a one-size-fits-all (including Windows, Mac, Linux) solution to do this easily: It’s a virtual machine that contains all the necessary prerequisites to install the app. The latest precompiled version of the IOTA application is automatically downloaded from our releases page at startup of the VM, checked for correct digital signature and installed onto the Ledger Nano S.

You can find instructions on how to install the app using VirtualBox here. Follow the tutorial, then come back to this page to start the desktop wallet 🙂

After the app was installed successfully, you need a wallet that supports our IOTA Ledger app. We modified Roman Semko’s Romeo Wallet for that purpose.

The modified Romeo web wallet can be found here:
https://iota-ledger.github.io/romeo.html/

Open your IOTA app on the Ledger and click on “Ledger Nano” in the Romeo wallet and then on “Login with Ledger” and let the magic happen!

Please keep in mind

This is an alpha testing version of the app! It is not (yet) endorsed by Ledger, nor by the IOTA foundation. It is only running in the IOTA test net, so do not transfer your real IOTA funds to it. It must be used for testing purposes only. However each app is run in it’s own “sandbox” on the device, so there is no risk in compromising data from other apps.

The app is currently generating test addresses using a different path that will be used in the official release. This way you are not tainting your seed by sending test transactions. These addresses might change in the future!

We are primarily interested in app related feedback (if you encounter any issues with the app on the Ledger itself or if anything doesn’t work as expected). However we are also interested in usability feedback.

If you experience an issue, please open up the developer console (Ctrl + Shift + J on Windows/Linux, Cmd + Shift + J on Mac) and provide us with the error you’ve received.

Your feedback would be greatly appreciated as a GitHub Issue or if you don’t have a GitHub account, just use the form here.

If you have questions, feel free to contact us in our discord channel: https://discord.gg/U3qRjZj

Next steps

In the next weeks we want to collect your feedback to fix bugs or add new functionality.
If we think that all tasks are done, we will contact Ledger to have it code reviewed, and hopefully they will release it on their official store.

Trinity

We are already in contact and working with the Trinity team to bring Ledger support to the Trinity wallet. With their recent rollout of their (phenomenal) mobile wallet, and with the desktop version still being finalized, we don’t currently have a timeline for when it will be available with the Trinity wallet. Rest assured, we will be assisting with integration where possible.

Words from the team

Peter – GitHub

To this day, this has been the biggest, most exciting IOTA-related project I’m involved in since IOTA Flash. It’s perfect from every angle. It brought value to those who wanted to learn new skills – both to those who contributed and the audience during the presentations we’ve given. It brought value to die-hard hodler’s, who were super generous donating to this project (Thanks by the way!). It also brought value to people who just want their crypto’s to be secured in a unified wallet-interface, so that their family are able to inherit all the funds more easily.

The team that got together around this project is hard-working, and humble. They deserve all the good that’s coming to them!

wollac – GitHub

This project has been a awesome opportunity to build something for IOTA from the ground up, which was a great experience! It forces you to look at IOTA from different angles and this has only been possible thanks to the invaluable support of the community and the great collaboration of the passionate team.

Diskings – GitHub

I started out knowing nothing about IOTA or any other crypto (at a coding level) but wanted to help. So I just picked it up, started tweaking code here and there to figure out how it worked, and here we are. If you’re interested in developing for DLT, just start. It doesn’t matter what it is, just start with anything and learn as you go.

muXxer – GitHub

Being the latest member of the team, I really can encourage all the community people out there to participate in such projects. I got in contact with wollac at an IOTA developer meetup in Berlin while he gave a presentation about this project. I just asked him how I could help. Now here I am, and I learned a lot during the last months. It feels really good to push such a great project like IOTA forward and help the community.

Special thanks to

  • Roman SemkoTwitter GitHub – for his perfect web wallet Romeo and all his help! He is awesome!
  • Trinity Team – For all the advice, the testnet funds and the really nice conversations!
  • kwkoGitHub – For his new IOTA pixelart design.
  • The awesome IOTA community – Which made all this stuff possible by supporting us!

Contributing

Donations

Would you like to donate to help the development team? Send some IOTA to the following address:

ADLJXS9SKYQKMVQFXR9JDUUJHJWGDNWHQZMDGJFGZOX9BZEKDSXBSPZTTWEYPTNM9OZMYDQWZXFHRTXRCOITXAGCJZ

Note! This is a new donation address!
Please know that the donations made to this address will be shared with everyone who contributes.

As a developer

Would you like to contribute as a dev? Please check out our Discord channel to contact us!

Categories
IOTA

IOTA on the Ledger Nano S: Development Report 5

Hello everyone,

It’s been a while. Thank you for hanging on! I was very busy the past month, had to arrange presentations, meetings, the blockchaingers hackathon in Groningen coming up. But I haven’t stopped working on the Ledger-support, neither did the rest of the team!

I’ll just dive right into it, we’ve finished 2 major features of the Ledger:

[su_list icon=”https://beta.codebuffet.co/wp-content/uploads/2018/01/iota.png”]

  • API (after weeks of discussions and passing over designs to one-another).
  • Signing of transactions (part of the API as well)

[/su_list]

I guess you could say all of the major features we need are done! Aside from just features, thanks to the amazing team with Wollac and Diskings, we also have a huge amount of tests, pretty much all code is covered by automated tests.

There’s one more thing…

If you’re a frequent reader of the series, you’ll probably miss “Develop a simple web wallet application to interact with the Ledger and provide basic functionality while waiting for more advanced wallets to integrate Ledger support”.

There’s nothing wrong with your memory, or mine: We’ll be getting Ledger-support in Trinity!
We’ll skip the web wallet, and focus on integrating with Trinity instead.

This is a huge step in the right direction, and the people who most benefit from this are the users: Imagine having 1 wallet for all your IOTA needs. You download Trinity and use it the way you like it. You plug in your Ledger and install the IOTA app. Trinity sees your ledger and asks you if you want to use your Ledger as a wallet instead. Note: This is an assumption of me how the interaction is going to look like, it’s entirely up to Trinity to develop the UI, so the final product could differ.

What lies ahead

The only thing that needs to be done now before we have a functional Javascript-SDK and API, is getting the bundles to be signed the right way. I still have some difficulties there, but I hope I can fix it in this week.

Final words

This is probably the last development report before we head into beta, so I’d like to end this report with a bit of a personal story. When we started the Ledger-project, I was under the assumption that no one would really care about it enough to immediately join in and integrate (like the Trinity wallet). Sure, it crossed my mind, and yeah I really wanted to have the integration, but I always thought it might happen after we finished and were out of beta, there was no way they’d even think about integrating before we had anything, right? So I focused on building a web-wallet instead (and contact them later in the project life-cycle).

It turned out I was wrong.

What have I learned from this? If you look back at the end of the day and you’re still seeing opportunities lying ahead of you, then you haven’t dreamed big enough yet, you haven’t leveraged your full potential yet, there’s no excuse, there’s no luck to it, all it takes is doing it, and you only know for sure when you get yes or no for an answer.

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

Please know that the donations made to this address will be shared with everyone who contributes (the contributions has to be worth something, of course)

Would you like to contribute as a dev? Please check out our Discord channel to see what’s there to do!

Categories
IOTA

IOTA on the Ledger Nano S: Development Report 4

Intro

“A picture says more than a 1000 words” really applies to this one, doesn’t it?

For those who don’t get what’s happening here: What you’re seeing here is an address generated by the Ledger using our C implementation of IOTA, and by the official IOTA Wallet. Both are generating the first address using the same seed completely separated from each-other. By having identical addresses we can proof that the implementation works correctly. quod erat demonstrandum

Note: The Ledger address doesn’t end with the same characters as on the official IOTA Wallet, because the checksum is missing on the Ledger’s end, this is not a problem, we will add the checksum on the web-wallet, since the data integrity is already guaranteed from the Ledger to the PC by data encryption over USB.

This is our first successful attempt at making the first valid security 2 IOTA address! (Which is being used by default by the IOTA wallet). There is really nothing more left to say.

We had some setbacks, as expected. We got some trouble getting keccak to work, which got finally solved this week, after some rigorous testing on a dusty saturday, we can conclude it’s now working 100%!

Ok cool, what now?

Currently, the consensus between Wollac, Diskings and me is that we start on creating the functionality that will allow the Ledger to sign and create transactions, I will start getting more involved in the Web Wallet (to use your Ledger with) while they will work more on the Ledger itself. We will work in parallel.

[su_list icon=”https://beta.codebuffet.co/wp-content/uploads/2018/01/iota.png”]

  • Creation and signing of transactions
  • Develop a simple web wallet application to interact with the Ledger and provide basic functionality while waiting for more advanced wallets to integrate Ledger support.
  • Appropiate recovery features

[/su_list]

I expect no to little setbacks at this point, as signing transactions can be done in parts (each transaction in a bundle can be signed separated).

Development of the Web Wallet has already begun. The repo is here.

If you’re a web or frontend developer, and like to contribute to the Ledger project but were unable to help because C wasn’t your kind of language? You can contact me (peterwilli) in the Discord (links below) to coordinate further development of the wallet.

Wrapping up

First, I’d like to thank the group I’ve been working with on this project. Diskings (https://github.com/tylerhann) and Wollac (https://github.com/Wollac)

Wollac also made some huge contributions that allowed us to improve the performance of address generation from nearly 2 minutes for just 1 address to just under 4 seconds. He did so by implementing 32-bit arithmetic rather than ‘stacks’ of 8-bits what we used to do. This improvement was known to us, but we backlogged it until we got the address generation working first. Thanks to him, we already have it today! He also pointed out to me that Ledger was indeed capable of using the Ledger’s hardware-keccak as a sponge construction, which I thought was unlikely. This boosted development and I’m very grateful for his contribution, as well as anyone else’s.

I can only say: This is a dream-team to work with on such a complicated, yet small in terms of size project. So a huge shoutout to diskings, wollac and everyone involved!

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

Please know that the donations made to this address will be shared with everyone who contributes (the contributions has to be worth something, of course)

There is also a group forming a crowd-funding on Reddit at: https://www.reddit.com/r/Iota/comments/7l5jl2/and_if_will_we_donate_1miota_each

Would you like to contribute as a dev? Please check out our new Discord channel to see what’s there to do!

Categories
IOTA

IOTA on the Ledger Nano S: Development Report 3

Intro

It’s been nearly 2 weeks since the last report! Time flies when you’re having fun, I’d say. Let’s just dive right into it. For those who don’t know what’s going on, please read version 1 and 2 of this report: We’re building IOTA on the Ledger Nano S!

Some household announcements

In the previous report, I asked for a better and smaller implementation for the ternary store to save more memory. I’m just gonna let this sink in for a moment: I didn’t expect a single reply. Maybe 1.

Instead, we got like 10 replies with 10 different implementations. It was overwhelming. I didn’t even had the time to look at it all. It was like Santa Claus getting all those drawings from children all over the world.

So after a week of going through replies, I think that we need to coordinate this project differently. So from today on, all the project’s code move to a central GitHub organisation: https://github.com/iota-ledger
We also have our own Discord channel at: https://discord.gg/U3qRjZj

From here on out, we will use these channels to discuss our implementations and perform changes. In the discord, we will have some read-only channels where the developers who are actually working on the Ledger support can discuss in peace, in case the channel get’s too crowded.

This way everyone can see in real-time what has been done and what’s happening. Maybe Santa can learn from this?

Anyway, you’re welcome to join, developer or not. You’ve got some ideas to contribute? This channel is for you!

How is the Ledger going?

Going great! In one of the 10 replies, an user by the name Diskings (/u/allsix) talked to me and he was heavily working on the road to Ledger support for IOTA. He was working on it while I was busy working on a super secret iota-related project. He made it possible to generate our first actual private key and address. That’s right. We’ve got our actual, first address and private key made! So a huge shout-out to Diskings!

I’ve talked with him and the consensus was that it’s best if we centralize our work, so we can work in parallel on the problems we’re facing. I am confident that we will have full Ledger support much quicker thanks to this.

So where are we?
We tend to keep an up-to-date list of todo’s in our GitHub, but right now we haven’t yet, so I’ll drop it here, but for more recent updates, be sure to check out our GitHub.

[su_list icon=”https://beta.codebuffet.co/wp-content/uploads/2018/01/iota.png”]

  • Creation and signing of transactions
  • Develop a simple web wallet application to interact with the Ledger and provide basic functionality while waiting for more advanced wallets to integrate Ledger support.
  • Appropiate recovery features

[/su_list]

Currently, due to severe memory limitations of the Nano, the private key does not fit on the ledger. When encoded with 4 (or 5) trits per byte, half of the private key can be stored, and then worked with at a time to generate the public key.

However encoding and decoding the key takes time. Right now it looks like when you want to make a transaction, you will need to leave your ledger plugged in for a minute or two while it generates the address and signs the transaction (after which you can disconnect it again). Ultimately we will work towards making it as seamless as possible given the RAM we have to work with.

There are further optimizations to be made, and are currently investigating methods of generating the keys in native trits (one trit per byte) to speed up the process by never storing more than one fragment of the private key at a time.. To learn more about our storage system, check report 1.

We still have lots of tests to run but we feel this is a major milestone for getting IOTA on the Ledger.

Wrapping up

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

Please know that the donations made to this address will be shared with everyone who contributes (the contributions has to be worth something, of course)

There is also a group forming a crowd-funding on Reddit at: https://www.reddit.com/r/Iota/comments/7l5jl2/and_if_will_we_donate_1miota_each

Would you like to contribute as a dev? Please check out our new Discord channel to see what’s there to do!

Categories
IOTA

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: https://codebuffet.co/2017/12/10/iota-on-the-ledger-nano-s-development-report-1/

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: https://www.reddit.com/r/Iota/comments/7ixgfm/decided_to_write_a_journal_about_iota_on_ledger/dr31kt5/

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: (https://github.com/peterwilli/iota-ledger-nano-s/blob/2241ceb2230ecc89b3b486f5210309cabbeabbd0/external_tests/5trit_store/test.py#L1) 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: https://github.com/peterwilli/iota-ledger-nano-s/tree/private-key-generation

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: https://www.reddit.com/r/Iota/comments/7l5jl2/and_if_will_we_donate_1miota_each

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: https://github.com/peterwilli/iota-ledger-nano-s/blob/2241ceb2230ecc89b3b486f5210309cabbeabbd0/blue-app-iota/src/ternary_store.c). 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!

Categories
IOTA

IOTA on the Ledger Nano S: Development Report 1

Hi guys,

I’ve barely slept since the picture I posted with the random IOTA seed on the Ledger (https://www.reddit.com/r/Iota/comments/7iaf3x/as_night_covers_the_netherlands_ive_been_able_to). It was overwhelming and it gave me a lot of energy. Today, I’d like to try something new. Because of all the reactions, I’d like to take you along the journey. That is, if you guys like it, it’ll be a series of posts during the development cycle. Don’t be afraid to give any feedback, and also let me know if you like the series to be more or less technical next time.

Before we get into the action, let me take a moment to explain what exactly happened and why it drove me to do this. Everyone knows the IOTA price has grown a lot over the past week. This also gave me a different feeling.

I don’t hold a lot of money in cryptocurrencies (or, I think it’s not a lot) but I do hold a lot of different ones. A few days ago I got my Ledger Nano S from a good friend and he told me I should stash my crypto’s on it and make sure that if something where to happen to me, my family could regain the funds. A healthy thought. After finding out IOTA wasn’t working at the moment on the Ledger, the first thing that came up to me was: make it work!

So, in all honesty, I’m by no means an expert in C, embedded hardware, or the Ledger in general. I am, however, a very fast learner. During the first days of that week, all I did was digesting information until I understood it all, especially on the specs of the ledger and the SDK. This is basically how I taught all my skills in development.

After that, I made a list of priorities, so that, even if a part of the list is completed, we will be able to store our IOTAs (and I would be able to store mine). It was something in the sense of:

  • Generate valid IOTA seeds based on your Ledger seed.
  • Generate valid addresses based on that seed
    • Note that if this is complete, we can already store IOTA.
  •  Allow transactions to be made

At thursday december 7th, around 12:30 in the night, I was able to fully execute IOTA’s hashing algorithm on the Ledger, resulting in valid seeds. I was so excited by this, especially because it worked at once. I decided to post a picture and go to bed. So I turned on my laptops webcam, made a pic and posted it, and at the moment I closed my laptop, not much than 3 minutes later, reactions streamed in, hundreds of them. I couldn’t believe it. I really didn’t know it was that big of a deal. The main motivation that drove me was to make sure my funds were safe and that my family would know how to recover it in case of a sudden death. What happened after that, was, well, definitively not sleep 🙂

Back to the present

After all the fuss I didn’t stop, I worked harder. So the next big thing we needed was generating private keys and then addresses. So, I got started at the beginning, and did the thing that made most sense, it was just copying the address generator from the Trezor version of the IOTA wallet. And the Ledger stalled. This is not a surprise to me, because the memory in the Trezor is much more than the Ledger (Trezor has 128kb ram, and the Ledger has “only” 4Kb ram available for applications)

Having so little memory poses a significant challenge, but it’s exciting too. It forces you to think very differently. If it weren’t for IOTA or Ledger, I’d probably wouldn’t have been sitting in a cinema with a pen and paper thinking how to squeeze as much data in 4kb of RAM.

These are the workarounds we have (sorted by most preferable):

  • Rewriting functions to use less memory
  • Use the connection with the computer to store part of the data externally
  • Store a part of the data in flash-memory

So, I started opening up the source code of the Trezor-IOTA firmware, checking out every function that has been called from the private key generation, and while reading it, thinking about how to use less RAM to do the same thing.
One thing that caught my eye instantly, is the way trits are stored. For newcomers, trits are IOTA’s entire base. Instead of having bits, which is 0 and 1, IOTA has trits, which are -1, 0 and 1. The whole reasoning behind this is because a ternary processor would be able to handle IOTA much more efficiently, even more efficiently than a binary processor would be able to handle binary applications.

Trits are being stored in the smallest possible number in C. This is int8_t. This number can hold 256 different values, and takes 8 bits of memory. So that means, that for each trit we need to occupy 8 bits of memory. If you think about it, that’s quite a lot, as trits only need 3 different states.

So, knowing that we can’t store numbers smaller than 8 bit, and that a trit only needs 3 different values, the first  thing that came in mind was, can we squeeze more than 1 trit in a 8-bit number? It turns out, we can!

Let’s take a look at the memory space of a 8bit number: 00000000
So 8 zeroes. Each zero can also be 1.

So, after a bit of thinking and writing notes, I came up with the following idea: 1 bit has 2 states, so with 2 bits we have 4 states. 1 trit has 3 states, which means that it fits well within the 2 bits. Now we just need to ‘map’ the 2 bit states to a single trit-state. It looks something like this:

[su_table]

Bits Trit
00 0
10 -1
01 1

[/su_table]

Now we can store 1 trit in each 2 bits. Because we have 8 bits in 1 number, that means we can store 4 trits in 1 number!

Using ‘chains’ of these 8bit numbers, we can store lots (in the thousands) of trits, with only 25% of the memory currently required! This is math porn.

For the techies, the source to the ‘ternary store’ is here: https://github.com/peterwilli/iota-ledger-nano-s/blob/master/blue-app-iota/src/ternary_store.c

All we need to do now, is, finding the right number a trit is stored, given an index of a trit you’d like to retrieve, and then finding the right position within that number. For this I have created a function called ‘ternary_store_get_position’.

Wrapping up

While the ternary store is not yet tested on the Ledger (I did tests with storing 1000’s of random trits and it worked all the time), I’m very confident that it will bring us one step closer to full IOTA on Ledger. More optimizations will have to be done, but we will get there.

After the first announcement of this project, other people joined too. So we get contributions to the project rolling in right now. I also joined the Ledger dev Slack to coordinate and discuss IOTA development on the Ledger as we progress as a community. So there is a lot happening in the scene, and I’m very confident we’ll have a strong community behind this in no-time.

Right now I’m going to take a break and regain some sleep, and make sure I stay focused on my other projects.

If you want to contribute to further development, IOTA donations are accepted at: ADLJXS9SKYQKMVQFXR9JDUUJHJWGDNWHQZMDGJFGZOX9BZEKDSXBSPZTTWEYPTNM9OZMYDQWZXFHRTXRCOITXAGCJZ

I’d like to thank IOTA as a community once more. Thanks to you guys I’m exploring all these new things and have fun doing it. This is literally the most fun thing I did in the weekend (it probably is the only thing, though).

I also like to thank the Ledger team who is very helpful and involved. I’m very glad having them watching and giving their feedback.

And a huge shoutout to Bart Slinger, who made the Trezor version (see: https://www.bartslinger.com/iota/iota-transactions-with-trezor-hardware/). Thanks to his contributions, I had a head-start, and was able to focus on heavy memory optimizations like the Ternary store. Without his help, I would’ve been busy a lot longer.