Skip to main content

Interact with EOSIO blockchain networks

Project description

Minimalist python library to interact with eosio blockchain networks

What is it?

eospyo is a python library to interact with EOSIO blockchains.
Its main focus are server side applications.
This library is heavily influenced (and still uses some pieces of code from) 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
    eospyo serializes the transaction before sending to the blockchain.
    However it doesn't serialize the data field.
  • 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 some few months now.
However we'd advise for you to fix its version when deploying to prod.

Using

Just pip install eospyo 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 AtomicAssets transfer action

import json

import eospyo

print("Create Transaction")
data = {
    "from": "facings",
    "to": "youraccount",
    "asset_ids": [123],
    "memo": "FACINGS to the moon",
}

auth = eospyo.Authorization(
    actor="facings",
    permission="active",
)

action = eospyo.Action(
    account="atomicassets",  # this is the contract account
    name="transfer",  # this is the action name
    data=data,
    authorization=[auth],
)

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


print("Link transaction to the network")
net = eospyo.WaxTestnet()  # this is an alias for a testnet node
# notice that eospyo 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

Keys not working

  • Some keys are reported to not work. However this error was not replicated and the cause remains unknown. If you can share a key pair that is not working it would be very helpful.

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 eospyo, 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

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

eospyo-0.5.6.tar.gz (12.7 kB view hashes)

Uploaded Source

Built Distribution

eospyo-0.5.6-py3-none-any.whl (11.9 kB view hashes)

Uploaded Python 3

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