Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

electrum-mnemonic

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electrum-mnemonic

Electrum Mnemonics (electrum v2 and greater)

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
346
increased by13.82%
Maintainers
1
Weekly downloads
 
Created
Source

Electrum Mnemonics (electrum v2 and greater)

Build Status NPM

code style: prettier

Install

npm install electrum-mnemonic

Usage

  • Generate a mnemonic (English only for now)
const mn = require('electrum-mnemonic')
console.log(mn.generateMnemonic()) // default segwit bech32 wallet
console.log(mn.generateMnemonic(mn.PREFIXES.segwit)) // explicit segwit bech32 wallet
console.log(mn.generateMnemonic(mn.PREFIXES.standard)) // legacy p2pkh wallet (base58 address starting with 1)
console.log(mn.generateMnemonic(mn.PREFIXES['2fa'])) // 2fa legacy
console.log(mn.generateMnemonic(mn.PREFIXES['2fa-segwit'])) // legacy p2pkh wallet (base58 address starting with 1)
  • Convert mnemonic into 64 byte seed (for bip32)
const mn = require('electrum-mnemonic')
const phrase = mn.generateMnemonic()
const seed = mn.mnemonicToSeedSync(phrase, { passphrase: 'extrapassword' })
console.log(seed)

// async
;(async () => {
  const seed2 = await mn.mnemonicToSeed(phrase)
  // no extra password so seed and seed2 should be different
  console.log(seed2)
})()
  • Skip valid version prefix check
const mn = require('electrum-mnemonic')
const seed = mn.mnemonicToSeedSync('abc', { skipCheck: true })
console.log(seed)
  • Custom prefixes for checking
const mn = require('electrum-mnemonic')
const phrase = mn.generateMnemonic('fed')
const seed = mn.mnemonicToSeedSync(phrase, { validPrefixes: mn.PREFIXES.concat(['fed']) })
console.log(seed)

Keywords

FAQs

Package last updated on 16 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc