JavaScript library for Ledger Nano S HIVE application
It's been a couple of months since published the initial version of the Hive Ledger App. In order to get official support from Ledger (i.e. the possibility to install it from Ledger Live), we need to meet several requirements. And I'm trying to fulfill them all so we could benefit from the hardware wallet support.
Code review
First, we need to make sure that the application is stable and secure. I already made a preliminary review of the app and created a Pull Request with some fixes. The next step will be to review the code from a security perspective, following the guidelines provided by Ledger. This requires a bit more work and knowledge than validating transactions serialization etc, but we will get there.
Javascript library
To simplify communication with the ledger app, I created a JavaScript/Typescript library. It's really easy to use it with NodeJS. The library covers every functionality supported by the app.
Example usage:
import Hive from '@engrave/ledger-app-hive';
import TransportNodeHid from '@ledgerhq/hw-transport-node-hid';
import Transport from '@ledgerhq/hw-transport';
( async () => {
console.log('Unlock your ledger....');
const transport = await TransportNodeHid.create();
console.log(`Established connection with Ledger Nano S`);
try {
const hive = new Hive(transport);
const {version, arbitraryData} = await hive.getAppConfiguration();
console.log("Current version:", version);
console.log("Arbitary data enabled:", arbitraryData);
const publicKey = await hive.getPublicKey(`48'/13'/0'/0'/0'`);
console.log("Public key:", publicKey);
} catch (e) {
console.error(e);
}
finally {
transport.close();
}
})();
API
getAppConfiguration
Get current configuration for HIVE App installed on a Ledger.
async getAppConfiguration(): Promise<{version: string, arbitraryData: boolean}>
getPublicKey
Retrieve public key from specified BIP32 path. You can set an additional parameter confirm: boolean which will ask the user to confirm the Public Key on his Ledger before returning it.
async getPublicKey(path: string, confirm?: boolean): Promise<{publicKey: string}> {
signTransaction
Sign basic transactions with the specified key path. This method will return signed transactions (a transaction with additional signatures property). Please note that extensions are not yet supported for most transactions and operations (except beneficiaries for comment_options).
async signTransaction(tx: Transaction, path: string): Promise<SignedTransaction>
Please be aware that the current implementation of the HIVE Ledger App does not support multisig. This could be also a cool feature and we might add it someday. For now, let's focus on publishing it.
The library is open-source and available on Gitlab and NPM:
Ledger Companion App
To prove that the application is working correctly, Ledger requires a sample Companion App.
I prepared an initial design for a new wallet app and will start developing it soon. The plan is to make it as a wallet targeted at large stakeholders willing to invest in HIVE. It will be focused on governance (voting for witnesses and proposals) and the most significant chain news.
Follow me to be up to date with incoming development updates!
Leave JavaScript library for Ledger Nano S HIVE application to:
Read more #hive posts
Best Posts From engrave
We have not curated any of engrave's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From engrave
- Help me design a decentralized version of hiveprojects.io
- Hive Projects update: 4 projects added, 202 listed in total!
- How to add missing authorities from a Ledger device
- Engrave witness update, HF28, Hive Ledger changes and 100k Power Up
- Low power local witness node
- Hive Projects update: 4 projects added, 198 listed in total!
- I've been voted into top20 just to be forced to vote on a Splinterlands proposal
- Hive Projects update: 4 projects added, 194 listed in total!
- The state of dBlog
- Hive Projects update: 3 projects added, 190 listed in total!
- Manage authorities using a Ledger device
- Hive Projects weekly update: 4 projects added, 187 listed in total!
- Hive Projects weekly update: 4 projects added, 183 listed in total!
- Hive Projects weekly update: 5 projects added, 179 listed in total!
- Hive Projects weekly update: 3 projects added, 174 listed in total!
- Hive Projects weekly update: 6 projects added, 171 listed in total!
- Reimbursement proposal for Ledger hardware wallets support
- Hive is now officially supported by Ledger
- Hive Ledger Wallet updated to follow successful Hard Fork 26
- Hive Projects weekly update: 2 projects added, 165 listed in total!