blockscan-python
This package was created in the hope to provide a multi-chain API wrapper for the blockscan.com endpoints and reduce the overhead of using multiple single chain wrapper.
Note
The following blockchains from blockscout.com are also provided BUT it’s because blockscout offers the API for developers transitioning their applications from Etherscan to BlockScout. If they deprecate those API in the future so will this package.
Gnosis (100)
Ethereum Classic (61)
Ethereum Classic Mordor (63)
Ethereum Classic Kotti (6)
POA Core (99)
POA Sokol (77)
Artis Sigma1 (246529)
RSK (30)
Hoo Smart Chain (70) (This one is technicaly part of blockscan.com but is built on top of blockscout)
Installation
Blockscan-python can be installed using pip as follows:
$ pip install blockscan-python
Usage
Refer to the full documentation for the list of endpoints and the specific blockscan provider for compatibility. This package doesn’t filter the endpoints on a per-chain basis. This means that some calls will fails if the provider doesn’t support it.
Prerequisite
- The chain ID you want to connect to.
Refer to chainlist if unknown
- Specific chain API Token provided by blockscan
(i.e: An etherscan.io token for Ethereum)
Exception: Any Blockscout chain takes an empty string “”, No token required
Create a connection client
The connection can be created as Sync:
>>> from blockscan import Blockscan
# Sync connection to etherscan.io
>>> client = blockscan(1, "MYAPITOKEN", is_async=False)
>>> client.accounts.get_currency_balance(
"0x0000000000000000000000000000000000000000"
)
'11400022397988649428803'
But will default to Async if no parameter is provided:
>>> from blockscan import BlockScan
#Async connection to bscscan.com
>>> client = Blockscan(56, "MYAPITOKEN")
>>> bal = await client.accounts.get_currency_balance(
"0x0000000000000000000000000000000000000000"
)
>>> print(bal)
'1073557893975925234717'
The full list of parameters is available in the documentation
Donate
I made this has a fun side project and it’s free for anyone to use. If you like it and wish to donate here’s a few of my crypto wallets.
Ethereum and L2s (0x29006…) |
Monero (85tBS7YSrM5…) |
Peercoin (PBzj1ZwMDW…) |
|---|---|---|
Free software: MIT license
Documentation: https://blockscan-python.readthedocs.io.
Credits
Credits to @pcko1 for making the bscscan-python that was used as the base for this package
TO-DOs
Add a reference table of the available Chain ID to the docs
History
0.0.1 (2022-07-02)
First release on PyPI.
1.1.0 (2022-07-03)
CI tests and deployment added
Packaging build tested and beta ready
1.1.1 (2022-07-26)
Preloaded modules for easier IDE usage
Metadata
Release files for blockscan-python 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| blockscan-python-1.1.1.tar.gz | 117.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| blockscan_python-1.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 143.7 kB
Release files / blockscan-python-1.1.1.tar.gz
| Download URL | blockscan-python-1.1.1.tar.gz |
|---|---|
| Size | 117.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2669852f5366f85e85e6cd72e8181f16f7f60690e8af34e1a94111aba98ba286
|
|
BLAKE2b-256 checksum How to use checksums |
d2bf51ef94e301a3044c05e92765f59c92302743268a94ad4764f2b7dc2ece6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / blockscan_python-1.1.1-py2.py3-none-any.whl
| Download URL | blockscan_python-1.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 26.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
fa724cf9112630f462ad880330c03efd38ebd7efea94864abad5b1e6490297ca
|
|
BLAKE2b-256 checksum How to use checksums |
7a15f8ec91b3c80298731607f6cc3f34ea4594d57796cfc010d873edc3c7a68e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|