BTC-MiniKeyTools
BTC-MiniKeyTools is a robust tool for working with Bitcoin Mini private keys. It provides validation, key generation, and conversion functionalities, including HEX and Wallet Import Format (WIF) keys. Fully equipped with CLI support and logging options, it's designed for Bitcoin developers and enthusiasts alike.
Table of Contents
- Features
- Requirements
- Installation
- Usage
- Documentation
- Project Link
- NPM Package
- Tests
- Security
- License
Features
-
Validation of Bitcoin Mini private keys Ensures the MiniKey follows the proper format. Example:
S6c56bnXQiBjk9mqSYE7ykVQ7NzrRy
-
Conversion to HEX private keys Converts a valid MiniKey to its 64-character HEX representation. Example:
0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D
-
Conversion to Wallet Import Format (WIF) Generates WIF keys for mainnet and testnet, supporting compressed and uncompressed keys. Example:
5HueCGU8rMjxEXxiPuD5BDu3qa8N1P2Sr2jXZbNmi4xzFqJMPtj
-
Key Generation Randomly generates valid 30-character MiniKeys. Example:
S1LgfDWujrsGfSbvGfTHbZn5yCFCv4
-
Logging to Console and File Logs are written to the console and to the
app.log
file in the project directory. Use the--verbose
and--quiet
options to adjust log verbosity.
Requirements
- Node.js: Version 20.11.1 (specified in
.nvmrc
orpackage.json
underengines
). - Dependencies: Refer to the
package.json
file for required modules.
Installation
To install dependencies for local use:
npm install btc-minikeytools
To install globally as a CLI tool:
npm install -g btc-minikeytools
After installation, use the CLI anywhere:
btc-minikeytools process S6c56bnXQiBjk9mqSYE7ykVQ7NzrRy
Usage
CLI Commands
-
Generate a MiniKey
btc-minikeytools generate
-
Validate a MiniKey
btc-minikeytools validate S6c56bnXQiBjk9mqSYE7ykVQ7NzrRy
-
Convert a MiniKey to HEX
btc-minikeytools to-hex S6c56bnXQiBjk9mqSYE7ykVQ7NzrRy
-
Convert HEX to WIF Generate mainnet WIF:
btc-minikeytools to-wif 4C7A9640C72DC2099F23715D0C8A0D8A35F8906E3CAB61DD3F78B67BF887C9AB
Generate testnet WIF:
btc-minikeytools to-wif 4C7A9640C72DC2099F23715D0C8A0D8A35F8906E3CAB61DD3F78B67BF887C9AB --testnet
Generate compressed WIF:
btc-minikeytools to-wif 4C7A9640C72DC2099F23715D0C8A0D8A35F8906E3CAB61DD3F78B67BF887C9AB --compressed
-
Full Workflow: Validate, Convert to HEX, and WIF
btc-minikeytools process S6c56bnXQiBjk9mqSYE7ykVQ7NzrRy
Log Level Options
- Default: Logs general information (
info
level). - Verbose Mode: Add
--verbose
to display detailed logs (debug
level). - Quiet Mode: Add
--quiet
to suppress all logs except errors (error
level).
Example:
btc-minikeytools process S6c56bnXQiBjk9mqSYE7ykVQ7NzrRy --verbose
Basic Example
const MiniKeyConverter = require('btc-minikeytools');
const converter = new MiniKeyConverter();
// Validate Bitcoin MiniKey
const miniKey = 'S6c56bnXQiBjk9mqSYE7ykVQ7NzrRy';
console.log(`Is valid: \${converter.check(miniKey)}`);
// Generate a new MiniKey
const generatedMiniKey = converter.generateMiniKey();
console.log(`Generated MiniKey: \${generatedMiniKey}`);
Documentation
The complete documentation is available here.
Project Link
Find the full project on GitHub: BTC-MiniKeyTools.
NPM Package
Install or view the package on NPM: btc-minikeytools.
Tests
Run the test suite to ensure everything works correctly:
npm test
Security
- This tool processes private keys and generates sensitive outputs (e.g., WIF keys). Handle all inputs and outputs securely.
- Avoid running the tool on untrusted systems or sharing private keys.
- Logs may contain private keys when using
--verbose
. Consider clearing theapp.log
file after use if this is a concern.
License
This project is licensed under the MIT License. See the LICENSE
file for details.