libcrypto 1.0.1__tar.gz → 1.0.3__tar.gz
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-1.0.3/PKG-INFO +204 -0
- libcrypto-1.0.3/README.md +171 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/setup.py +1 -1
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto/__init__.py +1 -1
- libcrypto-1.0.3/src/libcrypto.egg-info/PKG-INFO +204 -0
- libcrypto-1.0.1/PKG-INFO +0 -318
- libcrypto-1.0.1/README.md +0 -285
- libcrypto-1.0.1/src/libcrypto.egg-info/PKG-INFO +0 -318
- {libcrypto-1.0.1 → libcrypto-1.0.3}/LICENSE +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/pyproject.toml +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/setup.cfg +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto/_version.py +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto/addresses.py +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto/bip32.py +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto/cli.py +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto/constants.py +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto/formats.py +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto/hash.py +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto/keys.py +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto/mnemonic.py +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto/secp256k1.py +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto/wallet.py +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto.egg-info/SOURCES.txt +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto.egg-info/dependency_links.txt +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto.egg-info/entry_points.txt +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto.egg-info/not-zip-safe +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto.egg-info/requires.txt +0 -0
- {libcrypto-1.0.1 → libcrypto-1.0.3}/src/libcrypto.egg-info/top_level.txt +0 -0
libcrypto-1.0.3/PKG-INFO
ADDED
|
@@ -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
|
+
[](https://pypi.org/project/libcrypto/)
|
|
35
|
+
[](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
|
+
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
[](https://pypi.org/project/libcrypto/)
|
|
2
|
+
[](LICENSE)
|
|
3
|
+
|
|
4
|
+
# LibCrypto
|
|
5
|
+
|
|
6
|
+
A professional library for Cryptography and Cryptocurrencies in Python.
|
|
7
|
+
|
|
8
|
+
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.
|
|
9
|
+
|
|
10
|
+
## Key Features
|
|
11
|
+
|
|
12
|
+
- **High-Level Wallet API**: A simple `Wallet` class to manage keys and addresses.
|
|
13
|
+
- **Multi-Currency Support**: Correctly generate addresses for numerous secp256k1-based cryptocurrencies, including:
|
|
14
|
+
- Bitcoin (BTC) - Legacy, SegWit (P2SH & Native)
|
|
15
|
+
- Ethereum (ETH)
|
|
16
|
+
- Tron (TRX)
|
|
17
|
+
- Ripple (XRP)
|
|
18
|
+
- Bitcoin Cash (BCH) - CashAddr format
|
|
19
|
+
- Litecoin (LTC)
|
|
20
|
+
- Dash (DASH)
|
|
21
|
+
- Dogecoin (DOGE)
|
|
22
|
+
- **Hierarchical Deterministic (HD) Wallets**: Full BIP32 support for generating wallets from a master seed.
|
|
23
|
+
- **BIP39 Mnemonic Support**: Generate, validate, and derive seeds from mnemonic phrases.
|
|
24
|
+
- **Key & Format Conversions**: Easily convert between WIF, Hex, and Bytes for private and public keys.
|
|
25
|
+
- **Powerful Command-Line Interface**: Perform common wallet operations directly from your terminal.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Install the library using pip:
|
|
30
|
+
```bash
|
|
31
|
+
pip install libcrypto
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quick Start (Library Usage)
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from libcrypto import Wallet
|
|
38
|
+
|
|
39
|
+
key = "Your private key here (hex)"
|
|
40
|
+
# Initialize the Wallet with the private key
|
|
41
|
+
# Replace "Your private key here (hex)" with your actual private key in hexadecimal format
|
|
42
|
+
wallet = Wallet(key)
|
|
43
|
+
# Generate P2PKH, P2SH-P2WPKH, P2WPKH addresses for Bitcoin
|
|
44
|
+
p2pkh = wallet.get_address(coin="bitcoin", address_type="p2pkh")
|
|
45
|
+
p2wsh = wallet.get_address(coin="bitcoin", address_type="p2sh-p2wpkh")
|
|
46
|
+
p2wpkh = wallet.get_address(coin="bitcoin", address_type="p2wpkh")
|
|
47
|
+
# Generate ethereum Address
|
|
48
|
+
ethereum_address = wallet.get_address(coin="ethereum")
|
|
49
|
+
# Generate Dash Address
|
|
50
|
+
dash = wallet.get_address(coin="dash")
|
|
51
|
+
# Generate Dogecoin Address
|
|
52
|
+
dogecoin_address = wallet.get_address(coin="dogecoin")
|
|
53
|
+
# Generate Tron Address
|
|
54
|
+
tron_address = wallet.get_address(coin="tron")
|
|
55
|
+
# Generate Ripple Address
|
|
56
|
+
ripple_address = wallet.get_address(coin="ripple")
|
|
57
|
+
# Generate Litecoin Address
|
|
58
|
+
litecoin_address = wallet.get_address(coin="litecoin")
|
|
59
|
+
# Generate Litecoin Address with specific address types
|
|
60
|
+
litecoin_address_p2pkh = wallet.get_address(coin="litecoin", address_type="p2pkh")
|
|
61
|
+
litecoin_address_p2wsh = wallet.get_address(coin="litecoin", address_type="p2sh-p2wpkh")
|
|
62
|
+
litecoin_address_p2wpkh = wallet.get_address(coin="litecoin", address_type="p2wpkh")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The library is designed to be straightforward. Here is a basic example of generating addresses from an existing private key.
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from libcrypto import Wallet
|
|
69
|
+
|
|
70
|
+
# Initialize a wallet from a WIF private key
|
|
71
|
+
wif_key = "L4ZQks37JHUadEqaj2nGB1eaZFcsRZwZGQ7WVYuQiztzg4pqopU6" # Example WIF key
|
|
72
|
+
wallet = Wallet(wif_key)
|
|
73
|
+
|
|
74
|
+
# Generate addresses for different coins
|
|
75
|
+
eth_address = wallet.get_address('ethereum')
|
|
76
|
+
btc_address = wallet.get_address('bitcoin', address_type='p2wpkh') # Native SegWit
|
|
77
|
+
bch_address = wallet.get_address('bitcoin_cash')
|
|
78
|
+
|
|
79
|
+
print(f"Ethereum Address: {eth_address}")
|
|
80
|
+
print(f"Bitcoin (SegWit) Address: {btc_address}")
|
|
81
|
+
print(f"Bitcoin Cash Address: {bch_address}")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Quick Start (Command-Line Interface)
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# version
|
|
88
|
+
libcrypto -v
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Package Information:
|
|
92
|
+
```bash
|
|
93
|
+
libcrypto info
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Wallet & Address Generation
|
|
97
|
+
- Generate a Wallet:
|
|
98
|
+
This is the main command for generating new wallets or deriving addresses from existing keys.
|
|
99
|
+
```bash
|
|
100
|
+
libcrypto generate [OPTIONS]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Options:
|
|
104
|
+
|
|
105
|
+
- `-p`, `--private-key` TEXT: Derive addresses from an existing private key (WIF or Hex format). If omitted, a new random wallet is generated.
|
|
106
|
+
- `-c`, `--coin` TEXT: Specify a coin to generate addresses for. This option can be used multiple times. Defaults to bitcoin and ethereum.
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
1. Generate a new wallet for Bitcoin and Litecoin:
|
|
110
|
+
```bash
|
|
111
|
+
libcrypto generate -c bitcoin -c litecoin
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
2. Generate a wallet from an existing private key:
|
|
115
|
+
```bash
|
|
116
|
+
libcrypto generate -p <your-private-key>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
3. Derive addresses for a specific set of coins from a hex key:
|
|
120
|
+
```bash
|
|
121
|
+
libcrypto generate -p <your-hex-key> -c bitcoin -c ethereum -c dash -c tron
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Mnemonic Management
|
|
125
|
+
|
|
126
|
+
The mnemonic subcommand is used for all BIP39 mnemonic phrase operations.
|
|
127
|
+
Generate a Mnemonic Phrase
|
|
128
|
+
|
|
129
|
+
Creates a new, cryptographically secure BIP39 mnemonic phrase.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
libcrypto mnemonic generate [OPTIONS]
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Options:
|
|
136
|
+
|
|
137
|
+
- `-w`, `--words` INTEGER: The number of words in the mnemonic. Can be 12, 15, 18, 21, or 24. [Default: 12]
|
|
138
|
+
|
|
139
|
+
Example:
|
|
140
|
+
```bash
|
|
141
|
+
libcrypto mnemonic generate --words 24
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Validate a Mnemonic Phrase
|
|
145
|
+
|
|
146
|
+
Checks if a given BIP39 mnemonic phrase is valid according to the checksum rules.
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
libcrypto mnemonic validate "PHRASE"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Arguments:
|
|
153
|
+
|
|
154
|
+
- `PHRASE`: The full mnemonic phrase, enclosed in double quotes. [Required]
|
|
155
|
+
|
|
156
|
+
Example:
|
|
157
|
+
```bash
|
|
158
|
+
libcrypto mnemonic validate "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Donate
|
|
162
|
+
|
|
163
|
+
If you find this library useful, consider supporting its development:
|
|
164
|
+
|
|
165
|
+
- **Bitcoin (BTC)**: `1MMDRZAcM6dzmdMUSV8pDdAPDFpwzve9Fc`
|
|
166
|
+
|
|
167
|
+
## Contact
|
|
168
|
+
|
|
169
|
+
For support or inquiries, please contact us at [pymmdrza@gmail.com](mailto:pymmdrza@gmail.com).
|
|
170
|
+
|
|
171
|
+
|
|
@@ -17,7 +17,7 @@ def get_long_description():
|
|
|
17
17
|
|
|
18
18
|
setup(
|
|
19
19
|
name="libcrypto",
|
|
20
|
-
version="1.0.
|
|
20
|
+
version="1.0.3",
|
|
21
21
|
description="Comprehensive cryptocurrency wallet library with BIP39/BIP32 support using only pycryptodome",
|
|
22
22
|
long_description=get_long_description(),
|
|
23
23
|
long_description_content_type="text/markdown",
|
|
@@ -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
|
+
[](https://pypi.org/project/libcrypto/)
|
|
35
|
+
[](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
|
+
|