How to use Ledger with Neurai

NeurAI Project
7 min readOct 14, 2023

--

Introduction

The latest version of Electrum for Neurai introduces the ability to use Ledger for signing transactions directly from the hardware.

This enhances security by eliminating the need to store private keys on a computer or mobile device. However, since it is not fully adapted for Neurai, caution is advised when signing transactions.

Required

  • Hardware Wallet: Any ledger version
  • Apps: Install in the ledger Bitcoin and Ravencoin
  • Software: Electrum Neurai 0.2.0 or higher.

Hardware

For the tests in this guide, we used a Ledger Nano S Plus.

The first thing we have done is to connect the ledger for the first time:

  • We entered the 12 words that we had saved for the test.
  • We connected the ledger to the Ledger Live wallet to update the firmware.
  • Installed Bitcoin and Ravencoin apps.

Software

Electrum Neurai 0.2 or higher is now required and can be downloaded from here if not already installed.

https://github.com/NeuraiProject/electrum-neurai/releases/latest

We have marked the two options valid for Windows and we recommend the “setup” to make a complete installation.

  • Portable: No installation required.
  • Setup: Performs a wallet installation and icons appear on the desktop.

Creating the wallet

With the ledger updated, with the appropriate apps and connected via USB, we run electrum and create a new wallet.

Remember to enter inside the Ravencoin app in the ledger when it is connected by USB so that electrum detects it.

We create a new name for the wallet, in this case ledger-neurai

Select “Standard wallet”.

Select “Use a hardware device”.

It will think for a few seconds and something similar to the following should appear, indicating that it has detected the ledger.

We do not touch the derivation path unless we know what we are doing.

Next.

The first time we start the electrum wallet with the ledger, a reminder message will appear stating the following:

  • Do not mine to the wallet, because it may crash the electrum server. For mining it is preferable to use Neurai-QT and from there send every so often to electrum.
  • Assets do not work with the Ledger, only XNA.

In ledger, a series of questions will appear that we must accept in order to sign electrum transactions.

Finally the green Ledger box appears in electurm.

Checking the addresses

To check that the 12 words we entered are valid, we loaded Neurai-QT with the same words for comparison.

Electrum
Neurai-QT

Once we have verified that the addresses match, we send a few coins to test the receiving and sending of coins.

We send 4.5 XNA to NU3WysaZoa9i3YcPxjkeB3DAV27vRHw8fZ

https://neuraiexplorer.com/tx/42eb4848bf31c4d0f6e95d5db275d847b2a8662cf6386b9086a16dd8b4f4dde3

The transaction is recorded in both wallets at the same time.

Signing transactions with Ledger

And finally we come to the most complicated part, which is the signing of transactions. The ledger contains the 12 words, the private and public key of our wallet key.

When we send a transaction with the ledger connected to electrum, electrum asks ledger to sign the transaction. At that moment, the ledger displays a series of information about the transaction such as the sending address, the exchange address, the amount of coins and the name of the transaction.

Let’s see how it works with Neurai when using the Ravencoin app.

We will send 3 XNA to NX7syqGJzweY57vW2K1D9G3kn8DXSq9Azc

We leave the default fees.

And a small window appears with the message “signing transaction”. Now we must go to the ledger to finalize the signing.

A message appears that the change path derivation is unusual, but we accept it as it does not match that of Ravencoin.

The next thing that appears is the amount of coins to move. Here RVN will appear instead of XNA, but it is the amount we have selected. We accept and continue.

The next thing that appears is an address that begins with R and it is not the one we have set to send from Electrum.

This is because internally it has modified our address to its Ravencoin equivalent. It is a bit complicated to explain, but it is related to how Bitcoin addresses are generated.

What electrum does is to pass the information of the public key and its derivation, but ledger converts this public key into a Ravencoin address and not into a Neurai one.

This happens in the section of the image below in the point “Network ID byte”. In Neurai it is 53 and in Ravencoin it is 60.

With this litle difference, the final output changes completely when converting from base256 to base 58.

Actually the address although it is not the one that we have add, if it has the same public key that our address with what the shipment will be carried out correctly as it will be seen at the end.

Although the sending address is not the one we have put in electrum, it has the same public key as our address so the sending will be done correctly as you will see at the end.

We acept this and continue.

We accept and send.

It asks us to confirm the transaction and we accept.

And finally it will tell us the sending cost and we accept.

We go back to electrum and we will see the transaction in progress.

Despite accepting what appeared to be incorrect information in the ledger, the transmission was successful and did not expose the private keys on a machine with internet access.

Conclusion

Although Neurai does not have an app for Ledger, it is possible to use the Ravencoin version, accepting the different messages that appear on the hardware when we start it for the first time or when we make a transaction.

This allows us to avoid compromising our wallet keys if a computer has malware.

Links

--

--

NeurAI Project

Neurai is a Layer-1 blockchain with ASIC resistant and NFT/FT onchain focused on IoT and AI.