create account

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

View this thread on: hive.blogpeakd.comecency.com
· @quochuy · (edited)
$87.33
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.

<sup>Source [Wikipedia](https://en.wikipedia.org/wiki/Cryptocurrency_wallet)</sup>

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](https://images.hive.blog/DQmXW7ZWJivv5DPPQDR8KCPnAvEPWbrC1N3RvNqSL5zFSx9/Screen%20Shot%202020-05-13%20at%2010.05.47%20am.jpg)

I then browse to my little test page https://tools.hivean.com/ledger.html 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](https://images.hive.blog/DQmVdPR8zD9e6Wno2QZifQ5XuYRn65SJUqUUGoPZMc6gu74/Screen%20Shot%202020-05-13%20at%2010.08.00%20am.jpg)

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](https://images.hive.blog/DQmbVVXwZQbg2HQjUajG6PfeNfyW435LZRic25WL6qMv9iD/Screen%20Shot%202020-05-13%20at%2010.09.27%20am.jpg)

![Verifying the public key on the Ledger](https://images.hive.blog/DQmdJBH57G7bfDy6xhVrNagKYpjUrCJrdh5vZa5oUEoBi7Y/IMG_5573.JPG)

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](https://images.hive.blog/DQmP37XpgWpSFXNLgTLx7D8UxKchuV6c17oginEZSmB7pXa/Screen%20Shot%202020-05-13%20at%2010.14.43%20am.jpg)

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
- [Hive Application for the Ledger Nano S/X Hardware Wallet](https://hivean.com/hive-139531/@netuoso/hive-application-for-the-ledger-nano-s-x-hardware-wallet) by @netuoso
- [Update for beem: support for Ledger Nano (S/X) has been added ](https://hivean.com/hive-139531/@holger80/update-for-beem-support-for-ledger-nano-sx-has-been-added) by @holger80

---

**Vote for my witness**
[![Support @quochuy Witness.jpg](https://images.hive.blog/DQmecYTZemY8SwU6rrg7awhpNRBsehUp7ivk9RGyZsUUpVw/quochuy-hive-witness.jpg)](https://hivesigner.com/sign/account-witness-vote?witness=quochuy&approve=1)
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](https://hivesigner.com/sign/account-witness-vote?witness=quochuy&approve=1) to support my work for the community.
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 379 others
πŸ‘Ž  
properties (23)
authorquochuy
permlinkpreparing-some-javascript-support-for-the-hive-app-on-ledger-hardware-wallet
categoryhive-139531
json_metadata{"tags":["hivedev","development","crypto","ledger","wallet"],"users":["netuoso","holger80"],"image":["https://images.hive.blog/DQmXW7ZWJivv5DPPQDR8KCPnAvEPWbrC1N3RvNqSL5zFSx9/Screen%20Shot%202020-05-13%20at%2010.05.47%20am.jpg","https://images.hive.blog/DQmVdPR8zD9e6Wno2QZifQ5XuYRn65SJUqUUGoPZMc6gu74/Screen%20Shot%202020-05-13%20at%2010.08.00%20am.jpg","https://images.hive.blog/DQmbVVXwZQbg2HQjUajG6PfeNfyW435LZRic25WL6qMv9iD/Screen%20Shot%202020-05-13%20at%2010.09.27%20am.jpg","https://images.hive.blog/DQmdJBH57G7bfDy6xhVrNagKYpjUrCJrdh5vZa5oUEoBi7Y/IMG_5573.JPG","https://images.hive.blog/DQmP37XpgWpSFXNLgTLx7D8UxKchuV6c17oginEZSmB7pXa/Screen%20Shot%202020-05-13%20at%2010.14.43%20am.jpg","https://images.hive.blog/DQmecYTZemY8SwU6rrg7awhpNRBsehUp7ivk9RGyZsUUpVw/quochuy-hive-witness.jpg"],"links":["https://en.wikipedia.org/wiki/Cryptocurrency_wallet","https://tools.hivean.com/ledger.html","https://hivean.com/hive-139531/@netuoso/hive-application-for-the-ledger-nano-s-x-hardware-wallet","https://hivean.com/hive-139531/@holger80/update-for-beem-support-for-ledger-nano-sx-has-been-added","https://hivesigner.com/sign/account-witness-vote?witness=quochuy&approve=1"],"app":"hiveblog/0.1","format":"markdown"}
created2020-05-13 07:54:09
last_update2020-05-15 06:40:48
depth0
children17
last_payout2020-05-20 07:54:09
cashout_time1969-12-31 23:59:59
total_payout_value50.480 HBD
curator_payout_value36.851 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,822
author_reputation758,372,221,814,367
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,344,093
net_rshares156,047,757,966,864
author_curate_reward""
vote details (444)
@abinitio ·
$0.07
The development is interesting. I want know what you mean when you wrote "preventing the dApps to display a fake public key".
Why would the dapps display a fake key?
πŸ‘  
properties (23)
authorabinitio
permlinkre-quochuy-qabetd
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.05.2"}
created2020-05-14 09:41:00
last_update2020-05-14 09:41:00
depth1
children3
last_payout2020-05-21 09:41:00
cashout_time1969-12-31 23:59:59
total_payout_value0.034 HBD
curator_payout_value0.034 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length165
author_reputation129,497,873,842
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,364,070
net_rshares205,260,386,553
author_curate_reward""
vote details (1)
@quochuy ·
If the dapps somehow got hacked, gives you the public key of another account and you use it to give permission to do stuffs on the blockchain on your behalf...
πŸ‘  
properties (23)
authorquochuy
permlinkqabrao
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2020-05-14 14:08:48
last_update2020-05-14 14:08:48
depth2
children2
last_payout2020-05-21 14:08:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length159
author_reputation758,372,221,814,367
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,367,794
net_rshares688,072,190
author_curate_reward""
vote details (1)
@abinitio ·
Wow! I always thought public keys should match the underlying private keys to work. Thanks for this information. It makes users much more alert.
properties (22)
authorabinitio
permlinkre-quochuy-qabska
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.05.2"}
created2020-05-14 14:37:42
last_update2020-05-14 14:37:42
depth3
children1
last_payout2020-05-21 14:37:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length144
author_reputation129,497,873,842
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,368,225
net_rshares0
@behiver ·
$0.07
I think a hardware wallet would put HIVE on the big players map. I am always forgetting where I put my keys, with this solve it if I register it once?
πŸ‘  
properties (23)
authorbehiver
permlinkre-quochuy-2020514t235055857z
categoryhive-139531
json_metadata{"tags":["hive-139531","hivedev","development","crypto","ledger","wallet"],"app":"esteem/2.2.7-surfer","format":"markdown+html","community":"esteem.app"}
created2020-05-14 20:50:54
last_update2020-05-14 20:50:54
depth1
children1
last_payout2020-05-21 20:50:54
cashout_time1969-12-31 23:59:59
total_payout_value0.032 HBD
curator_payout_value0.033 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length150
author_reputation567,890,467,975,745
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,373,958
net_rshares202,618,014,117
author_curate_reward""
vote details (1)
@quochuy ·
Yes. It will. You will however have to backup a series of 24 English words. They are your recovery words used to create a backup Ledger
properties (22)
authorquochuy
permlinkqacfio
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2020-05-14 22:52:00
last_update2020-05-14 22:52:00
depth2
children0
last_payout2020-05-21 22:52:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length135
author_reputation758,372,221,814,367
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,375,541
net_rshares0
@codingdefined ·
$0.07
Now with this you don't have to keep your Hive in your wallet or in the exchange. You can actually add it to the nano itself
πŸ‘  
properties (23)
authorcodingdefined
permlinkre-quochuy-2020513t165155362z
categoryhive-139531
json_metadata{"tags":["hive-139531","hivedev","development","crypto","ledger","wallet"],"app":"esteem/2.2.5-mobile","format":"markdown+html","community":"hive-125125"}
created2020-05-13 11:22:00
last_update2020-05-13 11:22:00
depth1
children0
last_payout2020-05-20 11:22:00
cashout_time1969-12-31 23:59:59
total_payout_value0.032 HBD
curator_payout_value0.034 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length124
author_reputation528,927,304,035,089
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,346,353
net_rshares205,283,529,941
author_curate_reward""
vote details (1)
@eloghosa ·
$0.07
Hey there! Thanks for the work that you do. I’m sure many Hivers (not so sure there is a name yet) would be delighted to store their coins in a physical wallet. It’d definitely help user experience on Hive.
πŸ‘  
properties (23)
authoreloghosa
permlinkqa9v64
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2020-05-13 13:37:18
last_update2020-05-13 13:37:18
depth1
children0
last_payout2020-05-20 13:37:18
cashout_time1969-12-31 23:59:59
total_payout_value0.034 HBD
curator_payout_value0.034 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length206
author_reputation3,463,139,502,619
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,348,234
net_rshares206,104,843,726
author_curate_reward""
vote details (1)
@kingscrown ·
properties (23)
authorkingscrown
permlinkre-quochuy-2020514t54746972z
categoryhive-139531
json_metadata{"tags":["hive-139531","hivedev","development","crypto","ledger","wallet"],"app":"esteem/2.2.7-surfer","format":"markdown+html","community":"esteem.app"}
created2020-05-14 03:47:45
last_update2020-05-14 03:47:45
depth1
children0
last_payout2020-05-21 03:47:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length13
author_reputation2,115,337,645,722,472
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,360,056
net_rshares-299,069,965,832
author_curate_reward""
vote details (9)
@leprechaun ·
$0.07
I wouldn't want this for posting and voting because it is not something I want to confirm on another screen.  For some it might be worth for their balances though. 
πŸ‘  
properties (23)
authorleprechaun
permlinkre-quochuy-qaadz8
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.05.2"}
created2020-05-13 20:23:45
last_update2020-05-13 20:23:45
depth1
children1
last_payout2020-05-20 20:23:45
cashout_time1969-12-31 23:59:59
total_payout_value0.034 HBD
curator_payout_value0.034 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length164
author_reputation43,003,961,497,973
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,354,673
net_rshares203,877,547,419
author_curate_reward""
vote details (1)
@quochuy ·
You don't really need to anyway. Getting your private posting key stolen is not as critical as with the active or owner key. However it can be a pain still because you would need to go through the crappy content the hacker might have created with your account and then you will need to change your password and generate all of your private keys and update your offline wallets with them.
properties (22)
authorquochuy
permlinkqaammb
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2020-05-13 23:30:12
last_update2020-05-13 23:30:12
depth2
children0
last_payout2020-05-20 23:30:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length387
author_reputation758,372,221,814,367
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,357,271
net_rshares0
@littleksroad ·
support
properties (22)
authorlittleksroad
permlinkqa9ubt
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2020-05-13 13:19:06
last_update2020-05-13 13:19:06
depth1
children0
last_payout2020-05-20 13:19:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length7
author_reputation75,907,335,963,103
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,348,008
net_rshares0
@marki99 ·
$0.07
I am in the process of learning web development. I use ruby on rails, HTML and CSS. I currently want to dive into javascript and react. 

Do you have any favorite resources to learn web app development with javaScript only? 
πŸ‘  ,
properties (23)
authormarki99
permlinkre-quochuy-qa9wvz
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.05.2"}
created2020-05-13 14:14:24
last_update2020-05-13 14:14:24
depth1
children1
last_payout2020-05-20 14:14:24
cashout_time1969-12-31 23:59:59
total_payout_value0.036 HBD
curator_payout_value0.036 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length224
author_reputation11,400,723,818,181
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,348,820
net_rshares217,433,641,778
author_curate_reward""
vote details (2)
@quochuy ·
Hmmm, unfortunately I don't. I've learned JS myself since 1998.
There are several online course online, some of them are free. The only one I know of is https://www.codecademy.com, I've never used it but I believe it's one of the first of its kind.
properties (22)
authorquochuy
permlinkqaamgh
categoryhive-139531
json_metadata{"links":["https://www.codecademy.com"],"app":"hiveblog/0.1"}
created2020-05-13 23:26:42
last_update2020-05-13 23:26:42
depth2
children0
last_payout2020-05-20 23:26:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length248
author_reputation758,372,221,814,367
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,357,220
net_rshares0
@nickyhavey ·
$0.07
This sounds like a great development and hopefully it can be integrated to Ledger Live in no time! I have a nano S but will we need to use it every time we want to make a comment or a post or is it only for wallet transactions (active key tasks)?
πŸ‘  
properties (23)
authornickyhavey
permlinkre-quochuy-qa9gc1
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.05.2"}
created2020-05-13 08:17:03
last_update2020-05-13 08:17:03
depth1
children2
last_payout2020-05-20 08:17:03
cashout_time1969-12-31 23:59:59
total_payout_value0.034 HBD
curator_payout_value0.034 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length246
author_reputation343,022,660,476,683
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,344,348
net_rshares206,929,455,960
author_curate_reward""
vote details (1)
@quochuy ·
It's up to how you are going to set it up. You can decide to change all your keys to use the ledger. Or just some of them. More instructions when things are ready.
properties (22)
authorquochuy
permlinkqa9i1o
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2020-05-13 08:53:48
last_update2020-05-13 08:53:48
depth2
children1
last_payout2020-05-20 08:53:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length163
author_reputation758,372,221,814,367
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,344,747
net_rshares0
@nickyhavey ·
Ok will have to see when things are ready then! Looking forward to the updates 
properties (22)
authornickyhavey
permlinkre-quochuy-qa9myz
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.05.2"}
created2020-05-13 10:40:12
last_update2020-05-13 10:40:12
depth3
children0
last_payout2020-05-20 10:40:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length79
author_reputation343,022,660,476,683
root_title"Preparing some Javascript support for the Hive app on Ledger hardware wallet"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,345,858
net_rshares0