Update on my work on Ledger App Hive
![image.png](https://files.peakd.com/file/peakd-hive/engrave/Eo23B9HfFGSxgkzJckVtC8WSMeoEwfMcitDDJBZYJzaiVGqirgAwMZmEHpr2WcufBP6.png)
Image credit (@thepeakstudio)
I'm continuing my work on Ledger App Hive and I am pretty confident it will be finished and submitted for official review soon.
Previous posts regarding Ledger app:
* [Ledger App updated with HF25 operations](https://peakd.com/hive-139531/@engrave/ledger-app-updated-with-hf25-operations)
* [JavaScript library for Ledger Nano S HIVE application
](https://peakd.com/hive-139531/@engrave/javascript-library-for-ledger-nano-s-hive-application)
# Source code
I decided to rewrite the app from scratch. The old codebase was a bit messy and it would be really hard to work on it. Sometimes it's just easier to start from scratch. I only adopted the ASN1 DER encoding, proposed by netuoso for communication between Ledger device and PC/mobile.
It's basically finished. The new codebase is built on top of the latest boilerplate (provided by Ledger) and utilizes their newest SDK. Thanks to this, I was able to write the code in a way that will work on both Nano S and Nano X the same way (except for the fact that Nano X has a bigger display).
**The new codebase compiles with 0 warnings and produces 0 bugs when tested with Clang Static Analyzer.** This is the requirement that needs to be met before submitting the app for official review.
```
make[1]: Leaving directory '/app'
scan-build: Removing directory '/app/output-scan-build/2021-08-16-224415-44-1' because it contains no reports.
scan-build: No bugs found.
```
# New user experience
New SDK allowed me to redesign the user experience. Now, you can loop through the entire transaction back and forward. The previous version allowed you to verify every transaction field only once and it was really easy to accept or reject the transaction by mistake. Ledger has also some functional/design requirements and the new version follows them.
And, as I already said, it's working on Nano X.
![Screenshot from 2021-08-17 00-39-42.png](https://files.peakd.com/file/peakd-hive/engrave/2424EvTL2WpTu7G3Fo1vV9Luv4gmvGNKXsSvoNZL4ChqCZQdfmHGUAWPLjEwNVPyZiSWw.png)
This is a view from the simulator because there is no way to sideload the unofficial app to Nano X.
# Unit tests
During the last two weeks, I put a lot of effort into unit testing the app (which is not only required by Ledger company but also very useful in the matter of stability and security). I covered most of my files with unit tests written in ANSI C, using `cmocka` framework. This will minimize potential problems, like buffer overflows/underflows etc which are really common on apps written in C.
![Screenshot from 2021-08-16 22-24-29.png](https://files.peakd.com/file/peakd-hive/engrave/23xLHzRhhbDYMswqNRr1ZJR4dT63qmLwWs6kMEnQ2YWkCnWQszYTbeBtNoq5JdyWYo3tV.png)
# Functional tests
Those need to be done yet, but I already prepared a Javascript library that is fully featured and can be used not only to communicate with the physical device but also with the simulator/debugger. The next step will be to create automated tests, to verify signatures for specified test transactions.
I'm already using it to broadcast transactions to our testnet. It shouldn't take long to finish this part.
![Screenshot from 2021-08-17 01-04-32.png](https://files.peakd.com/file/peakd-hive/engrave/Eo1vSpgX1pPc2PQ9xhLCuAa6rT1ZygYkijdBtEbyPnA6pjWm7ueHcR2mqdGezfTyKHn.png)
# Progress since the last update
* ~~Make it compatible with a new SDK and 2.0 firmware version~~
* ~~Make it working on both Nano S and Nano X devices~~
* ~~Add Approve and Reject screens before signing the transaction~~
* Prepare user guide and developer's documentation for Ledger Team
* Develop a working version of the Hive companion app
* Submit the app for the official review
We're close.
***
Follow me to be up to date with incoming development updates!
***
**Click on the image to vote for @engrave witness:**
[![banner_engrave 100.png](https://images.hive.blog/DQmUghvic5TCPPvVkB4iB7eXmgQ3RQ4L8jkVizvuCBW8RMT/banner_engrave%20100.png)](https://hivesigner.com/sign/account-witness-vote?witness=engrave&approve=1)