Skip to main content

aioeos

Documentation Status codecov Python package Upload Python Package

Async Python library for interacting with EOS.io blockchain.

Features

  1. Async JSON-RPC client.
  2. Signing and verifying transactions using private and public keys.
  3. Serializer for basic EOS.io blockchain ABI types.
  4. Helpers which provide an easy way to generate common actions, such as token transfer.

Installation

Library is available on PyPi, you can simply install it using pip.

$ pip install aioeos

Usage

Importing a private key

from aioeos import EosAccount

account = EosAccount(private_key='your key')

Transferring funds

from aioeos import EosJsonRpc, EosTransaction
from aioeos.contracts import eosio_token


rpc = EosJsonRpc(url='http://127.0.0.1:8888')
block = await rpc.get_head_block()

transaction = EosTransaction(
   ref_block_num=block['block_num'] & 65535,
   ref_block_prefix=block['ref_block_prefix'],
   actions=[
      eosio_token.transfer(
         from_addr=account.name,
         to_addr='mysecondacc1',
         quantity='1.0000 EOS',
         authorization=[account.authorization('active')]
      )
   ]
)
await rpc.sign_and_push_transaction(transaction, keys=[account.key])

Creating a new account

from aioeos import EosJsonRpc, EosTransaction, EosAuthority
from aioeos.contracts import eosio


main_account = EosAccount(name='mainaccount1', private_key='private key')
new_account = EosAccount(name='mysecondacc1')
owner = EosAuthority(
   threshold=1,
   keys=[new_account.key.to_key_weight(1)]
)

rpc = EosJsonRpc(url='http://127.0.0.1:8888')
block = await rpc.get_head_block()

await rpc.sign_and_push_transaction(
   EosTransaction(
      ref_block_num=block['block_num'] & 65535,
      ref_block_prefix=block['ref_block_prefix'],
      actions=[
            eosio.newaccount(
               main_account.name,
               new_account.name,
               owner=owner,
               authorization=[main_account.authorization('active')]
            ),
            eosio.buyrambytes(
               main_account.name,
               new_account.name,
               2048,
               authorization=[main_account.authorization('active')]
            )
      ],
   ),
   keys=[main_account.key]
)

Documentation

Docs and usage examples are available here.

Unit testing

To run unit tests, you need to bootstrap an EOS testnet node first. Use the provided ensure_eosio.sh script.

$ ./ensure_eosio.sh

Metadata

Release files for aioeos 1.0.2

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

Source distribution (sdist)

Source distribution for aioeos 1.0.2
File Size Uploaded
aioeos-1.0.2.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aioeos 1.0.2
File Interpreter ABI Platform
aioeos-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 31.6 kB

Release files / aioeos-1.0.2.tar.gz

Download URL aioeos-1.0.2.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dbad5e5aed1c684049d3b85ffe370ebaccb1cbaefe4492f669f331853a6ee3fa
BLAKE2b-256 checksum
How to use checksums
7bf099f8ce3c511b9dd3f2c0896de1698710ecce1cd6f074305bf7f43e131e93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.2 Linux/5.0.0-1035-azure

Release files / aioeos-1.0.2-py3-none-any.whl

Download URL aioeos-1.0.2-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de36956152f49dcddbd1197ed94bd826785eccb1c754f408a419e408bd437f50
BLAKE2b-256 checksum
How to use checksums
f64e862db4948d65869884e6c6eb9f76432e4ceedd934ce093f4ef671a2f944a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.2 Linux/5.0.0-1035-azure

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

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