We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to use this lib for Litecoin? For HDKey class I see VERSION property but it changes nothing.
import { generateMnemonic as _generateMnemonic, mnemonicToSeed } from '@scure/bip39'; import { wordlist } from '@scure/bip39/wordlists/english'; import { HDKey } from '@scure/bip32'; import { network } from './constants'; import * as crypto from '@scure/btc-signer'; type AllowedKeyEntropyBits = 128 | 256; export const network = { testnet: { private: 0x043587cf, public: 0x04358394, }, }; export function generateMnemonic(entropy: AllowedKeyEntropyBits = 256): string { if (entropy !== 256 && entropy !== 128) throw TypeError( `Incorrect entropy bits provided, expected 256 or 128 (24 or 12 word results), got: "${String( entropy )}".` ); return _generateMnemonic(wordlist, entropy); } async function generateWallet() { const mnemonic = generateMnemonic(); const masterseed = await mnemonicToSeed(mnemonic); const hdkey = HDKey.fromMasterSeed(masterseed, network.testnet); const addresses = [] for (let i = 0; i < 5; i++) { const path = `m/44'/2'/0'/0/${i}`; const node = hdkey.derive(path); const address = crypto.getAddress('wpkh', node.privateKey!); addresses.push(address); } console.log("Addresses:", addresses); } generateWallet();
It returns these addresses (apparently taking some default BTC values for network keys):
Addresses: [ 'bc1q6jrqgz7vk7nlqk5z8nlfpksycjpxtgf3r90a8e', 'bc1qwm9py9nh7ml0p623u9cj64ps97aykd96j84x60', 'bc1q57utqrw02h0vcuk4txathp2gktlvw75wap9e9q', 'bc1qekjw3qsk7r4qpe83rggu823pd7lz7amc2jnrhe', 'bc1qkj9cx5x49knq59ux5q9zf8gkq9apgrxxd2twru' ]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is it possible to use this lib for Litecoin? For HDKey class I see VERSION property but it changes nothing.
It returns these addresses (apparently taking some default BTC values for network keys):
The text was updated successfully, but these errors were encountered: