A simple tool to interact with Crust Shadow and Crust Mainnet. Under development
Project description
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 crust-interface-patara import Mainnet
seed = "seed"
mainnet = Mainnet(seed=seed)
# 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 crust_file_uploader import Shadow
seed = "seed"
shadow = Shadow(seed=seed)
# 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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for crust_interface_patara-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44b08ca92b846ecf44230d9e3d9e2b1f8db8ba4bf4aeac138b93832b7d4ab876 |
|
MD5 | dc63910eca947f2fb444bee98b3ccfaf |
|
BLAKE2b-256 | 9743586fca530fe679fbd301a0e120e276a07c6867c164d1e3da0f852a3d6083 |
Close
Hashes for crust_interface_patara-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b04f2595a20fee97b5ea64aa5c5ec30ae90ceef86f2237934f9b4fdf43730a2 |
|
MD5 | aa06c12cd757dee01bc416ed36eb423b |
|
BLAKE2b-256 | 81579b19b794013c2d5d79443f8b9cd80c048a3558c69d0f45c846f71823f0e1 |