npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

coinlib-sdk

v3.2.0

Published

A unified multi-cryptocurrency wallet, transaction and payments library supporting Bitcoin, Ethereum, Ripple, Stellar, ERC20, Solana, Litecoin, Bitcoin Cash, and Dogecoin

Readme

Coinlib SDK - Packages Directory

A unified multi-cryptocurrency wallet, swap, stake, deploy smart contract, transaction and payments library supporting Bitcoin, Ethereum, Ripple, Stellar, ERC20, Solana, Cardano, Litecoin, Bitcoin Cash, Zcash ,and Dogecoin.

📦 Package Overview

This directory contains the core packages that make up the Coinlib SDK. Each package is designed to be modular and can be used independently or together to create comprehensive cryptocurrency applications.

Core Packages

🚀 Quick Start

Installation

npm install coinlib-sdk

Basic Usage

import { Coinlib } from "coinlib-sdk";
import type { CoinlibConfig } from "coinlib-sdk";

// Initialize with Bitcoin
const config: CoinlibConfig = {
	coins: "BTC",
	network: "mainnet",
	seed: "your-mnemonic-phrase-here",
};

const coinlib = new Coinlib(config);

// Derive an address
const address = await coinlib.deriveAddress(0);
console.log("Bitcoin Address:", address);

// Get balance
const balance = await coinlib.getBalance(address);
console.log("Balance:", balance);

// Sign transaction
const transaction = await coinlib.signTransaction(privateKey, fromAddress, toAddress, amount, feeRate);

📋 Package Details

coinlib

The main entry point providing the unified Coinlib API.

Key Features:

  • Unified interface for all cryptocurrency operations
  • HD wallet integration
  • Transaction signing and broadcasting
  • Balance checking and transaction history
  • Multi-network support (mainnet/testnet)

Main Classes:

  • Coinlib - Primary class for all operations
  • Configuration interfaces and types

coinlib-hd

Hierarchical Deterministic (HD) wallet implementation supporting multiple cryptocurrencies.

Key Features:

  • BIP32/BIP44/BIP49/BIP84/BIP86 derivation paths
  • 50+ supported cryptocurrencies
  • Mnemonic generation and validation (BIP39)
  • Multi-network address generation
  • Private key management

Supported Cryptocurrencies:

  • Bitcoin Family: BTC, LTC, BCH, DOGE, ZEC, etc.
  • Ethereum Family: ETH, ETC, BSC, POL, ARB, OP, BASE and ERC20
  • Other: XRP, XLM, ADA, SOL

Usage Example:

import { HDWallet } from "coinlib-sdk/coinlib-hd";

const wallet = HDWallet.generate(12, "english");
const btcAccount = wallet.deriveAccount("BTC", "mainnet");
console.log("Address:", btcAccount.address);

coinlib-link

Blockchain connectivity layer providing communication with various blockchain networks.

Key Features:

  • Multiple blockchain protocol support
  • WebSocket and REST API connections
  • Worker-based architecture for performance
  • Proxy support (SOCKS)
  • Connection pooling and management

Supported Workers:

  • Blockbook - Bitcoin-family blockchains
  • Ripple - XRP Ledger
  • Solana - Solana blockchain
  • Blockfrost - Cardano blockchain
  • Stellar - Stellar network

coinlib-link-types

TypeScript type definitions for blockchain operations.

Key Exports:

  • AccountInfo - Account information structure
  • Transaction - Transaction data types
  • TokenInfo - Token metadata
  • ServerInfo - Blockchain server information
  • Network-specific types for each supported blockchain

coinlib-link-utils

Utility functions for blockchain-specific operations.

Key Features:

  • Address validation and formatting
  • Network parameter handling
  • Protocol-specific utilities
  • Data transformation helpers

coinlib-type-utils

General TypeScript utility types and functions.

Key Features:

  • Array manipulation utilities
  • Object type helpers
  • Branded types for type safety
  • Timeout and promise utilities
  • Exhaustive type checking

coinlib-utils

General utility functions used across the SDK.

Key Features:

  • String and number formatting
  • Cryptographic utilities
  • Caching and deferred execution
  • Logging and debugging tools
  • Buffer and hex utilities

Notable Utilities:

  • BigNumber - Precise decimal arithmetic
  • createDeferred - Promise utilities
  • getMutex - Concurrency control
  • bigNumber - Cryptocurrency amount handling

coinlib-utxo-lib

UTXO (Unspent Transaction Output) handling for Bitcoin-family cryptocurrencies.

Key Features:

  • Transaction building and signing
  • UTXO selection algorithms
  • Script handling
  • SegWit and Taproot support
  • Fee calculation

coinlib-websocket

WebSocket client implementation for real-time blockchain data.

Key Features:

  • Real-time transaction monitoring
  • Block notifications
  • Connection management
  • Automatic reconnection
  • Message queuing

🔧 Configuration

Environment Setup

// Basic configuration
const config: CoinlibConfig = {
	coins: "BTC", // Cryptocurrency to use
	network: "mainnet", // 'mainnet' or 'testnet'
	seed: "mnemonic...", // BIP39 mnemonic phrase
	passphrase: "", // Optional passphrase
	debug: false, // Enable debug logging
};

// With proxy support
const configWithProxy: CoinlibConfig = {
	coins: "ETH",
	network: "mainnet",
	seed: "mnemonic...",
	proxy: {
		host: "proxy.example.com",
		port: 9050,
		type: 5, // SOCKS5
	},
};

Supported Networks

  • Mainnet: Production networks with real cryptocurrency
  • Testnet: Test networks for development and testing

📚 Examples

Multi-Currency Wallet

import { Coinlib } from "coinlib-sdk";

const coins = ["BTC", "ETH", "LTC", "XRP"];

