Skip to main content

Interact with Antelope blockchains

Project description

Minimalist python library to interact with antelope blockchain networks

Test PyPI - Python Version version GitHub repo size GitHub last commit

What is it?

pyntelope is a python library to interact with Antelope blockchains.
Its main focus are server side applications.
This library is heavily influenced by µEOSIO. Many thanks to them for the astonishing job!

Main features

  • Send transactions Its main usage today is to send transactions to the blockchain
  • Statically typed This library enforces and verifies types and values.
  • Serialization pyntelope serializes the transaction before sending to the blockchain.
  • Paralellization Although python has the GIL we try to make as easier as possible to paralellize the jobs.
    All data is as immutable and all functions are as pure as we can make them.

Stability

This work is in alpha version. That means that we make constant breaking changes to its api.
Also there are known (and, of course unknown) bugs and various limitations.
Given that, we at FACINGS have been using this library in production for over an year now.
However we'd advise for you to fix its version when deploying to prod.

Using

Just pip install pyntelope and play around.
(we don't support, and have no plans to support conda)
Rather then starting with long docs, just a simple example:

Use Send Message action

import pyntelope


print("Create Transaction")
data=[
    pyntelope.Data(
        name="from",
        value=pyntelope.types.Name("me.wam"), 
    ),
    pyntelope.Data(
        name="message",
         value=pyntelope.types.String("hello from pyntelope"),
    ),
]

auth = pyntelope.Authorization(actor="me.wam", permission="active")

action = pyntelope.Action(
    account="me.wam", # this is the contract account
    name="sendmsg", # this is the action name
    data=data,
    authorization=[auth],
)

raw_transaction = pyntelope.Transaction(actions=[action])

print("Link transaction to the network")
net = pyntelope.WaxTestnet()  # this is an alias for a testnet node
# notice that pyntelope returns a new object instead of change in place
linked_transaction = raw_transaction.link(net=net)


print("Sign transaction")
key = "a_very_secret_key"
signed_transaction = linked_transaction.sign(key=key)


print("Send")
resp = signed_transaction.send()

print("Printing the response")
resp_fmt = json.dumps(resp, indent=4)
print(f"Response:\n{resp_fmt}")

There are some other examples here

Known bugs

multi-byte utf-8 characters can not be serialized

  • Serialization of multi-byte utf-8 characters is somewhat unpredictable in the current implementation, therfore any String input containing multi-utf8 byte characters will be blocked for the time being.

Contributing

All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.
If you find a bug, just open a issue with a tag "BUG".
If you want to request a new feature, open an issue with a tag "ENH" (for enhancement).
If you feel like that our docs could be better, please open one with a tag "DOC".
Although we have the next few steps already planned, we are happy to receive the community feedback to see where to go from there.

Development

If you want to develop for pyntelope, here are some tips for a local development environment. We'll be more then happy to receive PRs from the community. Also we're going full Black and enforcing pydocstyle and isort (with the limitations described in the .flake8 file)

Setup

Create a virtual env Ensure the dependencies are met:

pip install poetry
poetry install

Run tests

The tests are run against a local network.
Before running the tests you'll need to docker-compose up to create the local network, users and contracts used in the tests.
When ready, just:

pytest

Some tests are marked as "slow".
You can skip them and run the test suite faster with:

pytest -m "not slow"

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

pyntelope-0.8.6.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

pyntelope-0.8.6-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file pyntelope-0.8.6.tar.gz.

File metadata

  • Download URL: pyntelope-0.8.6.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.10 Linux/6.1.0-9-amd64

File hashes

Hashes for pyntelope-0.8.6.tar.gz
Algorithm Hash digest
SHA256 7a33265b933291fefef661b9ebc820ba979762d6d2fe5865caf33f6de2ea0df9
MD5 fcd2a28a2df520aecd1daae1579aec5f
BLAKE2b-256 1c7a5cd3560b94e49a93b035d6b35c7d0815ad128c16566636648ef4195b5342

See more details on using hashes here.

File details

Details for the file pyntelope-0.8.6-py3-none-any.whl.

File metadata

  • Download URL: pyntelope-0.8.6-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.10 Linux/6.1.0-9-amd64

File hashes

Hashes for pyntelope-0.8.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b105fcef92a1be81bd94ff3154b7b181e3eb0f4b9d7b317e7c9d075ab237f1de
MD5 5b7b5151909eff2bc0a501c775d83b06
BLAKE2b-256 f75bbdc0971e72ae3fa609467bbea044d8d281a41ae68f2c44ce72f13d403e4c

See more details on using hashes here.

Supported by

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