crust-file-uploader
https://crust.network/ https://apps.crust.network/ https://wiki.crust.network/en https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc-shadow.crust.network%2F#/explorer
This is a simple tool to pin your files sing Crust Network or Crust Shadow.
Setup
Installation:
pip3 install crust-interface-patara
Features
The module is divided into Mainnet and Shadow
Mainnet provides Crust interaction functionality to check user balance, calculate file storage price, placing
file storage order, add tokens to renewal pool and checking replicas count.
import time
from crustinterface import Mainnet
from substrateinterface import KeypairType
seed = "seed"
mainnet = Mainnet(seed=seed, crypto_type=KeypairType.SR25519)
# get any IPFS CID and size
cid, size = "QmbJtyu82TQSHU52AzRMXBENZGQKYqPsmao9dPuTeorPui", 18 # <any way to get an IPFS CID and size. One may use ipfshttpclient2 from IPFS-Toolkit>
# Check balance
balance = mainnet.get_balance()
print(balance)
# Check price in Main net. Price in pCRUs
price = mainnet.get_appx_store_price(int(size))
print(price)
# Store file in Mainnet for CRUs
file_stored = mainnet.store_file(cid, size)
print(file_stored)
# Add renewal pool
file_prepaid = mainnet.add_renewal_pool_balance(cid, price*2)
print(file_prepaid)
# Get replicas
time.sleep(10)
replicas = mainnet.get_replicas(cid)
print(replicas)
Shadow allows you to perform Xstorage extrinsic in Crust Shadow network.
from crustinterface import Shadow
from substrateinterface import KeypairType
seed = "seed"
shadow = Shadow(seed=seed, crypto_type=KeypairType.SR25519)
# get any IPFS CID and size
cid, size = "QmbJtyu82TQSHU52AzRMXBENZGQKYqPsmao9dPuTeorPui", 18 # <any way to get an IPFS CID and size. One may use ipfshttpclient2 from IPFS-Toolkit>
print(cid, size)
# Check balance
balance = shadow.get_balance()
print(balance)
# Store file in Shadow for CSMs
file_stored = shadow.store_file(cid, size)
print(file_stored)
Parachain allows you to perform Xstorage extrinsic in Crust Polkadot Parachain network.
from crustinterface import Parachain
from substrateinterface import KeypairType
seed = "seed"
parachain = Parachain(seed=seed, crypto_type=KeypairType.SR25519)
# get any IPFS CID and size
cid, size = "QmbJtyu82TQSHU52AzRMXBENZGQKYqPsmao9dPuTeorPui", 18 # <any way to get an IPFS CID and size. One may use ipfshttpclient2 from IPFS-Toolkit>
print(cid, size)
# Check balance
balance = parachain.get_balance()
print(balance)
# Store file in Shadow for CSMs
file_stored = parachain.store_file(cid, size)
print(file_stored)
Metadata
Release files for crust-interface-patara 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| crust_interface_patara-0.2.0.tar.gz | 9.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| crust_interface_patara-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.5 kB
Release files / crust_interface_patara-0.2.0.tar.gz
| Download URL | crust_interface_patara-0.2.0.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7107124897a26f4f9a9791d2bf1d75187a43144eb10c48a0c53a6a53d338dfb6
|
|
BLAKE2b-256 checksum How to use checksums |
917389bf1c654b94f83839a75bf6a02bee77e136f05fea1c1e81427bbe3f0863
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.6 Linux/6.5.0-10027-tuxedo
|
Release files / crust_interface_patara-0.2.0-py3-none-any.whl
| Download URL | crust_interface_patara-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d034e9a704805821fefd08a9584b07f996cbdfc388058910b8800c681b2a4803
|
|
BLAKE2b-256 checksum How to use checksums |
3b4f33ede37c1ed8e1f65e7018760c6d7e57cc42e750ec410142c80002e66cc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.6 Linux/6.5.0-10027-tuxedo
|