GithubHelp home page GithubHelp logo

hatgit / convertseed Goto Github PK

View Code? Open in Web Editor NEW

This project forked from coolbitx-technology/convertseed

0.0 3.0 0.0 2.48 MB

A tool to convert CoolBitX number seed into wallet import format (.WIF)

HTML 0.51% JavaScript 99.49%

convertseed's Introduction

SEED RESTORE

purpose

transfer mnemonic seed into Wallet Import Format(WIF) string

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錢包架構格式 https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki

bip39 mnemonic encode https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md

HD錢包格式說明文章 https://medium.com/taipei-ethereum-meetup/%E8%99%9B%E6%93%AC%E8%B2%A8%E5%B9%A3%E9%8C%A2%E5%8C%85-%E5%BE%9E-bip32-bip39-bip44-%E5%88%B0-ethereum-hd-%EF%BD%97allet-a40b1c87c1f7

convertseed's People

Contributors

json-liang avatar

Watchers

James Cloos avatar Steven J Hatzakis avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.