for (const coin of coins) {
	const config = {
		coins: coin,
		network: "mainnet",
		seed: "your-mnemonic-here",
	};

	const payment = new Coinlib(config);
	const address = await payment.deriveAddress(0);
	const balance = await payment.getBalance(address);

	console.log(`${coin}: ${address} (${balance})`);
}

Transaction Signing

import { Coinlib } from "coinlib-sdk";

const coinlib = new Coinlib({
	coins: "BTC",
	network: "testnet",
	seed: "your-mnemonic-here",
});

// Sign a transaction
const signedTx = await coinlib.signTransaction(
	"privateKey",
	"fromAddress",
	"toAddress",
	0.001, // amount
	0.00001 // fee rate
);

// Broadcast the transaction
const txHash = await coinlib.broadcastTransaction(signedTx);
console.log("Transaction hash:", txHash);

Token Swapping

import { Coinlib } from "coinlib-sdk";

const coinlib = new Coinlib({
	coins: "USDT", // from token
	network: "mainnet",
	seed: "your-mnemonic-here",
});

// Swap USDT to ETH
const swapTx = await coinlib.swapTransaction(
	"privateKey",
	"fromAddress",
	"ETH", // to token
	"100" // amount in USDT
);

console.log("Swap transaction:", swapTx);

Coins Staking

import { Coinlib } from "coinlib-sdk";

const coinlib = new Coinlib({
	coins: "ADA",
	network: "mainnet",
	seed: "your-mnemonic-here",
});

// Stake ADA
const swapTx = await coinlib.stakeTransaction(
	"privateKey",
	"fromAddress",
	"0.003" // fee in ADA
	"19" // amount in ADA
);

console.log("Stake transaction:", swapTx);

🔒 Security

Best Practices

  1. Never expose private keys in client-side code
  2. Use testnet for development and testing
  3. Validate all inputs before processing
  4. Store mnemonics securely - never in plain text
  5. Use hardware wallets for production applications

Mnemonic Security

import { validateMnemonic, generateMnemonic } from "coinlib-sdk/coinlib-hd";

// Generate secure mnemonic
const mnemonic = generateMnemonic(24, { language: "english" });

// Validate before use
const validation = validateMnemonic(mnemonic);
if (!validation.isValid) {
	throw new Error(`Invalid mnemonic: ${validation.error}`);
}

🌐 Supported Cryptocurrencies

| Symbol | Name | Network | Address Type | | ------ | ------------ | --------------- | ------------------------- | | BTC | Bitcoin | Mainnet/Testnet | P2PKH, P2SH, P2WPKH, P2TR | | ETH | Ethereum | Mainnet/Testnet | 0x... | | LTC | Litecoin | Mainnet/Testnet | L..., M..., ltc1... | | BCH | Bitcoin Cash | Mainnet/Testnet | 1..., 3..., bitcoincash: | | XRP | Ripple | Mainnet/Testnet | r... | | XLM | Stellar | Mainnet/Testnet | G... | | ADA | Cardano | Mainnet/Testnet | addr1... | | SOL | Solana | Mainnet/Testnet | Base58 | | DOGE | Dogecoin | Mainnet/Testnet | D..., 9..., A... | | ZEC | Zcash | Mainnet/Testnet | Z..., |

And many more...

📖 API Reference

Coinlib Class

class Coinlib {
	constructor(config: CoinlibConfig);

	// Wallet operations
	generateMnemonic(wordCount: MnemonicWordCount = 12, language: MnemonicLanguage = "english"): string
	validateMnemonic(seed: string): MnemonicValidationResult

	// Address operations
	deriveAddress(index: number): Promise<string>;
	validateAddress(address: string): boolean;

	// Balance operations
	getBalance(address: string): Promise<string>;
	getAccountUtxo(address: string): Promise<Utxo[]>;

	// Transaction operations
	signTransaction(privateKey: string, from: string, to: string, amount: number, feeRate: number): Promise<string>;
	broadcastTransaction(txHex: string): Promise<string>;
	transferTransaction(privateKey: string, fromAddress: string, toAddress: string, amount: number | string, feeRate?: number | string): Promise<string>;
	swapTransaction(privateKey: string, fromAddress: string, toCoins: CoinShortcut, amount: number | string): Promise<any>;
	stakeTransaction(
		privateKey: string,
		fromAddress: string,
		feeRate: number | string,
		amount?: number | string;
		options?: {
			// for cardano
			stakePrivateKey?: string;
			poolId?: string;
			// for solana
			validatorAddress?: string;
		}
	): Promise<any>;

	// History operations
	getTransactionHistory(address: string, options?: <AccountInfoParams>): Promise<Transaction[]>;
	getTransactionDetails(txid: string): Promise<Transaction>;

	// Connection management
	connect(): Promise<void>;
	disconnect(): Promise<void>;
}

Configuration Interface

interface CoinlibConfig {
	coins?: CoinShortcut; // Cryptocurrency symbol
	network: NetworkType; // 'mainnet' or 'testnet'
	seed?: string; // BIP39 mnemonic phrase
	passphrase?: string; // Optional BIP39 passphrase
	proxy?: SocksProxyAgentOptions; // SOCKS proxy configuration
	debug?: boolean; // Enable debug logging
}

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Run tests and linting
  6. Submit a pull request

Development Setup

# Clone the repository
git clone https://github.com/amirulnubitel/coinlib-sdk.git
cd coinlib-sdk

# Install PNPM Global
npm install -g pnpm

# Install dependencies
pnpm install

# Build the project
pnpm run build

# Run tests
pnpm test

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support


⚠️ Security Notice: This library handles private keys and sensitive cryptographic material. Always follow security best practices and never expose private keys or mnemonics in production environments.