libcrypto 1.0.1__py3-none-any.whl → 1.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of libcrypto might be problematic. Click here for more details.

libcrypto/__init__.py CHANGED
@@ -30,7 +30,7 @@ from .formats import (
30
30
  InvalidFormatError
31
31
  )
32
32
 
33
- __version__ = "1.0.1"
33
+ __version__ = "1.0.3"
34
34
  __all__ = [
35
35
  # Library Version
36
36
  '__version__',
@@ -0,0 +1,204 @@
1
+ Metadata-Version: 2.4
2
+ Name: libcrypto
3
+ Version: 1.0.3
4
+ Summary: A professional library For Cryptography and Cryptocurrencies in Python.
5
+ Home-page: https://github.com/pymmdrza/libcrypto
6
+ Author: Mmdrza
7
+ Author-email: Mmdrza <pymmdrza@gmail.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://libcrypto.readthedocs.io/
10
+ Project-URL: Repository, https://github.com/Pymmdrza/libcrypto
11
+ Project-URL: Bug Tracker, https://github.com/Pymmdrza/libcrypto/issues
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Intended Audience :: Developers
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Topic :: Security :: Cryptography
22
+ Requires-Python: >=3.8
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: pycryptodome
26
+ Requires-Dist: ecdsa
27
+ Requires-Dist: rich
28
+ Requires-Dist: typer
29
+ Dynamic: author
30
+ Dynamic: home-page
31
+ Dynamic: license-file
32
+ Dynamic: requires-python
33
+
34
+ [![Python Version](https://img.shields.io/pypi/v/libcrypto?color=blue&logo=python)](https://pypi.org/project/libcrypto/)
35
+ [![License](https://img.shields.io/pypi/l/libcrypto)](LICENSE)
36
+
37
+ # LibCrypto
38
+
39
+ A professional library for Cryptography and Cryptocurrencies in Python.
40
+
41
+ This library provides a comprehensive suite of tools for developers working with cryptocurrencies, focusing on key management and address generation with a clean, high-level API.
42
+
43
+ ## Key Features
44
+
45
+ - **High-Level Wallet API**: A simple `Wallet` class to manage keys and addresses.
46
+ - **Multi-Currency Support**: Correctly generate addresses for numerous secp256k1-based cryptocurrencies, including:
47
+ - Bitcoin (BTC) - Legacy, SegWit (P2SH & Native)
48
+ - Ethereum (ETH)
49
+ - Tron (TRX)
50
+ - Ripple (XRP)
51
+ - Bitcoin Cash (BCH) - CashAddr format
52
+ - Litecoin (LTC)
53
+ - Dash (DASH)
54
+ - Dogecoin (DOGE)
55
+ - **Hierarchical Deterministic (HD) Wallets**: Full BIP32 support for generating wallets from a master seed.
56
+ - **BIP39 Mnemonic Support**: Generate, validate, and derive seeds from mnemonic phrases.
57
+ - **Key & Format Conversions**: Easily convert between WIF, Hex, and Bytes for private and public keys.
58
+ - **Powerful Command-Line Interface**: Perform common wallet operations directly from your terminal.
59
+
60
+ ## Installation
61
+
62
+ Install the library using pip:
63
+ ```bash
64
+ pip install libcrypto
65
+ ```
66
+
67
+ ## Quick Start (Library Usage)
68
+
69
+ ```python
70
+ from libcrypto import Wallet
71
+
72
+ key = "Your private key here (hex)"
73
+ # Initialize the Wallet with the private key
74
+ # Replace "Your private key here (hex)" with your actual private key in hexadecimal format
75
+ wallet = Wallet(key)
76
+ # Generate P2PKH, P2SH-P2WPKH, P2WPKH addresses for Bitcoin
77
+ p2pkh = wallet.get_address(coin="bitcoin", address_type="p2pkh")
78
+ p2wsh = wallet.get_address(coin="bitcoin", address_type="p2sh-p2wpkh")
79
+ p2wpkh = wallet.get_address(coin="bitcoin", address_type="p2wpkh")
80
+ # Generate ethereum Address
81
+ ethereum_address = wallet.get_address(coin="ethereum")
82
+ # Generate Dash Address
83
+ dash = wallet.get_address(coin="dash")
84
+ # Generate Dogecoin Address
85
+ dogecoin_address = wallet.get_address(coin="dogecoin")
86
+ # Generate Tron Address
87
+ tron_address = wallet.get_address(coin="tron")
88
+ # Generate Ripple Address
89
+ ripple_address = wallet.get_address(coin="ripple")
90
+ # Generate Litecoin Address
91
+ litecoin_address = wallet.get_address(coin="litecoin")
92
+ # Generate Litecoin Address with specific address types
93
+ litecoin_address_p2pkh = wallet.get_address(coin="litecoin", address_type="p2pkh")
94
+ litecoin_address_p2wsh = wallet.get_address(coin="litecoin", address_type="p2sh-p2wpkh")
95
+ litecoin_address_p2wpkh = wallet.get_address(coin="litecoin", address_type="p2wpkh")
96
+ ```
97
+
98
+ The library is designed to be straightforward. Here is a basic example of generating addresses from an existing private key.
99
+
100
+ ```python
101
+ from libcrypto import Wallet
102
+
103
+ # Initialize a wallet from a WIF private key
104
+ wif_key = "L4ZQks37JHUadEqaj2nGB1eaZFcsRZwZGQ7WVYuQiztzg4pqopU6" # Example WIF key
105
+ wallet = Wallet(wif_key)
106
+
107
+ # Generate addresses for different coins
108
+ eth_address = wallet.get_address('ethereum')
109
+ btc_address = wallet.get_address('bitcoin', address_type='p2wpkh') # Native SegWit
110
+ bch_address = wallet.get_address('bitcoin_cash')
111
+
112
+ print(f"Ethereum Address: {eth_address}")
113
+ print(f"Bitcoin (SegWit) Address: {btc_address}")
114
+ print(f"Bitcoin Cash Address: {bch_address}")
115
+ ```
116
+
117
+ ## Quick Start (Command-Line Interface)
118
+
119
+ ```bash
120
+ # version
121
+ libcrypto -v
122
+ ```
123
+
124
+ Package Information:
125
+ ```bash
126
+ libcrypto info
127
+ ```
128
+
129
+ ### Wallet & Address Generation
130
+ - Generate a Wallet:
131
+ This is the main command for generating new wallets or deriving addresses from existing keys.
132
+ ```bash
133
+ libcrypto generate [OPTIONS]
134
+ ```
135
+
136
+ Options:
137
+
138
+ - `-p`, `--private-key` TEXT: Derive addresses from an existing private key (WIF or Hex format). If omitted, a new random wallet is generated.
139
+ - `-c`, `--coin` TEXT: Specify a coin to generate addresses for. This option can be used multiple times. Defaults to bitcoin and ethereum.
140
+
141
+
142
+ 1. Generate a new wallet for Bitcoin and Litecoin:
143
+ ```bash
144
+ libcrypto generate -c bitcoin -c litecoin
145
+ ```
146
+
147
+ 2. Generate a wallet from an existing private key:
148
+ ```bash
149
+ libcrypto generate -p <your-private-key>
150
+ ```
151
+
152
+ 3. Derive addresses for a specific set of coins from a hex key:
153
+ ```bash
154
+ libcrypto generate -p <your-hex-key> -c bitcoin -c ethereum -c dash -c tron
155
+ ```
156
+
157
+ ### Mnemonic Management
158
+
159
+ The mnemonic subcommand is used for all BIP39 mnemonic phrase operations.
160
+ Generate a Mnemonic Phrase
161
+
162
+ Creates a new, cryptographically secure BIP39 mnemonic phrase.
163
+
164
+ ```bash
165
+ libcrypto mnemonic generate [OPTIONS]
166
+ ```
167
+
168
+ Options:
169
+
170
+ - `-w`, `--words` INTEGER: The number of words in the mnemonic. Can be 12, 15, 18, 21, or 24. [Default: 12]
171
+
172
+ Example:
173
+ ```bash
174
+ libcrypto mnemonic generate --words 24
175
+ ```
176
+
177
+ ### Validate a Mnemonic Phrase
178
+
179
+ Checks if a given BIP39 mnemonic phrase is valid according to the checksum rules.
180
+
181
+ ```bash
182
+ libcrypto mnemonic validate "PHRASE"
183
+ ```
184
+
185
+ Arguments:
186
+
187
+ - `PHRASE`: The full mnemonic phrase, enclosed in double quotes. [Required]
188
+
189
+ Example:
190
+ ```bash
191
+ libcrypto mnemonic validate "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
192
+ ```
193
+
194
+ ## Donate
195
+
196
+ If you find this library useful, consider supporting its development:
197
+
198
+ - **Bitcoin (BTC)**: `1MMDRZAcM6dzmdMUSV8pDdAPDFpwzve9Fc`
199
+
200
+ ## Contact
201
+
202
+ For support or inquiries, please contact us at [pymmdrza@gmail.com](mailto:pymmdrza@gmail.com).
203
+
204
+
@@ -1,4 +1,4 @@
1
- libcrypto/__init__.py,sha256=IIlgCxgdRP3t_O28bO-gH3xCaipVK1Vl0vZv-NNe6RQ,1520
1
+ libcrypto/__init__.py,sha256=g4yguAluoiqP8RP41UCWJCkuudpZQquLzsCluYM2HK8,1520
2
2
  libcrypto/_version.py,sha256=DSDyLW2lPzd96MgdTJ1v2YoJcpnh3k-GDDmngzKiFdA,485
3
3
  libcrypto/addresses.py,sha256=_rwJbuIJA9Pt-mD7SpEHoUCyNlC0ghXURLI71ZDKTJA,7491
4
4
  libcrypto/bip32.py,sha256=uzhd0l9FPgNRWzpfhcpZedyJo48y6UrrB_1cPVeoW7E,8466
@@ -10,9 +10,9 @@ libcrypto/keys.py,sha256=_HIoHrGcoHTqJ2qQsZroTHEexyLIM5Mn5t9eMMMdqP4,5051
10
10
  libcrypto/mnemonic.py,sha256=cmHFX1B4YGGN3pIaFDuffrpKKkTCAXya5W58oA77KBk,4677
11
11
  libcrypto/secp256k1.py,sha256=4FH_byTr2fXms4q3BtSHVBs-4NPE2gyDaS_lS4oeDWw,3873
12
12
  libcrypto/wallet.py,sha256=LWjhwKe7nKonB6oaKOggMdPstIrXYKJhJcYPCcKqU6c,5835
13
- libcrypto-1.0.1.dist-info/licenses/LICENSE,sha256=VmwUVixn0u8rR_TF0dIoqv7CK0a5WBoFX8zQvIYa4eE,1071
14
- libcrypto-1.0.1.dist-info/METADATA,sha256=_WhWWgV3pQqhHeopK6C6ZviCCALacQmtV2uF6a1CSH8,10299
15
- libcrypto-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- libcrypto-1.0.1.dist-info/entry_points.txt,sha256=P1JmZQ0W2Mi9rD37f9yFG2hYxGInDUY9i9erY_hldTY,48
17
- libcrypto-1.0.1.dist-info/top_level.txt,sha256=CP4_HN2d5lfT-Jo0IQgNdbGYjk4PSDHK0EU4xfaKmGc,10
18
- libcrypto-1.0.1.dist-info/RECORD,,
13
+ libcrypto-1.0.3.dist-info/licenses/LICENSE,sha256=VmwUVixn0u8rR_TF0dIoqv7CK0a5WBoFX8zQvIYa4eE,1071
14
+ libcrypto-1.0.3.dist-info/METADATA,sha256=DR55nqApuuZZflKxGRQXxLK-A08KTYmRvXHE3I_3UjQ,6612
15
+ libcrypto-1.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ libcrypto-1.0.3.dist-info/entry_points.txt,sha256=P1JmZQ0W2Mi9rD37f9yFG2hYxGInDUY9i9erY_hldTY,48
17
+ libcrypto-1.0.3.dist-info/top_level.txt,sha256=CP4_HN2d5lfT-Jo0IQgNdbGYjk4PSDHK0EU4xfaKmGc,10
18
+ libcrypto-1.0.3.dist-info/RECORD,,
@@ -1,318 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: libcrypto
3
- Version: 1.0.1
4
- Summary: A professional library For Cryptography and Cryptocurrencies in Python.
5
- Home-page: https://github.com/pymmdrza/libcrypto
6
- Author: Mmdrza
7
- Author-email: Mmdrza <pymmdrza@gmail.com>
8
- License: MIT
9
- Project-URL: Homepage, https://libcrypto.readthedocs.io/
10
- Project-URL: Repository, https://github.com/Pymmdrza/libcrypto
11
- Project-URL: Bug Tracker, https://github.com/Pymmdrza/libcrypto/issues
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.8
14
- Classifier: Programming Language :: Python :: 3.9
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: License :: OSI Approved :: MIT License
18
- Classifier: Operating System :: OS Independent
19
- Classifier: Intended Audience :: Developers
20
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
- Classifier: Topic :: Security :: Cryptography
22
- Requires-Python: >=3.8
23
- Description-Content-Type: text/markdown
24
- License-File: LICENSE
25
- Requires-Dist: pycryptodome
26
- Requires-Dist: ecdsa
27
- Requires-Dist: rich
28
- Requires-Dist: typer
29
- Dynamic: author
30
- Dynamic: home-page
31
- Dynamic: license-file
32
- Dynamic: requires-python
33
-
34
- # LibCrypto - Cryptocurrency Wallet Library
35
-
36
- A comprehensive, self-contained Python cryptocurrency wallet library that provides all necessary tools for generating and managing cryptocurrency wallet keys and addresses **without any external dependencies**.
37
-
38
- ## 🚀 Features
39
-
40
- ### Core Functionality
41
- - **BIP39 Mnemonic Phrases**: Generate and validate secure mnemonic phrases (12, 15, 18, 21, 24 words)
42
- - **BIP32 HD Wallets**: Hierarchical deterministic wallet support with full BIP44 compliance
43
- - **Multi-Currency Support**: Generate addresses for 13+ cryptocurrencies
44
- - **Key Format Conversions**: Convert between hex, WIF, bytes, decimal, and mnemonic formats
45
- - **Zero Dependencies**: Uses only Python standard library and included C extensions
46
-
47
- ### Supported Cryptocurrencies
48
- - **Bitcoin (BTC)** - P2PKH, P2SH, P2WPKH, P2WSH (SegWit)
49
- - **Ethereum (ETH)** - Native addresses with EIP-55 checksum
50
- - **Litecoin (LTC)** - All Bitcoin-compatible formats
51
- - **Bitcoin Cash (BCH)** - Legacy and CashAddr formats
52
- - **Bitcoin Gold (BTG)** - All standard formats
53
- - **Dogecoin (DOGE)** - P2PKH and P2SH
54
- - **Dash** - P2PKH and P2SH
55
- - **Digibyte (DGB)** - All standard formats
56
- - **Zcash (ZEC)** - T-addresses
57
- - **Tron (TRX)** - Native TRX addresses
58
- - **Solana (SOL)** - Base58 encoded addresses
59
- - **Avalanche (AVAX)** - C-Chain addresses
60
- - **TON** - Native TON addresses
61
- - **Ripple (XRP)** - Classic addresses
62
-
63
- ### Address Formats
64
- - **P2PKH**: Pay to Public Key Hash (1...)
65
- - **P2SH**: Pay to Script Hash (3...)
66
- - **P2WPKH**: Pay to Witness Public Key Hash (bc1...)
67
- - **P2WSH**: Pay to Witness Script Hash (bc1...)
68
- - **Ethereum**: Keccak256-based addresses (0x...)
69
-
70
- ## 📦 Installation
71
-
72
- ```bash
73
- # Clone the repository
74
- git clone <repository-url>
75
- cd libcrypto
76
-
77
- # Install in development mode
78
- pip install -e .
79
- ```
80
-
81
- ## 🔧 Quick Start
82
-
83
- ### Generate a New Mnemonic and Wallet
84
-
85
- ```python
86
- import mnemonic
87
- from wallet import HDWallet, PrivateKey, AddressGenerator
88
-
89
- # Generate a new 12-word mnemonic
90
- new_mnemonic = mnemonic.generate_mnemonic(12)
91
- print(f"Generated mnemonic: {new_mnemonic}")
92
-
93
- # Create HD wallet from mnemonic
94
- wallet = HDWallet.from_mnemonic(new_mnemonic)
95
-
96
- # Get Bitcoin address (BIP44 path: m/44'/0'/0'/0/0)
97
- btc_key = wallet.derive_address_key(coin_type=0, address_index=0)
98
- btc_address = AddressGenerator.from_public_key(
99
- btc_key.public_key, 'p2pkh', 'bitcoin'
100
- )
101
- print(f"Bitcoin address: {btc_address}")
102
-
103
- # Get Ethereum address (BIP44 path: m/44'/60'/0'/0/0)
104
- eth_key = wallet.derive_address_key(coin_type=60, address_index=0)
105
- eth_address = AddressGenerator.from_public_key(
106
- eth_key.public_key, 'ethereum', 'ethereum'
107
- )
108
- print(f"Ethereum address: {eth_address}")
109
- ```
110
-
111
- ### Import Existing Mnemonic
112
-
113
- ```python
114
- import mnemonic
115
- from wallet import HDWallet
116
-
117
- # Import existing mnemonic
118
- existing_mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
119
-
120
- # Validate mnemonic
121
- if mnemonic.validate_mnemonic(existing_mnemonic):
122
- print("✅ Mnemonic is valid")
123
-
124
- # Create wallet
125
- wallet = HDWallet.from_mnemonic(existing_mnemonic)
126
-
127
- # Get master keys
128
- print(f"Master private key: {wallet.get_master_private_key()}")
129
- print(f"Master public key: {wallet.get_master_public_key()}")
130
- else:
131
- print("❌ Invalid mnemonic")
132
- ```
133
-
134
- ### Private Key Operations
135
-
136
- ```python
137
- from wallet import PrivateKey
138
-
139
- # Generate a new private key
140
- private_key = PrivateKey.generate()
141
-
142
- # Convert to different formats
143
- print(f"Hex: {private_key.hex}")
144
- print(f"WIF: {private_key.to_wif()}")
145
- print(f"Decimal: {private_key.decimal}")
146
-
147
- # Get public key and address
148
- public_key = private_key.get_public_key()
149
- btc_address = public_key.get_address('p2pkh', 'bitcoin')
150
- print(f"Bitcoin address: {btc_address}")
151
-
152
- # Import from hex
153
- hex_key = "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
154
- imported_key = PrivateKey.from_hex(hex_key)
155
- print(f"Imported key WIF: {imported_key.to_wif()}")
156
- ```
157
-
158
- ### Multiple Address Generation
159
-
160
- ```python
161
- from wallet import HDWallet, AddressGenerator
162
-
163
- # Create wallet from mnemonic
164
- mnemonic_phrase = "your twelve word mnemonic phrase goes here example test words"
165
- wallet = HDWallet.from_mnemonic(mnemonic_phrase)
166
-
167
- # Generate first 5 Bitcoin addresses
168
- for i in range(5):
169
- key = wallet.derive_address_key(coin_type=0, address_index=i)
170
-
171
- # Generate different Bitcoin address formats
172
- p2pkh = AddressGenerator.from_public_key(key.public_key, 'p2pkh', 'bitcoin')
173
- p2wpkh = AddressGenerator.from_public_key(key.public_key, 'p2wpkh', 'bitcoin')
174
-
175
- print(f"Address {i}:")
176
- print(f" P2PKH: {p2pkh}")
177
- print(f" P2WPKH: {p2wpkh}")
178
- ```
179
-
180
- ### Multi-Currency Wallet
181
-
182
- ```python
183
- from wallet import HDWallet, AddressGenerator
184
- from Util.constants import BIP44_COIN_TYPES
185
-
186
- # Create wallet
187
- wallet = HDWallet.from_mnemonic("your mnemonic here")
188
-
189
- # Generate addresses for different cryptocurrencies
190
- currencies = ['bitcoin', 'ethereum', 'litecoin', 'dogecoin']
191
-
192
- for currency in currencies:
193
- coin_type = BIP44_COIN_TYPES[currency]
194
- key = wallet.derive_address_key(coin_type=coin_type, address_index=0)
195
-
196
- if currency == 'ethereum':
197
- address = AddressGenerator.from_public_key(key.public_key, 'ethereum', 'ethereum')
198
- else:
199
- address = AddressGenerator.from_public_key(key.public_key, 'p2pkh', currency)
200
-
201
- print(f"{currency.capitalize()}: {address}")
202
- ```
203
-
204
- ## API Overview
205
-
206
- ### Mnemonic Module (`mnemonic.py`)
207
- - `generate_mnemonic(word_count)` - Generate new mnemonic
208
- - `validate_mnemonic(mnemonic)` - Validate existing mnemonic
209
- - `mnemonic_to_seed(mnemonic, passphrase)` - Convert to seed
210
-
211
- ### HD Wallet (`wallet.HDWallet`)
212
- - `from_mnemonic(mnemonic, passphrase, network)` - Create from mnemonic
213
- - `derive_account(coin_type, account)` - Derive account key
214
- - `derive_address_key(coin_type, account, change, address_index)` - Derive address key
215
-
216
- ### Private Key (`wallet.PrivateKey`)
217
- - `generate(network)` - Generate new key
218
- - `from_hex(hex_str, network)` - Import from hex
219
- - `from_wif(wif)` - Import from WIF
220
- - `to_wif(compressed)` - Export to WIF
221
- - `get_public_key(compressed)` - Get public key
222
-
223
- ### Public Key (`wallet.PublicKey`)
224
- - `from_hex(hex_str, compressed)` - Import from hex
225
- - `get_address(address_type, network)` - Generate address
226
- - `to_compressed()` / `to_uncompressed()` - Format conversion
227
-
228
- ### Address Generator (`wallet.AddressGenerator`)
229
- - `from_public_key(public_key, address_type, network)` - Generate address
230
- - `generate_multiple_formats(public_key, network)` - All formats
231
- - `validate_address(address, network)` - Validate address
232
-
233
- ## Security Features
234
-
235
- - **Cryptographically Secure**: Uses `secrets` module for random number generation
236
- - **Proper Entropy**: Validates entropy for mnemonic generation
237
- - **Checksum Validation**: All mnemonics include BIP39 checksum verification
238
- - **Constant-Time Operations**: Where possible, uses constant-time implementations
239
- - **Zero External Dependencies**: Reduces attack surface by avoiding third-party libraries
240
-
241
-
242
-
243
- ## Advanced Usage
244
-
245
- ### Custom Derivation Paths
246
-
247
- ```python
248
- from wallet import HDWallet
249
-
250
- wallet = HDWallet.from_mnemonic("your mnemonic")
251
-
252
- # Custom derivation path
253
- custom_path = "m/44'/0'/0'/0/5" # 6th address
254
- custom_key = wallet.master_node.derive_path(custom_path)
255
-
256
- # Account-level derivation for exchange integration
257
- account_key = wallet.derive_account(coin_type=0, account=1) # Second account
258
- ```
259
-
260
- ### Batch Address Generation
261
-
262
- ```python
263
- from wallet import HDWallet, AddressGenerator
264
-
265
- def generate_address_batch(mnemonic, coin_type, count=100):
266
- """Generate a batch of addresses efficiently."""
267
- wallet = HDWallet.from_mnemonic(mnemonic)
268
- addresses = []
269
-
270
- for i in range(count):
271
- key = wallet.derive_address_key(coin_type=coin_type, address_index=i)
272
- address = AddressGenerator.from_public_key(key.public_key, 'p2pkh', 'bitcoin')
273
- addresses.append({
274
- 'index': i,
275
- 'address': address,
276
- 'private_key': key.private_key.hex(),
277
- 'public_key': key.public_key.hex()
278
- })
279
-
280
- return addresses
281
-
282
- # Generate first 100 Bitcoin addresses
283
- btc_addresses = generate_address_batch("your mnemonic", coin_type=0, count=100)
284
- ```
285
-
286
- ## Performance
287
-
288
- Typical performance on modern hardware:
289
- - **Mnemonic generation**: < 100ms
290
- - **Address generation**: < 50ms per address
291
- - **Key derivation**: < 200ms for complex paths
292
- - **Memory usage**: < 50MB for typical operations
293
-
294
- ## Contributing
295
-
296
- 1. Fork the repository
297
- 2. Create a feature branch
298
- 3. Make your changes
299
- 4. Add tests for new functionality
300
- 5. Submit a pull request
301
-
302
- ## License
303
-
304
- This project is licensed under the MIT License - see the LICENSE file for details.
305
-
306
- ## Standards Compliance
307
-
308
- - **BIP-39**: Mnemonic code for generating deterministic keys
309
- - **BIP-32**: Hierarchical Deterministic (HD) Wallets
310
- - **BIP-44**: Multi-Account Hierarchy for Deterministic Wallets
311
- - **EIP-55**: Mixed-case checksum address encoding (Ethereum)
312
- - **RFC-6979**: Deterministic Usage of DSA and ECDSA
313
-
314
-
315
- ---
316
-
317
- **LibCrypto** - Professional Cryptocurrency Wallet Library with Zero Dependencies
318
-