
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A TypeScript library for interacting with various blockchains, providing simple and consistent interfaces for generating keys, addresses, and managing crypto wallets
[!WARNING] This library is under active development and the API may change significantly between minor versions until reaching 1.0.0. Each release will be documented in the CHANGELOG.md file, but please keep this in mind when integrating the library.
A TypeScript library for interacting with various blockchains, providing simple and consistent interfaces for generating keys, addresses, and managing crypto wallets.
Currently supported blockchains:
npm install ubichain
# or
yarn add ubichain
# or
pnpm add ubichain
[!TIP] For detailed example code, check the
playgroundfolder in the repository
import { useBlockchain, blockchains } from 'ubichain';
// Using lazy factories for better performance and tree-shaking
// Create blockchain interfaces with lazy loading
const bitcoinImpl = await blockchains.bitcoin()();
const ethereumImpl = await blockchains.ethereum()();
const solanaImpl = await blockchains.solana()();
const bitcoinChain = useBlockchain(bitcoinImpl);
const ethereumChain = useBlockchain(ethereumImpl);
const solanaChain = useBlockchain(solanaImpl);
// Get cryptographic curve used by the blockchain
console.log('Bitcoin uses curve:', bitcoinChain.curve); // secp256k1
console.log('Ethereum uses curve:', ethereumChain.curve); // secp256k1
console.log('Solana uses curve:', solanaChain.curve); // ed25519
import { useBlockchain, blockchains } from 'ubichain';
// Mainnet blockchain instance (default)
const bitcoinImpl = await blockchains.bitcoin()();
const chain = useBlockchain(bitcoinImpl);
// Testnet blockchain instance
const testnetImpl = await blockchains.bitcoin({ network: 'testnet' })();
const testnet = useBlockchain(testnetImpl);
// Generate a single private key
const privateKey = chain.generateKeyPrivate();
console.log('Private Key:', privateKey);
// Get a public key from a private key
const publicKey = chain.getKeyPublic(privateKey);
console.log('Public Key:', publicKey);
// Generate an uncompressed public key
const uncompressedPublicKey = chain.getKeyPublic(privateKey, { compressed: false });
console.log('Uncompressed Public Key:', uncompressedPublicKey);
// Generate mainnet addresses
const address = chain.getAddress(publicKey);
console.log('Mainnet Legacy Address:', address);
// Generate different types of Bitcoin mainnet addresses
const p2shAddress = chain.getAddress(publicKey, 'p2sh');
const p2wshAddress = chain.getAddress(publicKey, 'p2wsh');
const taprootAddress = chain.getAddress(publicKey, 'taproot');
console.log('Mainnet P2SH Address:', p2shAddress);
console.log('Mainnet P2WSH Address:', p2wshAddress);
console.log('Mainnet Taproot Address:', taprootAddress);
// Generate testnet addresses
const testnetAddress = testnet.getAddress(publicKey);
console.log('Testnet Legacy Address:', testnetAddress);
const testnetSegwit = testnet.getAddress(publicKey, 'segwit');
console.log('Testnet SegWit Address:', testnetSegwit);
// Validate an address
const isValid = chain.validateAddress?.(address);
console.log('Is Valid Mainnet Address:', isValid);
// Validate testnet address
const isValidTestnet = testnet.validateAddress?.(testnetAddress);
console.log('Is Valid Testnet Address:', isValidTestnet);
import { useBlockchain, blockchains } from 'ubichain';
const ethereumImpl = await blockchains.ethereum()();
const chain = useBlockchain(ethereumImpl);
// Generate a key pair (private and public keys)
const keys = chain.generateKeys();
console.log('Private Key:', keys.keys.private);
console.log('Public Key:', keys.keys.public);
// Generate a complete wallet (private key, public key, and address)
const wallet = chain.generateWallet();
console.log('Private Key:', wallet.keys.private);
console.log('Public Key:', wallet.keys.public);
console.log('Address:', wallet.address);
// Generate wallet with specific options
const uncompressedWallet = chain.generateWallet({ compressed: false });
console.log('Uncompressed Public Key:', uncompressedWallet.keys.public);
// Generate Bitcoin wallet with specific address type
const bitcoinImpl = await blockchains.bitcoin()();
const bitcoinChain = useBlockchain(bitcoinImpl);
const p2shWallet = bitcoinChain.generateWallet({}, 'p2sh');
console.log('Bitcoin P2SH Address:', p2shWallet.address); // Starts with '3'
import { useBlockchain, blockchains, getBIP44Path, BIP44 } from 'ubichain';
import { mnemonicToSeed } from 'ubichain/utils/bip39';
import { getMasterKeyFromSeed, deriveHDKey } from 'ubichain/utils/bip32';
import { getMasterKeyFromSeed as slip10MasterKey, deriveHDKey as slip10Derive } from 'ubichain/utils/slip10';
// Generate a mnemonic phrase (or use your existing one)
// import { generateMnemonic } from 'ubichain/utils/bip39';
// const mnemonic = generateMnemonic();
const mnemonic = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about';
// Convert mnemonic to seed
const seed = mnemonicToSeed(mnemonic);
// Get master key from seed
const masterKey = getMasterKeyFromSeed(seed);
// Create blockchain instances
const bitcoinImpl = await blockchains.bitcoin()();
const ethereumImpl = await blockchains.ethereum()();
const solanaImpl = await blockchains.solana()();
const bitcoinChain = useBlockchain(bitcoinImpl);
const ethereumChain = useBlockchain(ethereumImpl);
const solanaChain = useBlockchain(solanaImpl);
// Get BIP44 paths for different blockchains
const bitcoinPath = getBIP44Path(BIP44.BITCOIN); // m/44'/0'/0'/0/0
const ethereumPath = getBIP44Path(BIP44.ETHEREUM); // m/44'/60'/0'/0/0
const solanaPath = getBIP44Path(BIP44.SOLANA); // m/44'/501'/0'/0/0
// Derive keys for Bitcoin
const bitcoinKey = deriveHDKey(masterKey, bitcoinPath);
const bitcoinPrivateKey = Buffer.from(bitcoinKey.privateKey!).toString('hex');
console.log('Bitcoin Derived Private Key:', bitcoinPrivateKey);
// Derive keys for Ethereum
const ethereumKey = deriveHDKey(masterKey, ethereumPath);
const ethereumPrivateKey = Buffer.from(ethereumKey.privateKey!).toString('hex');
console.log('Ethereum Derived Private Key:', ethereumPrivateKey);
// Generate wallets from derived private keys
const bitcoinWallet = bitcoinChain.generateWallet({ privateKey: bitcoinPrivateKey });
const ethereumWallet = ethereumChain.generateWallet({ privateKey: ethereumPrivateKey });
console.log('Bitcoin Address:', bitcoinWallet.address);
console.log('Ethereum Address:', ethereumWallet.address);
// For ed25519 curves (like Solana), use SLIP-10 instead of BIP32
// Derive ed25519 keys using SLIP-10
const slip10Master = slip10MasterKey(seed);
const solanaKey = slip10Derive(slip10Master, solanaPath, true);
const solanaPrivateKey = Buffer.from(solanaKey.privateKey).toString('hex');
console.log('Solana Derived Private Key:', solanaPrivateKey);
import { useBlockchain, blockchains } from 'ubichain';
// EVM blockchains share the same address format
const ethereumImpl = await blockchains.ethereum()();
const baseImpl = await blockchains.base()();
const ethereumChain = useBlockchain(ethereumImpl);
const baseChain = useBlockchain(baseImpl);
// Generate wallets for both chains
const ethWallet = ethereumChain.generateWallet();
const baseWallet = baseChain.generateWallet();
console.log('Ethereum Address:', ethWallet.address);
console.log('Base Address:', baseWallet.address);
// Same private key will generate same address on both chains
const privateKey = ethereumChain.generateKeyPrivate();
const ethPublicKey = ethereumChain.getKeyPublic(privateKey);
const basePublicKey = baseChain.getKeyPublic(privateKey);
console.log('Same public key?', ethPublicKey === basePublicKey); // true
const ethAddress = ethereumChain.getAddress(ethPublicKey);
const baseAddress = baseChain.getAddress(basePublicKey);
console.log('Same address?', ethAddress === baseAddress); // true
The library is designed to be modular and extensible:
git clone https://github.com/oritwoen/ubichain.git
cd ubichain
pnpm install
# Run tests
pnpm run dev
# Build the library
pnpm run build
# Lint the code
pnpm run lint
# Run playground examples
pnpm playground:bip32 # Run BIP32 demo
pnpm playground:slip10 # Run SLIP-0010 demo
pnpm playground:bip39 # Run BIP39 demo
pnpm playground:bip44 # Run BIP44 demo
pnpm playground <file> # Run any TypeScript file in playground folder
This library leverages high-quality, audited cryptographic packages:
These dependencies were chosen for their security, performance, and reliability in cryptographic operations.
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)MIT - See LICENSE.md for details
FAQs
A TypeScript library for interacting with various blockchains, providing simple and consistent interfaces for generating keys, addresses, and managing crypto wallets
We found that ubichain demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.