Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/demox-labs/aleo-hd-key
https://github.com/demox-labs/aleo-hd-key
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/demox-labs/aleo-hd-key
- Owner: demox-labs
- License: mit
- Created: 2022-10-31T21:34:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-31T21:57:27.000Z (over 2 years ago)
- Last Synced: 2024-12-01T18:24:59.751Z (2 months ago)
- Language: TypeScript
- Size: 39.1 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Aleo HD Key
=====Seed Derivation for `aleo`
The goal of this library is to safely generate deterministic seeds for use with the Aleo SDK.
Since BLS12_377 is not supported yet in BIP-32 or BIP-44, this attempts to ensure Aleo Keys are derived from a seed in a secure way.------------
[SLIP-0010](https://github.com/satoshilabs/slips/blob/master/slip-0010.md) - Specification
Installation
------------yarn add @demox-labs/aleo-sdk @demox-labs/aleo-hd-key
optionally, install Bip39: yarn add bip39
Usage
-----**example:**
```js
import * as AleoSDK from '@demox-labs/aleo-sdk';
import { derivePath } from '@demox-labs/aleo-hd-key';
import * as Bip39 from 'bip39';// Generate seed phrase using Bip39
const mnemonic = Bip39.generateMnemonic(128);
const hexSeed = Bip39.mnemonicToSeedSync(mnemonic).toString('hex');// Generate new seed for account
const accIndex = 0;
const path = `m/44'/0'/${accIndex}'/0'`; // Path used by Leo Wallet
const { seed: childSeed, chainCode} = derivePath(path, hexSeed);// Convert to PrivateKey using Also SDK
const privateKey = AleoSDK.PrivateKey.from_seed_unchecked(childSeed);
```Tests
-----
```
yarn test
```References
----------
[SLIP-0010](https://github.com/satoshilabs/slips/blob/master/slip-0010.md)[BIP-0032](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
[BIP-0044](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)