Skip to main content

Remme icon

Remme Python Client

Release PyPI version shields.io PyPI Downloads Documentation status PyPI license PyPI pyversions

An open source Python integration library for REMChain, simplifying the access and interaction with Remme nodes both public or permissioned.

How to use

1. Install Remme protocol

Install and run Remme protocol with required RPC API methods enabled.

You can check out how to do that at Remme core repo.

2. Install dependencies:

Before installing the library, make sure that all the dependencies listed are installed.

Required by one of the requirements system packages list

$ sudo apt-get update
$ sudo apt-get install python3-dev python3-setuptools -y
$ sudo apt-get install build-essential automake libtool pkg-config libffi-dev -y

3. Install library

Install the latest version of library to your Python project from terminal using pip:

$ pip3 install remme

Examples

Remme client

from remme import Remme
from remme.models.account.account_type import AccountType

account_config = {
    'private_key_hex': 'f4f551c178104595ff184f1786ddb2bfdc74b24562611edcab90d4729fb4bab8', 
    'account_type': AccountType.USER,
}
network_config = {
    'node_address': 'localhost:8080', 
    'ssl_mode': False,
}

remme = Remme(account_config=account_config, network_config=network_config)

Tokens

remme_address = '1120077f88b0b798347b3f52751bb99fa8cabaf926c5a1dad2d975d7b966a85b3a9c21'

balance = await remme.token.get_balance(address=remme_address)
print(f'Account — {remme_address}, balance — {balance} REM.')

transaction_result = await remme.token.transfer(address_to=remme_address, amount=10)
print(f'Transaction batch id: {transaction_result.batch_id}')

Certificates

certificate_transaction_result = await remme.certificate.create_and_store(
        common_name='user_name',
        email='user@email.com',
        name='John',
        surname='Smith',
        country_name='US',
        validity=360,
        serial=str(datetime.now())
    )
certificate = certificate_transaction_result.certificate

while True:

    try:
        info = await remme.certificate.get_info(certificate)
        print(f'Info: {info.data}')

        certificate_status = await remme.certificate.check(certificate)
        print(f'Certificate is valid: {certificate_status}')
        break

    except RpcGenericServerDefinedError:
        continue

Subscribing to Events

RemmeEvents is enums which describe all available events.

from remme.models.websocket.events import RemmeEvents

events = await remme.events.subscribe(events=RemmeEvents.AtomicSwap.value)

async for response in events:

    print("connected")
    
    if isinstance(response, dict):
        print(response)
    
    else:
        print(f'State: {response.state}')
        print(f'Sender address: {response.sender_address}')
        print(f'Receiver address: {response.receiver_address}')
        print(f'Amount: {response.amount}')

Also we give a possibility to start listen events from previous block by providing last known block id.

from remme.models.websocket.events import RemmeEvents

events = await remme.events.subscribe(
    events=RemmeEvents.AtomicSwap.value, 
    last_known_block_id='db19f0e3b3f001670bebc814e238df48cef059f3f0668f57702ba9ff0c4b8ec45c7298f08b4c2fa67602da27a84b3df5dc78ce0f7774b3d3ae094caeeb9cbc82',
)

async for response in events:

    print("connected")
    
    if isinstance(response, dict):
        print(response)
    
    else:
        print(f'State: {response.state}')
        print(f'Sender address: {response.sender_address}')
        print(f'Receiver address: {response.receiver_address}')
        print(f'Amount: {response.amount}')

Unsubscribe from listening events.

await remme.events.unsubscribe(events=RemmeEvents.AtomicSwap.value)

Contributing

Clone the project and install requirements:

$ git clone git@github.com:Remmeauth/remme-client-python.git && cd remme-client-python
$ pip3 install -r requirements.txt
$ pip3 install -r requirements-dev.txt

If you prefer working with the Docker, follow:

$ git clone git@github.com:Remmeauth/remme-client-python.git && cd remme-client-python
$ docker build -t remme-client-python . -f Dockerfile
$ docker run -v $PWD:/remme-client-python --name remme-client-python remme-client-python

Enter the container bash, check Python version and run tests:

$ docker exec -it remme-client-python bash
$ root@98247c92404d:/remme-client-python# python --version
$ root@98247c92404d:/remme-client-python# pytest -vv tests

Clean container and images with the following command:

$ docker rm $(docker ps -a -q) -f
$ docker rmi $(docker images -q) -f

License

Remme software and documentation are licensed under Apache License Version 2.0 <LICENSE>.

Metadata

Release files for remme 1.1.1

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

Source distribution (sdist)

Source distribution for remme 1.1.1
File Size Uploaded Provenance Actions
remme-1.1.1.tar.gz 60.3 kB Without provenance Details for remme-1.1.1.tar.gz

Release files / remme-1.1.1.tar.gz

Download URL remme-1.1.1.tar.gz
Size 60.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cabccaeac154f8904589dd56ac34aa44125a678c679fcae2c38dd494fb63a1fb
BLAKE2b-256 checksum
How to use checksums
b8e15871831a2979943b8fa130000a9c59a5a2635dc4401e2064662f3a249c8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

Security for remme 1.1.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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