Skip to main content

pip install hcs-grpc-client

This is a Hedera Consensus Service (HCS) gRPC mirror node API Python client.

It only has functionality to subscribe to a HCS topic on mirror node.

For mirror node REST API, use curl or something like Python requests.

For all other interactions with Hedera, use an SDK: Python, Java, Javascript, or Go.

How to Use

import grpc
from hcs_grpc_client import TopicID, ConsensusTopic, ConsensusServiceStub
request = ConsensusTopicQuery(topicID=TopicID(2010293))
channel = grpc.insecure_channel("hcs.testnet.mirrornode.hedera.com:5600")
stub = ConsensusServiceStub(channel)
stream = stub.subscribeTopic(request)
for resp in stream:
    # do whatever you need
    print(resp)

Make sure the topic exists or create your own topic with an SDK. An example is given in examples/.

See examples for mainnet example and other usages.

How to Build

(Ignore this section unless you want to customized the client and/or want to contribute to this project)

Clone this repo:

git clone --recurse-submodules https://github.com/wensheng/hcs-grpc-api-py-client.git

Setup virtual env for python then install dependencies:

cd hcs-grpc-api-py-client
python3 -m venv venv
./venv/bin/python install -r requirements.txt

Generate code (compile .proto to .py):

./compile.sh  # make sure deps.txt match compile_deps.sh
./compile_deps.sh

Build package:

rm -fr build dist
./venv/bin/python -m build

Test package:

./venv/bin/pip uninstall hcs-grpc-client
./venv/bin/pip install dist/hcs-grpc-client-(current_version)-py3-none-any.whl

Upload to Pypi (don't do this unless you're me):

python -m twine upload dist/*

Metadata

Release files for hcs-grpc-client 0.20.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hcs-grpc-client 0.20.0
File Size Uploaded Provenance
hcs-grpc-client-0.20.0.tar.gz 20.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hcs-grpc-client 0.20.0
File Interpreter ABI Platform
hcs_grpc_client-0.20.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.5 kB

Release files / hcs-grpc-client-0.20.0.tar.gz

Download URL hcs-grpc-client-0.20.0.tar.gz
Size 20.8 kB
Tags Source
SHA-256 checksum
How to use checksums
af1fcc272bfb26269e83788cfaaa7196d09959ca79ed02da71567129e830bd76
BLAKE2b-256 checksum
How to use checksums
2566c4c9512d6adbf4273c0238ea2dd46286ea51b6cc844b460df80e3b225288
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release files / hcs_grpc_client-0.20.0-py3-none-any.whl

Download URL hcs_grpc_client-0.20.0-py3-none-any.whl
Size 22.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdc456a6b1654756fb379211cd00094fafced2f2fe01dba86c5d02cfdd9ee7e3
BLAKE2b-256 checksum
How to use checksums
1ed16cd12bf4222243cb3d8801f13c06bbf7b4d634539d1028ac9406fdde9ccb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Security for hcs-grpc-client 0.20.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page