cooller458-wallet-npm-package
v1.31.0
Published
Crypto wallet generator CLI tool
Downloads
24
Maintainers
Keywords
Readme
CryptoWallet Library
This library enables interaction with various cryptocurrency wallets, providing functionalities like wallet generation, transaction signing, and more, adapted for use within Node.js applications.
Installation
npm install cooller458-wallet-npm-package
Usage Examples
Below are examples demonstrating how to use this library to perform various wallet operations:
const { Wallet, utils } = require('cooller458-wallet-npm-package');
// Generate a random EVM-compatible wallet (Ethereum, Polygon, etc.)
const evmWallet = new Wallet('eth');
console.log(evmWallet.generate());
// Generate a random Bitcoin wallet (default format: bech32)
const btcWallet = new Wallet('btc');
console.log(btcWallet.generate());
// Generate a random mnemonic string (12 words) and generate a wallet from it
const mnemonic = utils.generateMnemonic(12);
const walletFromMnemonic = new Wallet('eth');
console.log(walletFromMnemonic.fromMnemonic(mnemonic));
// Generate multiple wallets
const wallets = [];
for (let i = 0; i < 10; i++) {
wallets.push(new Wallet('eth').generate());
}
console.log(wallets);
// Advanced Usage: Generate a wallet with specific requirements
const btcWalletCustom = new Wallet('btc', { prefix: 'abc', format: 'bech32' });
console.log(btcWalletCustom.generate());
Supported Features and Operations
- Generate wallets for EVM-compatible chains like Ethereum, Polygon, etc.
- Generate Bitcoin wallets with various formats: legacy, segwit, bech32, taproot.
- Create wallets from mnemonic phrases.
- Advanced wallet creation with desired prefixes or suffixes.
- Export wallet details into a CSV file.
Generating Wallets with Specific Parameters
// Generate a wallet with a desired prefix (case-sensitive option available)
const walletWithPrefix = new Wallet('btc', { prefix: 'abc' });
console.log(walletWithPrefix.generate());
// Generate wallets from a mnemonic with specific formats and save them to a CSV
const mnemonic = "radio bright pizza pluck family crawl palm flame forget focus stock stadium";
const btcWalletBech32 = new Wallet('btc', { format: 'bech32' });
console.log(btcWalletBech32.fromMnemonic(mnemonic));
// Output to CSV example (Node.js doesn't support command line options like `-D` directly)
const fs = require('fs');
const csvData = wallets.map(w => `${w.address},${w.privateKey}`).join('\n');
fs.writeFileSync('output.csv', csvData);
Supported Blockchains
- EVM (Ethereum, Polygon, Arbitrum, Optimism, etc.)
- BTC (Bitcoin) [legacy, segwit, bech32, taproot]
- BNB (Binance Coin) [BEP2, BEP20]
- And many others...
For a complete list of supported blockchains and more detailed examples of each functionality, please refer to the comprehensive API documentation included with the package.
Contributing
Contributions to the library are welcome. Please refer to the CONTRIBUTING.md file for guidelines.
License
This project is licensed under the MIT License. See the LICENSE file for more details.