Pleth: Ethereum Library For Humans
Pleth is a project that aims to provide human-friendly interfaces for common ethereum operations. Pleth is written in pure python and almost zero dependencies except the standard library.
Installation
$ pip install pleth
# or
$ git clone https://github.com/libraries/pleth
$ cd pleth
$ python -m pip install --editable .
Usage
By default, pleth is configured on the develop. To switch networks, use pleth.config.current = pleth.config.mainnet.
example/addr.py
Calculate the address from a private key.
$ python example/addr.py --prikey 0x1
# 0x7e5f4552091a69125d5dfcb7b8c2659029395bdf
example/balance.py
Get the balance by an address.
$ python example/balance.py --addr 0x7e5f4552091a69125d5dfcb7b8c2659029395bdf
# 39934.9989371221
example/collision.py
Generate a random private key and check whether there are assets under the private key.
$ python example/collision.py --net mainnet
example/scan_erc20.py
Print all usdt transfer events in the last block.
$ python example/scan_erc20.py
# 0x4d74d6fb5a75d121cda9f9dfbd0bd074999b43731f17140606ea57eccb5a7192
# 0x11b815efb8f581194ae79006d24e0d814b7697f6 0xa69babef1ca67a37ffaf7a485dfff3382056e78c 135241.983213
# ...
example/scan_eth.py
Get the latest block and print out the transaction hash, sender, receiver and value(in ether).
$ python example/scan_eth.py --net mainnet
# 0x41733e4e2b1537c9be99ad591c2e2a608dbff547ebd91acbb65e9a205aceb3ff
# 0x9ab23085cb3e847d37819a712512dfd5d60c8d88 0x429cf888dae41d589d57f6dc685707bec755fe63 1.9937829e-11
# ...
example/storage.py
Publish a storage contract, then store a number 42 in the contract, and finally read this number.
$ python example/storage.py --action deploy --prikey 0x1
# hash = 0xc4a663c8a867d1d6fcbb8b57794eb732baa1bf6cb4c1b0c1cee278e00c8fd644
# addr = 0x930b793f778bbf43fab1080abf1840e018831cde
$ python example/storage.py --action set --addr 0x930b793f778bbf43fab1080abf1840e018831cde --prikey 0x1
# hash = 0x95c3fab08f6f4dcac14db157c2c2936417ae528acf9637fd50f772ac617072b5
$ python example/storage.py --action get --addr 0x930b793f778bbf43fab1080abf1840e018831cde
# data = 0x000000000000000000000000000000000000000000000000000000000000002a
example/transfer.py
Transfer ether to other.
$ python example/transfer.py --prikey 0x1 --to 0x2b5ad5c4795c026514f8317c7a215e218dccd6cf --value 0.05
# 0xfdeb27f32a21c793562daa8fa2780546e3304620a9925337c7df5e4e9819ef3a
Test
$ git clone https://github.com/ethereum/go-ethereum --branch release/1.17
$ cd go-ethereum
$ make geth
$ geth --dev --http
$ geth --exec "eth.sendTransaction({from: eth.accounts[0], to: '0x7e5f4552091a69125d5dfcb7b8c2659029395bdf', value: web3.toWei(10000, 'ether')})" attach /tmp/geth.ipc
$ pytest -v
License
MIT
Metadata
Release files for pleth 1.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pleth-1.2.3.tar.gz | 20.6 kB | Without provenance | Details for pleth-1.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pleth-1.2.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for pleth-1.2.3-py2.py3-none-any.whl |
Total release size: 37.5 kB
Release files / pleth-1.2.3.tar.gz
| Download URL | pleth-1.2.3.tar.gz |
|---|---|
| Size | 20.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12c8f5dbc3bf286ec4b9696ab00d519d33ea4dcdc6c77b302b02eca011c7166b
|
|
BLAKE2b-256 checksum How to use checksums |
087a708453194b7fa0fc6d8fcefcd4e099b2c854ee2c57f0a01dc6dff0e41baf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / pleth-1.2.3-py2.py3-none-any.whl
| Download URL | pleth-1.2.3-py2.py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c8c66e4bf2ff508665d973f8a8bf0d1d8a69fcf46570ffbd07a110e886da2021
|
|
BLAKE2b-256 checksum How to use checksums |
c951ea0192eaba3bdb416af42b376f2e5ff380c3cf3340e6d3e55211419205f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for pleth 1.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.