UNPKG

j-bitcoin

Version:

Comprehensive JavaScript cryptocurrency wallet library for Bitcoin (BTC), Bitcoin Cash (BCH), and Bitcoin SV (BSV) with custodial and non-custodial wallet support, threshold signatures, and multiple address formats

2,330 lines (1,095 loc) โ€ข 56 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Home</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Home</h1> <h3>j-bitcoin 1.0.0</h3> <section> <article><h1 id="j-bitcoin">J-Bitcoin</h1> <p><a href="https://badge.fury.io/js/j-bitcoin"><img src="https://badge.fury.io/js/j-bitcoin.svg" alt="npm version"></a> <a href="https://opensource.org/licenses/ISC"><img src="https://img.shields.io/badge/License-ISC-blue.svg" alt="License: ISC"></a> <a href="https://nodejs.org/"><img src="https://img.shields.io/badge/Node.js-18%2B-green.svg" alt="Node.js"></a> <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-Ready-blue.svg" alt="TypeScript"></a> <a href="https://jsdoc.app/"><img src="https://img.shields.io/badge/JSDoc-Complete-brightgreen.svg" alt="JSDoc"></a></p> <p>A comprehensive JavaScript/TypeScript cryptocurrency wallet library supporting both custodial and non-custodial wallets for Bitcoin (BTC), Bitcoin Cash (BCH), and Bitcoin SV (BSV).</p> <h2 id="%F0%9F%9A%80-features">๐Ÿš€ Features</h2> <h3 id="%F0%9F%92%BC-wallet-types">๐Ÿ’ผ Wallet Types</h3> <ul> <li><strong>Custodial Wallets</strong> - Traditional single-key wallets with HD derivation</li> <li><strong>Non-Custodial Wallets</strong> - Advanced threshold signature schemes (TSS)</li> </ul> <h3 id="%F0%9F%94%90-cryptographic-standards">๐Ÿ” Cryptographic Standards</h3> <ul> <li><strong>BIP32</strong> - Hierarchical Deterministic Wallets</li> <li><strong>BIP39</strong> - Mnemonic Seed Phrases (12-word)</li> <li><strong>ECDSA</strong> - Standard Bitcoin signatures</li> <li><strong>Schnorr</strong> - Modern signature scheme (BIP340)</li> <li><strong>Threshold Signatures</strong> - Multi-party signature generation</li> </ul> <h3 id="%F0%9F%8F%A0-address-formats">๐Ÿ  Address Formats</h3> <ul> <li><strong>Legacy</strong> - P2PKH addresses (1...)</li> <li><strong>SegWit</strong> - Bech32 addresses (bc1...)</li> <li><strong>CashAddr</strong> - Bitcoin Cash format</li> </ul> <h3 id="%F0%9F%8C%90-network-support">๐ŸŒ Network Support</h3> <ul> <li>Bitcoin (BTC) - Mainnet &amp; Testnet</li> <li>Bitcoin Cash (BCH) - Mainnet &amp; Testnet</li> <li>Bitcoin SV (BSV) - Mainnet &amp; Testnet</li> </ul> <h3 id="%F0%9F%93%9D-developer-experience">๐Ÿ“ Developer Experience</h3> <ul> <li><strong>Full TypeScript Support</strong> - Complete type definitions with IntelliSense</li> <li><strong>Comprehensive JSDoc</strong> - Rich inline documentation</li> <li><strong>ES Modules</strong> - Modern JavaScript module support</li> <li><strong>Tree Shaking</strong> - Import only what you need</li> </ul> <h2 id="%F0%9F%93%A6-installation">๐Ÿ“ฆ Installation</h2> <pre class="prettyprint source lang-bash"><code>npm install j-bitcoin </code></pre> <h2 id="%F0%9F%8E%AF-quick-start">๐ŸŽฏ Quick Start</h2> <h3 id="javascript">JavaScript</h3> <pre class="prettyprint source lang-javascript"><code>import { Custodial_Wallet } from 'j-bitcoin'; // Generate new wallet const [mnemonic, wallet] = Custodial_Wallet.fromRandom('main'); console.log('Mnemonic:', mnemonic); console.log('Address:', wallet.address); // Sign a message const [signature, recoveryId] = wallet.sign(&quot;Hello Bitcoin!&quot;); console.log('Signature valid:', wallet.verify(signature, &quot;Hello Bitcoin!&quot;)); </code></pre> <h3 id="typescript">TypeScript</h3> <pre class="prettyprint source lang-typescript"><code>import { Custodial_Wallet, ECDSASignatureResult } from 'j-bitcoin'; // Generate new wallet with full type safety const [mnemonic, wallet]: [string, Custodial_Wallet] = Custodial_Wallet.fromRandom('main'); // TypeScript knows the exact return types const [signature, recoveryId]: ECDSASignatureResult = wallet.sign(&quot;Hello Bitcoin!&quot;); const isValid: boolean = wallet.verify(signature, &quot;Hello Bitcoin!&quot;); </code></pre> <h3 id="advanced-threshold-signatures">Advanced Threshold Signatures</h3> <p><strong>JavaScript:</strong></p> <pre class="prettyprint source lang-javascript"><code>import { Non_Custodial_Wallet } from 'j-bitcoin'; // Create 2-of-3 threshold wallet const wallet = Non_Custodial_Wallet.fromRandom(&quot;main&quot;, 3, 2); // Get shares for distribution const shares = wallet._shares; console.log('Distribute shares to participants:', shares); // Generate threshold signature const signature = wallet.sign(&quot;Multi-party transaction&quot;); console.log('Threshold signature:', signature.serialized_sig); </code></pre> <p><strong>TypeScript:</strong></p> <pre class="prettyprint source lang-typescript"><code>import { Non_Custodial_Wallet, ThresholdSignatureResult } from 'j-bitcoin'; // Create 2-of-3 threshold wallet const wallet: Non_Custodial_Wallet = Non_Custodial_Wallet.fromRandom(&quot;main&quot;, 3, 2); // Get shares for distribution const shares: string[] = wallet._shares; console.log('Distribute shares to participants:', shares); // Generate threshold signature const signature: ThresholdSignatureResult = wallet.sign(&quot;Multi-party transaction&quot;); console.log('Threshold signature:', signature.serialized_sig); </code></pre> <h3 id="address-conversion">Address Conversion</h3> <p><strong>JavaScript:</strong></p> <pre class="prettyprint source lang-javascript"><code>import { BECH32, CASH_ADDR } from 'j-bitcoin'; const legacyAddress = &quot;1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2&quot;; // Convert to SegWit const segwitAddr = BECH32.to_P2WPKH(legacyAddress); console.log('SegWit:', segwitAddr); // Output: bc1qhkfq3zahaqkkzx5mjnamwjsfpw3tvke7v6aaph // Convert to CashAddr const cashAddr = CASH_ADDR.to_cashAddr(legacyAddress, &quot;p2pkh&quot;); console.log('CashAddr:', cashAddr); // Output: bitcoincash:qztxx64w20kmy5y9sskjwtgxp3j8dc20ksvef26ssu </code></pre> <p><strong>TypeScript:</strong></p> <pre class="prettyprint source lang-typescript"><code>import { BECH32, CASH_ADDR } from 'j-bitcoin'; const legacyAddress: string = &quot;1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2&quot;; // Convert to SegWit const segwitAddr: string = BECH32.to_P2WPKH(legacyAddress); console.log('SegWit:', segwitAddr); // Output: bc1qhkfq3zahaqkkzx5mjnamwjsfpw3tvke7v6aaph // Convert to CashAddr const cashAddr: string = CASH_ADDR.to_cashAddr(legacyAddress, &quot;p2pkh&quot;); console.log('CashAddr:', cashAddr); // Output: bitcoincash:qztxx64w20kmy5y9sskjwtgxp3j8dc20ksvef26ssu </code></pre> <h3 id="schnorr-signatures">Schnorr Signatures</h3> <p><strong>JavaScript:</strong></p> <pre class="prettyprint source lang-javascript"><code>import { schnorr_sig } from 'j-bitcoin'; const privateKey = &quot;L1vHfV6GUbMJSvFaqjnButzwq5x4ThdFaotpUgsfScwMNKjdGVuS&quot;; const message = &quot;Hello Schnorr!&quot;; // Sign with Schnorr const signature = schnorr_sig.sign(privateKey, message); // Get public key const publicKey = schnorr_sig.retrieve_public_key(privateKey); // Verify signature const isValid = schnorr_sig.verify(signature, message, publicKey); console.log('Schnorr signature valid:', isValid); </code></pre> <p><strong>TypeScript:</strong></p> <pre class="prettyprint source lang-typescript"><code>import { schnorr_sig } from 'j-bitcoin'; const privateKey: string = &quot;L1vHfV6GUbMJSvFaqjnButzwq5x4ThdFaotpUgsfScwMNKjdGVuS&quot;; const message: string = &quot;Hello Schnorr!&quot;; // Sign with Schnorr const signature: Uint8Array = schnorr_sig.sign(privateKey, message); // Get public key const publicKey: Uint8Array = schnorr_sig.retrieve_public_key(privateKey); // Verify signature const isValid: boolean = schnorr_sig.verify(signature, message, publicKey); console.log('Schnorr signature valid:', isValid); </code></pre> <h2 id="%F0%9F%93%96-api-documentation">๐Ÿ“– API Documentation</h2> <h3 id="typescript-support">TypeScript Support</h3> <p>J-Bitcoin provides complete TypeScript definitions with:</p> <pre class="prettyprint source lang-typescript"><code>// Full IntelliSense support import type { Custodial_Wallet, Non_Custodial_Wallet, ECDSASignatureResult, ThresholdSignatureResult, HDKeys, KeyPair, NetworkType } from 'j-bitcoin'; // Type-safe network specification const network: NetworkType = 'main'; // 'main' | 'test' // Strongly typed wallet creation const wallet: Custodial_Wallet = Custodial_Wallet.fromRandom(network); // Comprehensive interface definitions interface ThresholdSignatureResult { sig: { r: bigint; s: bigint; }; serialized_sig: string; msgHash: Buffer; recovery_id: number; } </code></pre> <h3 id="custodial_wallet">Custodial_Wallet</h3> <table> <thead> <tr> <th>Method</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>fromRandom(net, passphrase?)</code></td> <td>Generate new random wallet</td> </tr> <tr> <td><code>fromMnemonic(net, mnemonic, passphrase?)</code></td> <td>Import from mnemonic</td> </tr> <tr> <td><code>fromSeed(net, seed)</code></td> <td>Create from hex seed</td> </tr> <tr> <td><code>derive(path, keyType)</code></td> <td>Derive child keys</td> </tr> <tr> <td><code>sign(message)</code></td> <td>Sign with ECDSA</td> </tr> <tr> <td><code>verify(sig, message)</code></td> <td>Verify signature</td> </tr> </tbody> </table> <h3 id="non_custodial_wallet">Non_Custodial_Wallet</h3> <table> <thead> <tr> <th>Method</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>fromRandom(net, groupSize, threshold)</code></td> <td>Create threshold wallet</td> </tr> <tr> <td><code>fromShares(net, shares, threshold)</code></td> <td>Reconstruct from shares</td> </tr> <tr> <td><code>sign(message)</code></td> <td>Generate threshold signature</td> </tr> <tr> <td><code>verify(sig, msgHash)</code></td> <td>Verify threshold signature</td> </tr> <tr> <td><code>_shares</code></td> <td>Get secret shares</td> </tr> <tr> <td><code>_privateKey</code></td> <td>Get reconstructed private key</td> </tr> </tbody> </table> <h3 id="address-utilities">Address Utilities</h3> <table> <thead> <tr> <th>Function</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>BECH32.to_P2WPKH(address)</code></td> <td>Convert to SegWit</td> </tr> <tr> <td><code>BECH32.data_to_bech32(prefix, data, encoding)</code></td> <td>Custom Bech32 encoding</td> </tr> <tr> <td><code>CASH_ADDR.to_cashAddr(address, type?)</code></td> <td>Convert to CashAddr</td> </tr> </tbody> </table> <h2 id="%F0%9F%94%97-bip32-key-derivation">๐Ÿ”— BIP32 Key Derivation</h2> <p><strong>JavaScript:</strong></p> <pre class="prettyprint source lang-javascript"><code>// Standard BIP44 paths wallet.derive(&quot;m/44'/0'/0'/0/0&quot;); // Bitcoin account 0, address 0 wallet.derive(&quot;m/44'/145'/0'/0/0&quot;); // Bitcoin Cash account 0 wallet.derive(&quot;m/44'/236'/0'/0/0&quot;); // Bitcoin SV account 0 // Custom derivation wallet.derive(&quot;m/0'/1'/2&quot;); // Hardened path wallet.derive(&quot;m/0/1/2&quot;); // Non-hardened path </code></pre> <p><strong>TypeScript:</strong></p> <pre class="prettyprint source lang-typescript"><code>import { Custodial_Wallet, KeyType } from 'j-bitcoin'; // Standard BIP44 paths with type safety wallet.derive(&quot;m/44'/0'/0'/0/0&quot;, 'pri' as KeyType); // Bitcoin account 0, address 0 wallet.derive(&quot;m/44'/145'/0'/0/0&quot;, 'pri' as KeyType); // Bitcoin Cash account 0 wallet.derive(&quot;m/44'/236'/0'/0/0&quot;, 'pri' as KeyType); // Bitcoin SV account 0 // Custom derivation with type checking wallet.derive(&quot;m/0'/1'/2&quot;, 'pri' as KeyType); // Hardened path wallet.derive(&quot;m/0/1/2&quot;, 'pub' as KeyType); // Non-hardened path (public key derivation) </code></pre> <h2 id="%F0%9F%9B%A1%EF%B8%8F-security-features">๐Ÿ›ก๏ธ Security Features</h2> <ul> <li><strong>Secure Random Generation</strong> - Uses Node.js crypto.randomBytes()</li> <li><strong>Mnemonic Validation</strong> - BIP39 checksum verification</li> <li><strong>Threshold Security</strong> - Distributed key management</li> <li><strong>Multiple Signature Schemes</strong> - ECDSA, Schnorr, TSS</li> <li><strong>Address Validation</strong> - Built-in format checking</li> </ul> <h2 id="%F0%9F%8E%9B%EF%B8%8F-advanced-examples">๐ŸŽ›๏ธ Advanced Examples</h2> <h3 id="typescript-multi-signature-escrow">TypeScript Multi-Signature Escrow</h3> <p><strong>JavaScript:</strong></p> <pre class="prettyprint source lang-javascript"><code>import { Non_Custodial_Wallet } from 'j-bitcoin'; // 2-of-3 escrow: buyer, seller, arbiter const escrow = Non_Custodial_Wallet.fromRandom(&quot;main&quot;, 3, 2); const [buyerShare, sellerShare, arbiterShare] = escrow._shares; // Buyer + Seller can release funds const release = Non_Custodial_Wallet.fromShares(&quot;main&quot;, [buyerShare, sellerShare], 2); // Disputes require arbiter const dispute = Non_Custodial_Wallet.fromShares(&quot;main&quot;, [buyerShare, arbiterShare], 2); </code></pre> <p><strong>TypeScript:</strong></p> <pre class="prettyprint source lang-typescript"><code>import { Non_Custodial_Wallet } from 'j-bitcoin'; // 2-of-3 escrow: buyer, seller, arbiter const escrow: Non_Custodial_Wallet = Non_Custodial_Wallet.fromRandom(&quot;main&quot;, 3, 2); const [buyerShare, sellerShare, arbiterShare]: string[] = escrow._shares; // Buyer + Seller can release funds const release: Non_Custodial_Wallet = Non_Custodial_Wallet.fromShares(&quot;main&quot;, [buyerShare, sellerShare], 2); // Disputes require arbiter const dispute: Non_Custodial_Wallet = Non_Custodial_Wallet.fromShares(&quot;main&quot;, [buyerShare, arbiterShare], 2); </code></pre> <h3 id="corporate-treasury">Corporate Treasury</h3> <p><strong>JavaScript:</strong></p> <pre class="prettyprint source lang-javascript"><code>import { Non_Custodial_Wallet } from 'j-bitcoin'; // 3-of-5 corporate signature const treasury = Non_Custodial_Wallet.fromRandom(&quot;main&quot;, 5, 3); const executiveShares = treasury._shares; // Any 3 executives can authorize const authorization = Non_Custodial_Wallet.fromShares(&quot;main&quot;, [executiveShares[0], executiveShares[2], executiveShares[4]], 3); // Generate authorization signature const authSignature = authorization.sign(&quot;Transfer $1M to operations&quot;); </code></pre> <p><strong>TypeScript:</strong></p> <pre class="prettyprint source lang-typescript"><code>import { Non_Custodial_Wallet, ThresholdSignatureResult } from 'j-bitcoin'; // 3-of-5 corporate signature const treasury: Non_Custodial_Wallet = Non_Custodial_Wallet.fromRandom(&quot;main&quot;, 5, 3); const executiveShares: string[] = treasury._shares; // Any 3 executives can authorize const authorization: Non_Custodial_Wallet = Non_Custodial_Wallet.fromShares(&quot;main&quot;, [executiveShares[0], executiveShares[2], executiveShares[4]], 3); // Type-safe signature generation const authSignature: ThresholdSignatureResult = authorization.sign(&quot;Transfer $1M to operations&quot;); </code></pre> <h3 id="cross-platform-wallet">Cross-Platform Wallet</h3> <p><strong>JavaScript:</strong></p> <pre class="prettyprint source lang-javascript"><code>import { Custodial_Wallet } from 'j-bitcoin'; // Generate with passphrase const [mnemonic, wallet] = Custodial_Wallet.fromRandom('main', 'secure-pass'); // Reconstruct anywhere const restored = Custodial_Wallet.fromMnemonic('main', mnemonic, 'secure-pass'); // Derive for different coins restored.derive(&quot;m/44'/0'/0'/0/0&quot;); // Bitcoin restored.derive(&quot;m/44'/145'/0'/0/0&quot;); // Bitcoin Cash restored.derive(&quot;m/44'/236'/0'/0/0&quot;); // Bitcoin SV </code></pre> <p><strong>TypeScript:</strong></p> <pre class="prettyprint source lang-typescript"><code>import { Custodial_Wallet, NetworkType } from 'j-bitcoin'; // Type-safe network specification const network: NetworkType = 'main'; // Generate with passphrase const [mnemonic, wallet]: [string, Custodial_Wallet] = Custodial_Wallet.fromRandom(network, 'secure-pass'); // Reconstruct anywhere with type safety const restored: Custodial_Wallet = Custodial_Wallet.fromMnemonic(network, mnemonic, 'secure-pass'); // Derive for different coins restored.derive(&quot;m/44'/0'/0'/0/0&quot;); // Bitcoin restored.derive(&quot;m/44'/145'/0'/0/0&quot;); // Bitcoin Cash restored.derive(&quot;m/44'/236'/0'/0/0&quot;); // Bitcoin SV </code></pre> <h2 id="%F0%9F%93%8A-feature-matrix">๐Ÿ“Š Feature Matrix</h2> <table> <thead> <tr> <th>Feature</th> <th>Support</th> <th>TypeScript</th> </tr> </thead> <tbody> <tr> <td>Hierarchical Deterministic</td> <td>โœ…</td> <td>โœ… Full types</td> </tr> <tr> <td>Threshold Signatures</td> <td>โœ…</td> <td>โœ… Complete interfaces</td> </tr> <tr> <td>ECDSA Signatures</td> <td>โœ…</td> <td>โœ… Type-safe returns</td> </tr> <tr> <td>Schnorr Signatures</td> <td>โœ…</td> <td>โœ… BIP340 types</td> </tr> <tr> <td>P2PKH Addresses</td> <td>โœ…</td> <td>โœ… Network types</td> </tr> <tr> <td>P2WPKH (SegWit)</td> <td>โœ…</td> <td>โœ… Bech32 types</td> </tr> <tr> <td>CashAddr Format</td> <td>โœ…</td> <td>โœ… Format types</td> </tr> <tr> <td>P2SH Addresses</td> <td>โŒ</td> <td>๐Ÿ”„ Planned</td> </tr> <tr> <td>P2WSH (SegWit v1)</td> <td>โŒ</td> <td>๐Ÿ”„ Planned</td> </tr> <tr> <td>Transaction Building</td> <td>โŒ</td> <td>๐Ÿ”„ Planned</td> </tr> <tr> <td>SPV Validation</td> <td>โŒ</td> <td>๐Ÿ”„ Planned</td> </tr> </tbody> </table> <h2 id="%F0%9F%94%A7-dependencies">๐Ÿ”ง Dependencies</h2> <pre class="prettyprint source lang-json"><code>{ &quot;@noble/curves&quot;: &quot;^1.9.1&quot;, &quot;base58-js&quot;: &quot;^1.0.4&quot;, &quot;bigint-conversion&quot;: &quot;^2.4.0&quot;, &quot;bn.js&quot;: &quot;^5.2.1&quot; } </code></pre> <h2 id="%F0%9F%A7%AA-testing">๐Ÿงช Testing</h2> <pre class="prettyprint source lang-bash"><code># Run all tests npm test # Run tests with coverage npm run test:coverage # Run tests in watch mode npm run test:watch </code></pre> <h2 id="%F0%9F%93%9D-documentation">๐Ÿ“ Documentation</h2> <h3 id="typescript-intellisense">TypeScript IntelliSense</h3> <p>Experience world-class developer productivity:</p> <pre class="prettyprint source lang-typescript"><code>// VS Code, WebStorm, and other IDEs provide: // โœ… Complete autocomplete for all methods // โœ… Inline parameter documentation // โœ… Return type information // โœ… Error detection at compile time const wallet = Custodial_Wallet.fromRandom('main'); // ^-- IDE shows: [string, Custodial_Wallet] wallet.derive(&quot;m/44'/0'/0'/0/0&quot;, 'pri'); // ^-- IDE shows available parameters and types </code></pre> <h3 id="generate-api-documentation">Generate API Documentation</h3> <pre class="prettyprint source lang-bash"><code>npm install -g jsdoc npm run docs </code></pre> <p>View comprehensive documentation in <code>docs/index.html</code> with:</p> <ul> <li><strong>Complete API reference</strong> with examples</li> <li><strong>TypeScript integration guide</strong></li> <li><strong>Security best practices</strong></li> <li><strong>Advanced usage patterns</strong></li> </ul> <h2 id="%F0%9F%94%92-security-best-practices">๐Ÿ”’ Security Best Practices</h2> <h3 id="key-management">Key Management</h3> <ul> <li><strong>Secure Backup</strong>: Store mnemonic phrases in secure, offline locations</li> <li><strong>Share Distribution</strong>: Use encrypted channels for threshold share distribution</li> <li><strong>Access Control</strong>: Implement proper authentication for wallet operations</li> <li><strong>Regular Rotation</strong>: Consider periodic key rotation for long-term security</li> </ul> <h3 id="development">Development</h3> <ul> <li><strong>Input Validation</strong>: Always validate addresses and amounts before operations</li> <li><strong>Error Handling</strong>: Implement comprehensive error handling for all operations</li> <li><strong>Testing</strong>: Test thoroughly on testnet before mainnet deployment</li> <li><strong>Auditing</strong>: Maintain audit trails for all cryptographic operations</li> </ul> <h3 id="production-deployment">Production Deployment</h3> <ul> <li><strong>Environment Separation</strong>: Keep development and production environments isolated</li> <li><strong>Monitoring</strong>: Implement monitoring for wallet operations and security events</li> <li><strong>Backup Procedures</strong>: Establish reliable backup and recovery procedures</li> <li><strong>Incident Response</strong>: Have plans for handling security incidents</li> </ul> <h2 id="%F0%9F%A4%9D-contributing">๐Ÿค Contributing</h2> <ol> <li>Fork the repository</li> <li>Create feature branch (<code>git checkout -b feature/amazing-feature</code>)</li> <li>Commit changes (<code>git commit -m 'Add amazing feature'</code>)</li> <li>Push to branch (<code>git push origin feature/amazing-feature</code>)</li> <li>Open Pull Request</li> </ol> <h3 id="development-setup">Development Setup</h3> <pre class="prettyprint source lang-bash"><code># Clone and install dependencies git clone https://github.com/yfbsei/J-Bitcoin.git cd J-Bitcoin npm install # Run development commands npm run lint # Check code style npm run format # Format code npm run test # Run tests npm run docs # Generate documentation </code></pre> <h2 id="%F0%9F%93%9C-license">๐Ÿ“œ License</h2> <p>ISC License - see <a href="LICENSE">LICENSE</a> file for details.</p> <h2 id="%F0%9F%99%8F-acknowledgments">๐Ÿ™ Acknowledgments</h2> <ul> <li><strong>BIP Authors</strong> - For Bitcoin Improvement Proposals</li> <li><strong>Bitcoin Core</strong> - Reference implementation</li> <li><strong>Noble Crypto</strong> - Excellent secp256k1 library</li> <li><strong>Bitcoin Community</strong> - Continuous innovation</li> </ul> <h2 id="%F0%9F%93%9E-support">๐Ÿ“ž Support</h2> <ul> <li><strong>Issues</strong>: <a href="https://github.com/yfbsei/J-Bitcoin/issues">GitHub Issues</a></li> <li><strong>Documentation</strong>: <a href="https://github.com/yfbsei/J-Bitcoin/docs">API Docs</a></li> <li><strong>Examples</strong>: <a href="https://github.com/yfbsei/J-Bitcoin/examples">Examples Directory</a></li> </ul> <h2 id="%F0%9F%94%AE-roadmap">๐Ÿ”ฎ Roadmap</h2> <h3 id="short-term-(q2-2025)">Short Term (Q2 2025)</h3> <ul> <li>[ ] P2SH and P2WSH address support with TypeScript definitions</li> <li>[ ] Enhanced error handling and validation</li> <li>[ ] Performance optimizations for threshold operations</li> <li>[ ] Additional test coverage for edge cases</li> </ul> <h3 id="medium-term-(q3-q4-2025)">Medium Term (Q3-Q4 2025)</h3> <ul> <li>[ ] Transaction building and broadcasting with type-safe interfaces</li> <li>[ ] SPV wallet implementation with comprehensive types</li> <li>[ ] Hardware wallet integration with device-specific types</li> <li>[ ] Advanced script templates with template types</li> </ul> <h3 id="long-term-(2026%2B)">Long Term (2026+)</h3> <ul> <li>[ ] Lightning Network support with protocol types</li> <li>[ ] React/Vue component library with prop types</li> <li>[ ] WebAssembly optimization with typed bindings</li> <li>[ ] Cross-chain interoperability features</li> </ul> <h2 id="%F0%9F%8F%86-why-choose-j-bitcoin%3F">๐Ÿ† Why Choose J-Bitcoin?</h2> <h3 id="for-developers">For Developers</h3> <ul> <li><strong>TypeScript First</strong>: Built with TypeScript developers in mind</li> <li><strong>Modern Architecture</strong>: ES modules, tree shaking, and modern JavaScript</li> <li><strong>Comprehensive Documentation</strong>: Every function documented with examples</li> <li><strong>Developer Experience</strong>: IntelliSense, autocomplete, and type safety</li> </ul> <h3 id="for-enterprises">For Enterprises</h3> <ul> <li><strong>Threshold Security</strong>: Advanced multi-party control for corporate treasuries</li> <li><strong>Compliance Ready</strong>: Audit trails and multi-signature requirements</li> <li><strong>Battle Tested</strong>: Based on proven cryptographic standards</li> <li><strong>Professional Support</strong>: Enterprise-grade reliability and support</li> </ul> <h3 id="for-researchers">For Researchers</h3> <ul> <li><strong>Academic Standards</strong>: Implements latest cryptographic research</li> <li><strong>Extensible Design</strong>: Easy to extend with new algorithms</li> <li><strong>Reference Implementation</strong>: Well-documented algorithms for study</li> <li><strong>Open Source</strong>: Transparent implementation for peer review</li> </ul> <hr> <p><strong>โš ๏ธ Security Notice</strong>: This library handles private keys and should be used with appropriate security measures. Always verify implementations in test environments before production use.</p> <p><strong>Built with โค๏ธ for the Bitcoin ecosystem and TypeScript developers</strong></p></article> </section> <section> <header> <h2>index.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>Main entry point for J-Bitcoin cryptocurrency library</p> <p>J-Bitcoin is a comprehensive JavaScript library for Bitcoin, Bitcoin Cash, and Bitcoin SV that provides both custodial and non-custodial wallet functionality with advanced cryptographic features including threshold signatures and hierarchical deterministic keys.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-license">License:</dt> <dd class="tag-license"><ul class="dummy"><li>ISC</li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://github.com/yfbsei/J-Bitcoin">GitHub Repository</a></li> </ul> </dd> </dl> <h3>Example</h3> <pre class="prettyprint"><code>// Import main wallet classes import { Custodial_Wallet, Non_Custodial_Wallet } from 'j-bitcoin'; // Import address utilities import { CASH_ADDR, BECH32 } from 'j-bitcoin'; // Import signature utilities import { schnorr_sig, ecdsa } from 'j-bitcoin';</code></pre> </div> </article> </section> <section> <header> <h2>src/BIP32/derive.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>BIP32 hierarchical deterministic key derivation</p> <p>This module implements child key derivation according to BIP32 specification, enabling the generation of a tree of cryptographic keys from a single master key. It supports both hardened and non-hardened derivation with proper validation and mathematical operations over the secp256k1 elliptic curve.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_BIP32_derive.js.html">src/BIP32/derive.js</a>, <a href="src_BIP32_derive.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki">BIP32 - Hierarchical Deterministic Wallets</a></li> <li><a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki">BIP44 - Multi-Account Hierarchy for Deterministic Wallets</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/BIP32/fromSeed.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>BIP32 master key generation from seed</p> <p>This module implements the BIP32 specification for generating master private and public keys from a cryptographic seed. It creates the root of the hierarchical deterministic key tree that can be used to derive all subsequent child keys deterministically.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_BIP32_fromSeed.js.html">src/BIP32/fromSeed.js</a>, <a href="src_BIP32_fromSeed.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki">BIP32 - Hierarchical Deterministic Wallets</a></li> <li><a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki">BIP39 - Mnemonic code for generating deterministic keys</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/BIP39/bip39.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>BIP39 implementation for mnemonic phrase generation and seed derivation</p> <p>This module implements the BIP39 specification for generating deterministic keys from mnemonic phrases. It supports 12-word mnemonics with checksum validation and PBKDF2-based seed generation with optional passphrases.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_BIP39_bip39.js.html">src/BIP39/bip39.js</a>, <a href="src_BIP39_bip39.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki">BIP39 Specification</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/ECDSA/ecdsa.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>ECDSA (Elliptic Curve Digital Signature Algorithm) implementation</p> <p>This module provides ECDSA signature generation and verification using the secp256k1 elliptic curve, which is the standard curve used in Bitcoin. It includes functionality for signing messages, verifying signatures, and recovering public keys from signatures.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_ECDSA_ecdsa.js.html">src/ECDSA/ecdsa.js</a>, <a href="src_ECDSA_ecdsa.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://en.bitcoin.it/wiki/Elliptic_Curve_Digital_Signature_Algorithm">ECDSA on Bitcoin Wiki</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/Schnorr-signature/Schnorr_Signature.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>Schnorr signature implementation for Bitcoin (BIP340)</p> <p>This module implements Schnorr signatures according to BIP340 specification, providing a more efficient and privacy-friendly alternative to ECDSA. Schnorr signatures enable key aggregation, signature aggregation, and improved multi-signature schemes.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_Schnorr-signature_Schnorr_Signature.js.html">src/Schnorr-signature/Schnorr_Signature.js</a>, <a href="src_Schnorr-signature_Schnorr_Signature.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki">BIP340 - Schnorr Signatures for secp256k1</a></li> <li><a href="https://github.com/bitcoin-core/secp256k1/blob/master/include/secp256k1_schnorrsig.h">libsecp256k1 Schnorr API</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/Threshold-signature/Polynomial.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>Polynomial operations for cryptographic secret sharing schemes</p> <p>This module implements polynomial arithmetic over finite fields, specifically designed for use in Shamir's Secret Sharing and threshold signature schemes. All operations are performed modulo the secp256k1 curve order.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_Threshold-signature_Polynomial.js.html">src/Threshold-signature/Polynomial.js</a>, <a href="src_Threshold-signature_Polynomial.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://en.wikipedia.org/wiki/Shamir%2527s_Secret_Sharing">Shamir's Secret Sharing</a></li> <li><a href="https://en.wikipedia.org/wiki/Lagrange_polynomial">Lagrange Interpolation</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/Threshold-signature/threshold_signature.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>Threshold Signature Scheme implementation for distributed cryptography</p> <p>This module implements a complete threshold signature scheme using Shamir's Secret Sharing and elliptic curve cryptography. It enables distributed key generation, secret sharing, and threshold signature creation where any t-of-n participants can collaboratively generate valid signatures without reconstructing the private key.</p> <p>The implementation includes:</p> <ul> <li>Joint Verifiable Random Secret Sharing (JVRSS) for distributed key generation</li> <li>Additive Secret Sharing (ADDSS) for linear operations on shared secrets</li> <li>Polynomial Reconstruction Secret Sharing (PROSS) for multiplicative operations</li> <li>Inverse Secret Sharing (INVSS) for computing modular inverses of shared secrets</li> <li>Threshold ECDSA signature generation with proper validation</li> </ul></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_Threshold-signature_threshold_signature.js.html">src/Threshold-signature/threshold_signature.js</a>, <a href="src_Threshold-signature_threshold_signature.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://en.wikipedia.org/wiki/Shamir%2527s_Secret_Sharing">Shamir's Secret Sharing</a></li> <li><a href="https://en.wikipedia.org/wiki/Threshold_cryptosystem">Threshold Cryptography</a></li> <li><a href="https://eprint.iacr.org/2019/114.pdf">Fast Multiparty Threshold ECDSA with Fast Trustless Setup</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/altAddress/BCH/cash_addr.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>Bitcoin Cash CashAddr address format implementation</p> <p>This module implements the CashAddr address format for Bitcoin Cash, providing conversion from legacy Base58Check addresses to the newer CashAddr format with improved error detection and user experience.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_altAddress_BCH_cash_addr.js.html">src/altAddress/BCH/cash_addr.js</a>, <a href="src_altAddress_BCH_cash_addr.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md">CashAddr Specification</a></li> <li><a href="https://reference.cash/protocol/blockchain/encoding/cashaddr">CashAddr Reference</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/altAddress/BTC/bech32.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>Bech32 and Bech32m address encoding implementation for Bitcoin</p> <p>This module implements the Bech32 address format (BIP173) and Bech32m (BIP350) for encoding Bitcoin SegWit addresses. It supports P2WPKH (Pay to Witness PubKey Hash) address generation and arbitrary data encoding with customizable prefixes.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_altAddress_BTC_bech32.js.html">src/altAddress/BTC/bech32.js</a>, <a href="src_altAddress_BTC_bech32.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki">BIP173 - Base32 address format for native v0-16 witness outputs</a></li> <li><a href="https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki">BIP350 - Bech32m format for v1+ witness addresses</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/utilities/Base32.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>Base32 encoding implementation for Bitcoin address formats</p> <p>This module provides Base32 encoding using the custom alphabet specified in Bech32 (BIP173) and CashAddr specifications. Unlike standard Base32, this implementation uses a specially designed alphabet optimized for human readability and error detection in cryptocurrency addresses.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_utilities_Base32.js.html">src/utilities/Base32.js</a>, <a href="src_utilities_Base32.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki">BIP173 - Base32 address format for native v0-16 witness outputs</a></li> <li><a href="https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md">CashAddr Specification</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/utilities/base58.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>Base58Check encoding implementation for Bitcoin</p> <p>This module implements Base58Check encoding, a checksummed base58 encoding format used extensively in Bitcoin for addresses, private keys, and extended keys. Base58Check provides human-readable encoding with built-in error detection through double SHA256 checksums.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_utilities_base58.js.html">src/utilities/base58.js</a>, <a href="src_utilities_base58.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://en.bitcoin.it/wiki/Base58Check_encoding">Base58Check Encoding</a></li> <li><a href="https://tools.ietf.org/rfc/rfc4648.txt">RFC 4648 - Base Encodings</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/utilities/decodeKeys.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>Bitcoin key decoding utilities for WIF and address formats</p> <p>This module provides functions to decode various Bitcoin key and address formats back to their raw binary representations. It handles Wallet Import Format (WIF) private keys and legacy Base58Check addresses, extracting the essential cryptographic material while validating format integrity.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_utilities_decodeKeys.js.html">src/utilities/decodeKeys.js</a>, <a href="src_utilities_decodeKeys.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://en.bitcoin.it/wiki/Wallet_import_format">WIF - Wallet Import Format</a></li> <li><a href="https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses">Bitcoin Address Format</a></li> <li><a href="https://github.com/bitcoin/bips/blob/master/bip-0038.mediawiki">BIP38 - Passphrase-protected private keys</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/utilities/encodeKeys.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>Bitcoin key encoding utilities for various formats</p> <p>This module provides comprehensive encoding functions for Bitcoin cryptographic keys and addresses. It handles the conversion of raw key material into standardized formats used across the Bitcoin ecosystem, including extended keys (BIP32), Wallet Import Format (WIF), and Base58Check addresses.</p></div> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>1.0.0</li></ul></dd> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>yfbsei</li> </ul> </dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_utilities_encodeKeys.js.html">src/utilities/encodeKeys.js</a>, <a href="src_utilities_encodeKeys.js.html#line1">line 1</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki">BIP32 - Hierarchical Deterministic Wallets</a></li> <li><a href="https://en.bitcoin.it/wiki/Wallet_import_format">WIF - Wallet Import Format</a></li> <li><a href="https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses">Bitcoin Address Format</a></li> </ul> </dd> </dl> </div> </article> </section> <section> <header> <h2>src/utilities/rmd160.js</h2> </header> <article> <div class="container-overview"> <div class="description"><p>RIPEMD160 cryptographic hash function implementation</p> <p>This module provides a pure JavaScript implementation of the RIPEMD160 hash algorithm, which is crucial for Bitcoin address generation. RIPEMD160 produces 160-bit (20-byte) hash values and is used in combination with SHA256 to create the HASH160 operation fundamental to Bitcoin's address system.</p> <p>RIPEMD160 was developed as an alternative to SHA-1 and is part of Bitcoin's address generation specifically for its 160-bit output size, which provides a good balance between security a