asynceth
An asyncio ethereum jsonrpc library
Install
pip install asynceth
Usage Example
import asyncio
from asynceth import JsonRPCClient
from asynceth import Contract
async def example_jsonrpc_request():
client = JsonRPCClient("http://localhost:8485")
balance = await client.eth_getBalance("0x0000000000000000000000000000000000000000")
print(balance)
asyncio.get_event_loop().run_until_complete(example_jsonrpc_request())
greeter_code = """
contract Greeter is Mortal {
/* Define variable greeting of the type string */
string greeting;
/* This runs when the contract is executed */
function Greeter(string _greeting) public {
greeting = _greeting;
}
/* Main function */
function greet() constant returns (string) {
return greeting;
}
}
"""
# NOTE: example requires `solc` to be installed, and private_key must be the private key to an
# account on the ethereum node pointed to by JsonRPCClient that has funds to deploy the contract
private_key = os.urandom(32)
async def example_contract_deployment():
client = JsonRPCClient("http://localhost:8485")
greeter = await Contract(client, greeter_code).set_signer(private_key).deploy("Hello World")
greeting = await greeter.greet()
assert greeting == "Hello World"
asyncio.get_event_loop().run_until_complete(example_contract_deployment())
Running tests
python setup.py test
OR
virtualenv -p python3 env
env/bin/pip install -r requirements.txt -r requirements-testing.txt
env/bin/py.test
History
0.0.1
- Initial release
Metadata
Release files for asynceth 0.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asynceth-0.0.12.tar.gz | 14.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asynceth-0.0.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.3 kB
Release files / asynceth-0.0.12.tar.gz
| Download URL | asynceth-0.0.12.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28c1f90c8702205bbef0ccf2087f2ea3c3446015c1f3489d5e59d395d2010b9b
|
|
BLAKE2b-256 checksum How to use checksums |
73234176a7874f980a8118ba0be31f1b49cc310dd97e822da72769ae6c8efc7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4
|
Release files / asynceth-0.0.12-py3-none-any.whl
| Download URL | asynceth-0.0.12-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4ce91a3fa5555820dc2ec0c96790f4ef11de50932dcb83f2aa4e2dc645b5415
|
|
BLAKE2b-256 checksum How to use checksums |
5b5f4079f1a52e0a89bb5bee61b529adc79c0c4254e6700e79c5970a72aa93bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4
|