Skip to main content

GenLayer Python SDK

Project description

GenLayerPY

License: MIT Discord Twitter

About

GenLayerPY SDK is a python library designed for developers building decentralized applications (Dapps) on the GenLayer protocol. This SDK provides a comprehensive set of tools to interact with the GenLayer network, including client creation, transaction handling, event subscriptions, and more, all while leveraging the power of web3.py as the underlying blockchain client.

Prerequisites

Before installing GenLayerPY SDK, ensure you have the following prerequisites installed:

  • Python (>=3.8)

🛠️ Installation and Usage

To install the GenLayerPY SDK, use the following command:

$ pip install genlayer-py

Here’s how to initialize the client and connect to the GenLayer Simulator:

Reading a Transaction

from genlayer_py import create_client
from genlayer_py.chains import localnet

client = create_client(
    chain=localnet,
)

transaction_hash = "0x..."

transaction = client.get_transaction(hash=transaction_hash)

Reading a contract

from genlayer_py import create_client
from genlayer_py.chains import localnet

client = create_client(
    chain=localnet,
)

result = client.read_contract(
    address=contract_address,
    function_name='get_complete_storage',
    args=[],
    state_status='accepted'
)

Writing a transaction

from genlayer_py.chains import localnet
from genlayer_py import create_client, create_account

client = create_client(
    chain=localnet,
)

account = create_account()

transaction_hash = client.write_contract(
    account=account,
    transaction=transaction,
    address=contract_address,
    function_name='account',
    args=['new_storage'],
    value=0, // value is optional, if you want to send some native token to the contract
)
receipt = client.wait_for_transaction_receipt(
    hash=transaction_hash,
    status=TransactionStatus.FINALIZED // or ACCEPTED
)

🚀 Key Features

  • Client Creation: Easily create and configure a client to connect to GenLayer’s network.
  • Transaction Handling: Send and manage transactions on the GenLayer network.
  • Gas Estimation*: Estimate gas fees for executing transactions on GenLayer.

* under development

📖 Documentation

For detailed information on how to use GenLayerPY SDK, please refer to our documentation.

Contributing

We welcome contributions to GenLayerPY SDK! Whether it's new features, improved infrastructure, or better documentation, your input is valuable. Please read our CONTRIBUTING guide for guidelines on how to submit your contributions.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

genlayer_py-0.5.0.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genlayer_py-0.5.0-py3-none-any.whl (36.8 kB view details)

Uploaded Python 3

File details

Details for the file genlayer_py-0.5.0.tar.gz.

File metadata

  • Download URL: genlayer_py-0.5.0.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for genlayer_py-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2772f371a1602a7fafd4a1625f9f0f8d2f69aa31285c6d608176e9f0b4210134
MD5 783f320ded1b8304952e0f57b2156de5
BLAKE2b-256 baf45f9ff7aff3d7921dc4f1b95c4e7cd7f7b3bb5683ebe1ad082a84f82412e6

See more details on using hashes here.

File details

Details for the file genlayer_py-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: genlayer_py-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 36.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for genlayer_py-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ccfa8ad8a1853b9f46f9670b8923b14d385924700cb2ed94406a89e83446a23
MD5 c1ae8134c64c3d2a0aef449c8f5fd523
BLAKE2b-256 1a8e9b7695fc6af1396816e2607bd6e93e7f5641a28e204aa0735ba2262555f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page