Skip to main content

Ethernity Cloud logo

The Python implementation of the Ethernity CLOUD SDK protocol

Ethernity Cloud SDK PY

This project provides a set of tools and scripts to work with the Ethernity Cloud SDK in a python environment.

Table of Contents

Installation

To install the package and its dependencies, run:

python -m venv venv

source venv/bin/activate # for MacOS and Linux
venv\Scripts\activate # for Windows

pip install ethernity-cloud-sdk-py

Usage

After installation, you can use the provided scripts to build, publish, and initialize your project.

Pre-requisites

The sdk requires the following to be installed on your system:

  • python 3.10+
  • docker (daemon running in the background for build and publish scripts)
  • docker-compose (for the build and publish scripts)

Operating System compatibility

The sdk has been tested on the following operating systems:

  • Windows 10
  • linux (Ubuntu 20.04)

Blockchain compatibility

  • Bloxberg:
    • Testnet - tested and working
    • Mainnet - to be provided during the following updates
  • Polyhon:
    • Amoy Testnet - to be provided during the following updates
    • Mainnet - to be provided during the following updates

Scripts

  • Initialize: To initialize the project, run:

    ecld-init
    

    at this step, all the initial configurations will be set up and the project will be ready to be built, published and run.

  • Build: To build the project, run:

    ecld-build
    

    the project will be built and the docker repository output will be stored in the registry/ directory. This is the stage where the backend functions are added to the secure images.

  • Publish: To publish the project, run:

    ecld-publish
    

    Required after build, to build and integrate the secure certificates that will be used during executions and to register the project to the Ethernity Cloud Image Register.

  • Run: To run the project, run:

    python src/ethernity_task.py
    

    command to start the demo application and test the integration.

Usage

To use the SDK:

  • after installation, run ecld-init to initialize the project
  • in you workspace, you will find the scr/serverless directory, this contains a backend.py file. This file will be imported in the dApp images to provide the backend functions for calling from the frontend of your application, eg.:
def hello(msg='World'):
    return "Hello "+msg

From your py application, using the ethernity cloud runner library, you will be calling the function as seen in the below example, where we pass hello("World") to be executed on the backend which will run in the Blockchain:

import os
import sys
from dotenv import load_dotenv

load_dotenv()

from ethernity_cloud_runner_py.runner import EthernityCloudRunner  # type: ignore


def execute_task() -> None:
    ipfs_address = "http://ipfs.ethernity.cloud:5001/api/v0"

    code = 'hello("Hello, Python World!")'

    runner = EthernityCloudRunner()
    runner.initialize_storage(ipfs_address)

    resources = {
        "taskPrice": 8,
        "cpu": 1,
        "memory": 1,
        "storage": 1,
        "bandwidth": 1,
        "duration": 1,
        "validators": 1,
    }
    # this will execute a new task using Python template and will run the code provided above
    # the code will run on the TESTNET network
    runner.run(
        os.getenv("PROJECT_NAME"),
        code,
        "0xd58f5C1834279ABD601df85b3E4b2323aDD4E75e",
        resources,
        os.getenv("ENCLAVE_NAME_TRUSTEDZONE", ""),
    )


if __name__ == "__main__":
    execute_task()
  • you are able to define the functions needed to be used in the backend, while making sure that the function that is script is compilable and that it exports the function that will be called from the frontend, in the above example, the hello function.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the AGPL-3.0 License. See the LICENSE file for details.

Metadata

Release files for etny-sdk-py 0.1.31

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

Source distribution (sdist)

Source distribution for etny-sdk-py 0.1.31
File Size Uploaded Provenance
etny-sdk-py-0.1.31.tar.gz 919.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for etny-sdk-py 0.1.31
File Interpreter ABI Platform
etny_sdk_py-0.1.31-py3-none-any.whl Python 3 none any Details

Total release size: 2.1 MB

Release files / etny-sdk-py-0.1.31.tar.gz

Download URL etny-sdk-py-0.1.31.tar.gz
Size 919.4 kB
Tags Source
SHA-256 checksum
How to use checksums
772c5c9bda4d36e278630f67ac513b5cf52d4e5c0ec9f770f19c6711fa64afb1
BLAKE2b-256 checksum
How to use checksums
b8e43e097bf4195233d09864b731a7ecb58166bcb30e6120aaec44783ed3bcbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.7

Release files / etny_sdk_py-0.1.31-py3-none-any.whl

Download URL etny_sdk_py-0.1.31-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2aa1c612636a571fe75d10d5f0c15bdf79eb0f7b4a3d7f41c480c8081b1224d0
BLAKE2b-256 checksum
How to use checksums
f451228bfb1676415a6feee1429b97204507a31fee4fcefd07d31442348b4c52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.7

Security for etny-sdk-py 0.1.31

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.

Release history Release notifications | RSS feed

This release

0.1.31 This release

2 release files No provenance

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