GithubHelp home page GithubHelp logo

fossilia / eospyo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from facings/eospyo

1.0 1.0 0.0 356 KB

Minimalist python library to interact with eosio blockchain networks

License: MIT License

Python 93.10% Makefile 0.24% Shell 3.74% C++ 2.67% Dockerfile 0.25%

eospyo's Introduction

Minimalist python library to interact with eosio blockchain networks

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

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 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.
  • 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 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 Send Message action

import eospyo


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

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

action = eospyo.Action(
    account="me.wam", # this is the contract account
    name="sendmsg", # 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

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

eospyo's People

Contributors

alparo avatar ebirbe avatar edinhodiluviano avatar encoderlee avatar fossilia avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.