Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yuanyu90221/recover_seed

recover_seed
https://github.com/yuanyu90221/recover_seed

Last synced: 1 day ago
JSON representation

recover_seed

Awesome Lists containing this project

README

        

# SEED RESTORE

# purpose
transfer mnemonic seed into Wallet Import Format(WIF) string

# code

```code
function derivedWIF(phrase, accountIndex=0, accountType=0, addressIndex=0) {
let seedBuffer = bip39.mnemonicToSeed(phrase);
let masterNode = bitcoin.fromSeedBuffer(seedBuffer);
// Derived the first account based on BIP44
let coinType = bitcoinType;
let account0 = masterNode.derivePath(`m/44'/${coinType}'/${accountIndex}'`);
let key0 = account0.derivePath(`${accountType}/${addressIndex}`).keyPair;
let address0 = key0.getAddress();
return key0.toWIF();
}
```
# 參考

bip44 HD錢包架構格式

bip39 mnemonic encode

HD錢包格式說明文章