hippius 0.1.6__py3-none-any.whl → 0.1.7__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.
- {hippius-0.1.6.dist-info → hippius-0.1.7.dist-info}/METADATA +274 -4
- hippius-0.1.7.dist-info/RECORD +10 -0
- hippius_sdk/__init__.py +45 -1
- hippius_sdk/cli.py +1269 -36
- hippius_sdk/client.py +53 -12
- hippius_sdk/config.py +744 -0
- hippius_sdk/ipfs.py +178 -87
- hippius_sdk/substrate.py +130 -68
- hippius-0.1.6.dist-info/RECORD +0 -9
- {hippius-0.1.6.dist-info → hippius-0.1.7.dist-info}/WHEEL +0 -0
- {hippius-0.1.6.dist-info → hippius-0.1.7.dist-info}/entry_points.txt +0 -0
@@ -1,21 +1,22 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: hippius
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.7
|
4
4
|
Summary: Python SDK and CLI for Hippius blockchain storage
|
5
5
|
Home-page: https://github.com/thenervelab/hippius-sdk
|
6
6
|
Author: Dubs
|
7
7
|
Author-email: dubs@dubs.rs
|
8
|
-
Requires-Python: >=3.8
|
8
|
+
Requires-Python: >=3.8, !=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*
|
9
9
|
Classifier: Development Status :: 3 - Alpha
|
10
10
|
Classifier: Intended Audience :: Developers
|
11
11
|
Classifier: License :: OSI Approved :: MIT License
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
13
13
|
Classifier: Programming Language :: Python :: 3.8
|
14
|
-
Classifier: Programming Language :: Python :: 3.9
|
15
14
|
Classifier: Programming Language :: Python :: 3.10
|
16
15
|
Classifier: Programming Language :: Python :: 3.11
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
17
17
|
Provides-Extra: clipboard
|
18
18
|
Requires-Dist: base58 (>=2.1.1,<3.0.0)
|
19
|
+
Requires-Dist: cryptography (>=44.0.0,<45.0.0)
|
19
20
|
Requires-Dist: ipfshttpclient (>=0.7.0,<0.8.0)
|
20
21
|
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
|
21
22
|
Requires-Dist: pynacl (>=1.5.0,<2.0.0)
|
@@ -66,7 +67,7 @@ client = HippiusClient()
|
|
66
67
|
# Or specify custom endpoints
|
67
68
|
client = HippiusClient(
|
68
69
|
ipfs_gateway="https://ipfs.io", # For downloads (default)
|
69
|
-
ipfs_api_url="
|
70
|
+
ipfs_api_url="https://relay-fr.hippius.network", # For uploads (default)
|
70
71
|
)
|
71
72
|
|
72
73
|
# Upload a file to IPFS
|
@@ -271,6 +272,69 @@ The CLI provides detailed output during the process, including:
|
|
271
272
|
- Storage confirmation in the marketplace
|
272
273
|
- Instructions for reconstruction
|
273
274
|
|
275
|
+
#### Erasure Coding
|
276
|
+
|
277
|
+
Erasure coding offers redundancy by splitting files into chunks:
|
278
|
+
|
279
|
+
```bash
|
280
|
+
# Basic erasure coding with default parameters (k=3, m=5)
|
281
|
+
hippius erasure-code my_large_file.zip
|
282
|
+
|
283
|
+
# Erasure code with custom parameters for increased redundancy
|
284
|
+
hippius erasure-code my_important_file.mp4 --k 4 --m 10 --chunk-size 2097152 --encrypt
|
285
|
+
```
|
286
|
+
|
287
|
+
To reconstruct a file from erasure-coded chunks:
|
288
|
+
|
289
|
+
```bash
|
290
|
+
hippius reconstruct QmMetadataCID reconstructed_filename
|
291
|
+
```
|
292
|
+
|
293
|
+
#### Listing Erasure Coded Files
|
294
|
+
|
295
|
+
To view only your erasure-coded files:
|
296
|
+
|
297
|
+
```bash
|
298
|
+
# List all erasure-coded files
|
299
|
+
hippius ec-files
|
300
|
+
|
301
|
+
# Show all miners for each erasure-coded file
|
302
|
+
hippius ec-files --all-miners
|
303
|
+
|
304
|
+
# Show associated chunks for each erasure-coded file
|
305
|
+
hippius ec-files --show-chunks
|
306
|
+
```
|
307
|
+
|
308
|
+
This command provides detailed information about each erasure-coded file including:
|
309
|
+
- Original file name
|
310
|
+
- Metadata CID
|
311
|
+
- File size
|
312
|
+
- Number of chunks
|
313
|
+
- Miners storing the file
|
314
|
+
- Reconstruction command
|
315
|
+
|
316
|
+
#### Troubleshooting
|
317
|
+
|
318
|
+
1. **IPFS Connection Issues**: Make sure you have either:
|
319
|
+
- A local IPFS daemon running (`ipfs daemon` in a separate terminal)
|
320
|
+
- Or proper environment variables set in `.env` for remote connections
|
321
|
+
|
322
|
+
2. **Missing Dependencies**: If you get import errors, ensure all dependencies are installed:
|
323
|
+
```bash
|
324
|
+
poetry install --all-extras
|
325
|
+
```
|
326
|
+
|
327
|
+
3. **CLI Not Found**: If the `hippius` command isn't found after installing, try:
|
328
|
+
```bash
|
329
|
+
# Verify it's installed
|
330
|
+
poetry show hippius
|
331
|
+
|
332
|
+
# Check your PATH
|
333
|
+
which hippius
|
334
|
+
```
|
335
|
+
|
336
|
+
4. **Substrate Issues**: For marketplace operations, make sure your `.env` has the correct `SUBSTRATE_SEED_PHRASE` and `SUBSTRATE_URL` values.
|
337
|
+
|
274
338
|
## Command Line Interface
|
275
339
|
|
276
340
|
The Hippius SDK includes a powerful command-line interface (CLI) that provides access to all major features of the SDK directly from your terminal.
|
@@ -321,6 +385,12 @@ hippius files 5H1QBRF7T7dgKwzVGCgS4wioudvMRf9K4NEDzfuKLnuyBNzH
|
|
321
385
|
|
322
386
|
# Show all miners for each file
|
323
387
|
hippius files --all-miners
|
388
|
+
|
389
|
+
# View only erasure-coded files
|
390
|
+
hippius ec-files
|
391
|
+
|
392
|
+
# View erasure-coded files with details about chunks
|
393
|
+
hippius ec-files --show-chunks
|
324
394
|
```
|
325
395
|
|
326
396
|
### Encryption
|
@@ -350,8 +420,19 @@ hippius erasure-code important_data.zip --k 4 --m 10 --chunk-size 2097152 --encr
|
|
350
420
|
|
351
421
|
# Reconstruct a file from its metadata
|
352
422
|
hippius reconstruct QmMetadataCID reconstructed_file.mp4
|
423
|
+
|
424
|
+
# List all your erasure-coded files with metadata CIDs
|
425
|
+
hippius ec-files
|
426
|
+
|
427
|
+
# Show all miners for each erasure-coded file
|
428
|
+
hippius ec-files --all-miners
|
429
|
+
|
430
|
+
# Show detailed information including associated chunks
|
431
|
+
hippius ec-files --show-chunks
|
353
432
|
```
|
354
433
|
|
434
|
+
The `ec-files` command makes it easy to track and manage your erasure-coded files separately from regular files. It provides the metadata CID needed for reconstruction and information about chunk distribution.
|
435
|
+
|
355
436
|
### Using Environment Variables
|
356
437
|
|
357
438
|
The CLI automatically reads from your `.env` file for common settings:
|
@@ -432,6 +513,87 @@ The SDK provides robust connection handling for IPFS:
|
|
432
513
|
|
433
514
|
This dual approach ensures maximum compatibility across different environments. The fallback happens automatically, so you don't need to worry about it.
|
434
515
|
|
516
|
+
## Configuration
|
517
|
+
|
518
|
+
Hippius SDK now supports persistent configuration stored in your home directory at `~/.hippius/config.json`. This makes it easier to manage your settings without having to specify them each time or maintain environment variables.
|
519
|
+
|
520
|
+
### Configuration Management
|
521
|
+
|
522
|
+
The configuration file is automatically created with default values when you first use the SDK. You can manage it using the CLI:
|
523
|
+
|
524
|
+
```bash
|
525
|
+
# List all configuration settings
|
526
|
+
hippius config list
|
527
|
+
|
528
|
+
# Get a specific configuration value
|
529
|
+
hippius config get ipfs gateway
|
530
|
+
|
531
|
+
# Set a configuration value
|
532
|
+
hippius config set ipfs gateway https://ipfs.io
|
533
|
+
|
534
|
+
# Import settings from your .env file
|
535
|
+
hippius config import-env
|
536
|
+
|
537
|
+
# Reset configuration to default values
|
538
|
+
hippius config reset
|
539
|
+
```
|
540
|
+
|
541
|
+
### Configuration Structure
|
542
|
+
|
543
|
+
The configuration is organized in the following sections:
|
544
|
+
|
545
|
+
```json
|
546
|
+
{
|
547
|
+
"ipfs": {
|
548
|
+
"gateway": "https://ipfs.io",
|
549
|
+
"api_url": "https://relay-fr.hippius.network",
|
550
|
+
"local_ipfs": false
|
551
|
+
},
|
552
|
+
"substrate": {
|
553
|
+
"url": "wss://rpc.hippius.network",
|
554
|
+
"seed_phrase": null,
|
555
|
+
"default_miners": []
|
556
|
+
},
|
557
|
+
"encryption": {
|
558
|
+
"encrypt_by_default": false,
|
559
|
+
"encryption_key": null
|
560
|
+
},
|
561
|
+
"erasure_coding": {
|
562
|
+
"default_k": 3,
|
563
|
+
"default_m": 5,
|
564
|
+
"default_chunk_size": 1048576
|
565
|
+
},
|
566
|
+
"cli": {
|
567
|
+
"verbose": false,
|
568
|
+
"max_retries": 3
|
569
|
+
}
|
570
|
+
}
|
571
|
+
```
|
572
|
+
|
573
|
+
### Environment Variables and Configuration
|
574
|
+
|
575
|
+
The SDK still supports environment variables for backward compatibility. You can import settings from your `.env` file to the configuration using:
|
576
|
+
|
577
|
+
```bash
|
578
|
+
hippius config import-env
|
579
|
+
```
|
580
|
+
|
581
|
+
### Using Configuration in Code
|
582
|
+
|
583
|
+
```python
|
584
|
+
from hippius_sdk import get_config_value, set_config_value, HippiusClient
|
585
|
+
|
586
|
+
# Get a configuration value
|
587
|
+
gateway = get_config_value("ipfs", "gateway")
|
588
|
+
print(f"Current gateway: {gateway}")
|
589
|
+
|
590
|
+
# Set a configuration value
|
591
|
+
set_config_value("ipfs", "gateway", "https://dweb.link")
|
592
|
+
|
593
|
+
# Client will automatically use configuration values
|
594
|
+
client = HippiusClient()
|
595
|
+
```
|
596
|
+
|
435
597
|
## Development
|
436
598
|
|
437
599
|
```bash
|
@@ -585,3 +747,111 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|
585
747
|
|
586
748
|
This project is licensed under the MIT License - see the LICENSE file for details.
|
587
749
|
|
750
|
+
### Seed Phrase Management
|
751
|
+
|
752
|
+
For enhanced security, Hippius SDK supports encrypting your Substrate seed phrase with a password:
|
753
|
+
|
754
|
+
```bash
|
755
|
+
# Set a seed phrase in plain text
|
756
|
+
hippius seed set "your twelve word seed phrase here"
|
757
|
+
|
758
|
+
# Set a seed phrase and encrypt it with a password
|
759
|
+
hippius seed set "your twelve word seed phrase here" --encode
|
760
|
+
# You will be prompted to enter and confirm a password
|
761
|
+
|
762
|
+
# Check the status of your seed phrase
|
763
|
+
hippius seed status
|
764
|
+
|
765
|
+
# Encrypt an existing seed phrase with a password
|
766
|
+
hippius seed encode
|
767
|
+
# You will be prompted to enter and confirm a password
|
768
|
+
|
769
|
+
# Temporarily decrypt and view your seed phrase
|
770
|
+
hippius seed decode
|
771
|
+
# You will be prompted to enter your password
|
772
|
+
```
|
773
|
+
|
774
|
+
> **Note:** Password-based encryption requires both the `pynacl` and `cryptography` Python packages, which are included as dependencies when you install Hippius SDK.
|
775
|
+
|
776
|
+
To use password-based seed phrase encryption:
|
777
|
+
1. Set your seed phrase with encryption: `hippius seed set "your seed phrase" --encode`
|
778
|
+
2. You'll be prompted to enter and confirm a secure password
|
779
|
+
3. The seed phrase will be encrypted using your password and stored safely
|
780
|
+
4. When the SDK needs to use your seed phrase, you'll be prompted for your password
|
781
|
+
5. Your password is never stored - it's only used temporarily to decrypt the seed phrase
|
782
|
+
|
783
|
+
This provides enhanced security by:
|
784
|
+
- Protecting your seed phrase with a password only you know
|
785
|
+
- Never storing the seed phrase in plain text
|
786
|
+
- Using strong cryptography (PBKDF2 with SHA-256) to derive encryption keys
|
787
|
+
- Requiring your password every time the seed phrase is needed
|
788
|
+
|
789
|
+
When interacting with the Hippius SDK programmatically, you can provide the password when initializing clients:
|
790
|
+
|
791
|
+
```python
|
792
|
+
from hippius_sdk import HippiusClient
|
793
|
+
|
794
|
+
# The client will prompt for password when needed to decrypt the seed phrase
|
795
|
+
client = HippiusClient()
|
796
|
+
|
797
|
+
# Or you can provide a password when initializing
|
798
|
+
client = HippiusClient(seed_phrase_password="your-password")
|
799
|
+
```
|
800
|
+
|
801
|
+
### Multi-Account Management
|
802
|
+
|
803
|
+
Hippius SDK now supports managing multiple named accounts, each with their own seed phrase:
|
804
|
+
|
805
|
+
```bash
|
806
|
+
# Set a seed phrase for a named account
|
807
|
+
hippius seed set "your seed phrase here" --account "my-validator"
|
808
|
+
|
809
|
+
# Set another seed phrase for a different account
|
810
|
+
hippius seed set "another seed phrase" --account "my-developer-account" --encode
|
811
|
+
|
812
|
+
# List all configured accounts
|
813
|
+
hippius account list
|
814
|
+
|
815
|
+
# Switch the active account
|
816
|
+
hippius account switch my-developer-account
|
817
|
+
|
818
|
+
# Check the status of a specific account
|
819
|
+
hippius seed status --account my-validator
|
820
|
+
|
821
|
+
# Delete an account
|
822
|
+
hippius account delete my-developer-account
|
823
|
+
```
|
824
|
+
|
825
|
+
Key features of the multi-account system:
|
826
|
+
|
827
|
+
1. **Named Accounts**: Each account has a unique name for easy identification
|
828
|
+
2. **SS58 Address Storage**: Addresses are stored unencrypted for convenient access
|
829
|
+
3. **Active Account**: One account is designated as "active" and used by default
|
830
|
+
4. **Shared Password**: All accounts use the same password for encryption
|
831
|
+
5. **Separate Encryption**: Each account can choose whether to encrypt its seed phrase
|
832
|
+
|
833
|
+
To use multiple accounts in your code:
|
834
|
+
|
835
|
+
```python
|
836
|
+
from hippius_sdk import HippiusClient, set_active_account, list_accounts
|
837
|
+
|
838
|
+
# List all accounts
|
839
|
+
accounts = list_accounts()
|
840
|
+
for name, data in accounts.items():
|
841
|
+
print(f"{name}: {data.get('ss58_address')}")
|
842
|
+
|
843
|
+
# Switch the active account
|
844
|
+
set_active_account("my-validator")
|
845
|
+
|
846
|
+
# Create a client with the active account
|
847
|
+
client = HippiusClient(seed_phrase_password="your-password")
|
848
|
+
|
849
|
+
# Or specify a different account to use
|
850
|
+
client = HippiusClient(
|
851
|
+
account_name="my-developer-account",
|
852
|
+
seed_phrase_password="your-password"
|
853
|
+
)
|
854
|
+
```
|
855
|
+
|
856
|
+
The multi-account system makes it easier to manage multiple identities while maintaining security and convenience.
|
857
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
hippius_sdk/__init__.py,sha256=fs2pZ_wIl3eaUz6qFprcRsZhYakqv6-qm468NZh-8h4,1260
|
2
|
+
hippius_sdk/cli.py,sha256=RgRvBrrZ5PhFkfrkeGFP7byc1V_sbCJnLElrnCtr14A,76323
|
3
|
+
hippius_sdk/client.py,sha256=RV9MPs9nFW7dd8rVMgJ2giPrX6ETOnvlJDqm9uwuQi8,14908
|
4
|
+
hippius_sdk/config.py,sha256=NzAkmFaeE9-inHCCYL9cl97dZmSndx6OSgj9cQBWMAA,22872
|
5
|
+
hippius_sdk/ipfs.py,sha256=RKIDFuYqPFZfbHTi-oMa_IfAUUmtJX1nFOFnOKlnbBk,63972
|
6
|
+
hippius_sdk/substrate.py,sha256=ulLL3WcDHLm8eU_MuvqbzrCn2fbCdDDReJcxthMtFDw,29661
|
7
|
+
hippius-0.1.7.dist-info/METADATA,sha256=u_wKxSFdznRWbflR4OLBJ7XbFBXBEB_sQjohUv5UD9g,24689
|
8
|
+
hippius-0.1.7.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
9
|
+
hippius-0.1.7.dist-info/entry_points.txt,sha256=b1lo60zRXmv1ud-c5BC-cJcAfGE5FD4qM_nia6XeQtM,98
|
10
|
+
hippius-0.1.7.dist-info/RECORD,,
|
hippius_sdk/__init__.py
CHANGED
@@ -4,8 +4,52 @@ Hippius SDK - Python interface for Hippius blockchain storage
|
|
4
4
|
|
5
5
|
from hippius_sdk.client import HippiusClient
|
6
6
|
from hippius_sdk.ipfs import IPFSClient
|
7
|
+
from hippius_sdk.config import (
|
8
|
+
get_config_value,
|
9
|
+
set_config_value,
|
10
|
+
get_encryption_key,
|
11
|
+
set_encryption_key,
|
12
|
+
load_config,
|
13
|
+
save_config,
|
14
|
+
initialize_from_env,
|
15
|
+
get_all_config,
|
16
|
+
reset_config,
|
17
|
+
get_seed_phrase,
|
18
|
+
set_seed_phrase,
|
19
|
+
encrypt_seed_phrase,
|
20
|
+
decrypt_seed_phrase,
|
21
|
+
get_active_account,
|
22
|
+
set_active_account,
|
23
|
+
list_accounts,
|
24
|
+
delete_account,
|
25
|
+
get_account_address,
|
26
|
+
)
|
7
27
|
|
8
28
|
__version__ = "0.1.0"
|
9
|
-
__all__ = [
|
29
|
+
__all__ = [
|
30
|
+
"HippiusClient",
|
31
|
+
"IPFSClient",
|
32
|
+
"get_config_value",
|
33
|
+
"set_config_value",
|
34
|
+
"get_encryption_key",
|
35
|
+
"set_encryption_key",
|
36
|
+
"load_config",
|
37
|
+
"save_config",
|
38
|
+
"initialize_from_env",
|
39
|
+
"get_all_config",
|
40
|
+
"reset_config",
|
41
|
+
"get_seed_phrase",
|
42
|
+
"set_seed_phrase",
|
43
|
+
"encrypt_seed_phrase",
|
44
|
+
"decrypt_seed_phrase",
|
45
|
+
"get_active_account",
|
46
|
+
"set_active_account",
|
47
|
+
"list_accounts",
|
48
|
+
"delete_account",
|
49
|
+
"get_account_address",
|
50
|
+
]
|
51
|
+
|
52
|
+
# Initialize configuration from environment variables for backward compatibility
|
53
|
+
initialize_from_env()
|
10
54
|
|
11
55
|
# Note: Substrate functionality will be added in a future release
|