Ethereum RPC client library for the PEP 3156 Python event loop.
ujson support | Yes |
uvloop support | Yes |
High-level APIs | Yes |
HTTP support | Yes |
Unix domain socket (IPC) support | Yes |
SSL/TLS support | Yes |
Tested CPython versions | 3.4, 3.5, 3.6 |
Tested Geth versions | 1.7.0 |
Implemented RPC apis | admin, db, debug, eth, miner, net, personal, shh, txpool, web3 |
http://aioethereum.readthedocs.io/
Simple high-level interface (through HTTP):
import asyncio
import aioethereum
loop = asyncio.get_event_loop()
async def go():
client = await aioethereum.create_ethereum_client(
'http://localhost:8545', loop=loop)
val = await client.web3_clientVersion()
print(val)
loop.run_until_complete(go())
# will print like 'Geth/v1.7.0-stable-6c6c7b2a/darwin-amd64/go1.9'
or via IPC
import asyncio
import aioethereum
loop = asyncio.get_event_loop()
async def go():
client = await aioethereum.create_ethereum_client(
'ipc://<path_to_unix_socket>', loop=loop)
val = await client.web3_clientVersion()
print(val)
loop.run_until_complete(go())
# will print like 'Geth/v1.7.0-stable-6c6c7b2a/darwin-amd64/go1.9'
Note
ujson is preferred requirement. Pure C JSON encoder and decoder is implemented as well and can be used automatically when installed.
The aioethereum is offered under MIT license.