Preparing some Javascript support for the Hive app on Ledger hardware wallet

Earlier this week, @netuoso has announced the exciting news that his work on an Hive app for Ledger hardware wallet has completed and that he is working with Ledger to get it listed into their official app Ledger Live.

What is a hardware wallet?

Ledger Nano S and Ledger Nano X are two popular hardware crypto wallets.

A cryptocurrency wallet is a device, physical medium, program or a service which stores the public and/or private keys and can be used to track ownership, receive or spend cryptocurrencies.

Source Wikipedia

So a hardware wallet is a device that stores your private keys. Hardware wallets like the Ledger Nano S/X also come with apps developed to support specific cryptocurrencies. Thanks to hose installable apps, they differ with a simple USB key by the fact that they can sign transactions themselves. What it means is that you don't need to copy the private key from the USB key and paste it into the software/website on your computer, the private key does never leave your device making it even more secure.

In a nutshell, what happens is:

  • you use a software or web app on your computer
  • whenever a private key is required for a particular operation (transfer, vote etc...), the computer software will ask the Ledger Nano (via USB or Bluetooth) to sign the transaction with the private key
  • the Ledger Nano will perform the signature and send back the signed "document"
  • the computer software will then post the signed document to the witnesses for inclusion into the blockchain

How can Ledger Nano be useful to Hive?

The most obvious point is that it makes it more secure. You won't need to enter your private keys to any app running on your computer connected to the internet.

Also, just like with Hive Keychain, you won't need to think of which key to use for each transaction. So it simplifies your daily use of the Hive blockchain.

Once support will be added to the frontends, you will even be able to login to apps like Hive Blog or PeakD using your Ledger Nano S/X.

All this comes to a price though:

  • There is a little bit of overhead: although it's not very difficult, the initial setup might be a little bit daunting for non-technical person. But with times, frontends might make it easier to link your Ledger keys to your Hive account
  • Every time you need to perform a transaction, you will need to have your Ledger nearby and plug it into your USB port.

What now?

For now, we still need @netuoso's Ledger app for Hive to be approved and listed into Ledger Live and then we need more support for it on the frontends and other dApps. @holger80 has already added support for it into his Python library Beem (see link further below).

As a regular contributor to the Condenser/Wallet apps for Hive Blog and to Hive Keychain. I'm already working for supporting the Hive Ledger app in Javascript.

I managed to communicate with the device using a command line NodeJS script but getting it work in a browser was a little bit of a struggle but I finally managed to get something working although it's still very basic.

After connecting my Ledger Nano S to the USB port and launching the Hive app, Chrome detects the device.
Chrome detecting the USB Ledger Nano S

I then browse to my little test page and click on the Get public key button. If this is the first time you are trying to connect to the Ledger Nano from this page, Chrome will ask you to give permission:
Permission for dApp to access the Ledger device

Once permission given, the test page will then ask the device to give its owner public key and will display it. The test page will also ask the device to display that owner public key on the device screen so that you can confirm that the key is the correct ones (preventing the dApps to display a fake public key).
Requesting a public key

Verifying the public key on the Ledger

On the device you can use one of the two buttons to approve or reject and the response will be reflected on the test page.

Verified public key

My next step is to perform a signature of a test transaction. I will then clean up the code and make it available open source.

Related posts

Vote for my witness
Support @quochuy Witness.jpg
On Hive, Witnesses are playing the important role of providing a performant and safe network for all of us. You have the power to choose 30 trusty witnesses to package transactions and sign the blocks that will go in the Hive blockchain. Vote for me via HiveSigner to support my work for the community.

3 columns
2 columns
1 column