Python implementation of the OnchFS (On-Chain File System) protocol for Tezos blockchain
Project description
OnchFS Python Client
Python client for the OnchFS (On-Chain File System) protocol on Tezos blockchain.
Installation
pip install pyonchfs
Quick Start
Download Files
from onchfs import OnchfsClient, Network
client = OnchfsClient(network=Network.MAINNET)
# Download directory
directory_hash = "f8020273fba472a3e87baf6eb0f3929915edabace0fa409a261c4c4fa6684b21"
files = client.download_directory(directory_hash, "downloaded/")
# Get specific file
content = client.get_file(directory_hash, "index.html")
Prepare Files for Upload
from onchfs import OnchfsClient, IFile, OnchfsPrepareOptions
client = OnchfsClient()
# Prepare files
files = [
IFile(path="hello.txt", content=b"Hello, OnchFS!"),
IFile(path="data.json", content=b'{"message": "test"}')
]
directory_inode = client.prepare_files(files)
directory_hash = client.get_directory_hash(directory_inode)
API
OnchfsClient
client = OnchfsClient(
network=Network.MAINNET, # MAINNET, GHOSTNET, LOCALNET
contract_address=None, # Optional custom contract
pytezos_client=None # Optional PyTezos client
)
Download Methods:
download_directory(hash, target_dir)- Download all filesget_file(hash, filename)- Get file contentget_file_metadata(hash, filename)- Get file metadatalist_directory(hash)- List directory contents
Preparation Methods:
prepare_files(files, options=None)- Prepare files for uploadprepare_directory(path, options=None)- Prepare directoryestimate_upload_cost(directory_inode)- Estimate costsget_directory_hash(directory_inode)- Get hash
Types
from onchfs import IFile, OnchfsPrepareOptions
file = IFile(path="example.txt", content=b"content")
options = OnchfsPrepareOptions(chunk_size=16384, compress=True)
Examples
Run the included examples:
python examples/download_example.py
python examples/prepare_example.py
Contract Addresses
- Mainnet:
KT1Ae7dT1gsLw2tRnUMXSCmEyF74KVkM6LUo - Ghostnet:
KT1FA8AGGcJha6S6MqfBUiibwTaYhK8u7s9Q
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyonchfs-0.1.2.tar.gz.
File metadata
- Download URL: pyonchfs-0.1.2.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6669ff4ff85d9781d35b1a404523b02e4fd493d2cec5f7021afc130e96516d3
|
|
| MD5 |
071fa74f212d91391f5dd9e2e8388636
|
|
| BLAKE2b-256 |
cebd19c387d3f14e5244f59eb7015fafed851a137e00732771bddd2a53574c4d
|
Provenance
The following attestation bundles were made for pyonchfs-0.1.2.tar.gz:
Publisher:
workflow.yml on objkt-com/pyonchfs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyonchfs-0.1.2.tar.gz -
Subject digest:
a6669ff4ff85d9781d35b1a404523b02e4fd493d2cec5f7021afc130e96516d3 - Sigstore transparency entry: 527215687
- Sigstore integration time:
-
Permalink:
objkt-com/pyonchfs@a34e22527beb1178eae2b451ba780de6c57cd61f -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/objkt-com
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@a34e22527beb1178eae2b451ba780de6c57cd61f -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyonchfs-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyonchfs-0.1.2-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1604aad52bc3f746de20412cad0089a94eb8cca5e0fb9653b80a6ac56669fe74
|
|
| MD5 |
1435e06c4ac9b749ffc247a6db7f05cc
|
|
| BLAKE2b-256 |
46ff2e2a4fcf3c709103100da9e9e20db318ebaa12b9d7051e64f111ffc7e846
|
Provenance
The following attestation bundles were made for pyonchfs-0.1.2-py3-none-any.whl:
Publisher:
workflow.yml on objkt-com/pyonchfs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyonchfs-0.1.2-py3-none-any.whl -
Subject digest:
1604aad52bc3f746de20412cad0089a94eb8cca5e0fb9653b80a6ac56669fe74 - Sigstore transparency entry: 527215712
- Sigstore integration time:
-
Permalink:
objkt-com/pyonchfs@a34e22527beb1178eae2b451ba780de6c57cd61f -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/objkt-com
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@a34e22527beb1178eae2b451ba780de6c57cd61f -
Trigger Event:
push
-
Statement type: