
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
bitsong-js-wallet
Advanced tools

A lightweight BitSong Wallet implementation. Forked from ethereumjs-wallet
It is complemented by the following packages:
Motivations are:
Features not supported:
generateWallet()Generates wallet from a random BIP39 mnemonic phrase (uses bip39.generateMnemonic() under the hood).
import {generateWallet} from 'bitsong-js-wallet';
const wallet = generateWallet();
walletFromMnemonic(mnemonic)Create a wallet instance based on BIP39 12 words mnemonic phrase
import {walletFromMnemonic} from 'bitsong-js-wallet';
const wallet = walletFromMnemonic('surround tape away million into program organ tonight write prefer inform cool');
walletFromPrivateKey(privateKey)Create a wallet instance based on a raw private key
import {walletFromPrivateKey} from 'bitsong-js-wallet';
import {Buffer} from 'safe-buffer';
const privateKeyBuffer = Buffer.from('ef2af2385681c490bc473c2f7e6097fc1a38e6f67b44b81a3350a6583aadd144', 'hex')
const wallet = walletFromPrivateKey(privateKeyBuffer);
walletFromExtendedPrivateKey(extendedPrivateKeyString)Create an instance based on a BIP32 extended private key (xprv)
import {walletFromExtendedPrivateKey} from 'bitsong-js-wallet';
const wallet = walletFromExtendedPrivateKey('xprv9s21ZrQH143K4KqQx9Zrf1eN8EaPQVFxM2Ast8mdHn7GKiDWzNEyNdduJhWXToy8MpkGcKjxeFWd8oBSvsz4PCYamxR7TX49pSpp3bmHVAY');
.getAddress()Return the address: 20 bytes length Buffer or Uint8Array
wallet.getAddress();
// [88,108,62,182,16,84,7,36,101,31,244,29,32,158,20,41,238,62,68,154]
.getAddressString()Return the BitSong-style address
wallet.getAddress();
// 'Mx586c3eb610540724651ff41d209e1429ee3e449a'
.getMnemonic()Return the mnemonic phrase: 12 words string. Note: Only works with instance created/generated from mnemonic, otherwise it will throw an error.
wallet.getMnemonic();
// 'surround tape away million into program organ tonight write prefer inform cool'
.getPrivateKey()Return the private key: 32 bytes length Buffer or Uint8Array
wallet.getPrivateKey();
// [239,42,242,56,86,129,196,144,188,71,60,47,126,96,151,252,26,56,230,246,123,68,184,26,51,80,166,88,58,173,209,68]
.getPrivateKeyString()Return the private key string of 64 hex characters
wallet.getPrivateKeyString();
// 'ef2af2385681c490bc473c2f7e6097fc1a38e6f67b44b81a3350a6583aadd144'
.getPublicKey()Return the uncompressed Ethereum-style public key: 64 bytes length Buffer or Uint8Array
wallet.getPublicKey();
// [251,82,201,189,133,251,174,27,6,6,18,34,12,222,116,254,99,169,65,249,135,81,170,13,35,99,50,6,231,95,48,69,41,47,96,75,240,242,9,77,23,168,173,59,137,223,128,80,144,69,34,91,145,21,255,133,112,189,68,8,42,245,210,116]
.getPublicKeyString()Return the BitSong-style public key string
wallet.getPublicKeyString();
// 'Mpfb52c9bd85fbae1b060612220cde74fe63a941f98751aa0d23633206e75f3045'
generateMnemonic()Generate random 12 words mnemonic phrase. Exposed bip39.generateMnemonic().
import {generateMnemonic} from 'bitsong-js-wallet';
const mnemonic = generateMnemonic();
// 'surround tape away million into program organ tonight write prefer inform cool'
isValidMnemonic(mnemonic)Check that given mnemonic is valid, returns boolean, uses bip39.validateMnemonic() under the hood.
import {isValidMnemonic} from 'bitsong-js-wallet';
const isValid = isValidMnemonic('surround tape away million into program organ tonight write prefer inform cool');
// true
MIT License
FAQs
Utilities for handling BitSong keys
We found that bitsong-js-wallet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.