Skip to main content

A Python interface for the Xatu API with execution layer state tracking

Project description

PyXatu

Pyxatu is a Python package for querying data from the Xatu database and was developed to make access to Ethereum data as easy as possible without sacrificing on a rich set of features.


Pyxatu comes out of the box with:

  • High level access to Xatu (Ethereum EL + CL)

  • Mevboost Data API Interface

  • Validator label mapping

    Install

     pip install pyxatu
     xatu setup
    

xatu setup copies the default configuration file to your HOME directory as .pyxatu_config.json. Update this file with your actual Xatu credentials. Alternatively, you can use environment variables. If you don't have credentials yet, please get in contact with someone from EthPandaOps.

Example Usage

As a first step, we always want to initialize PyXatu.

import pyxatu

xatu = pyxatu.PyXatu()

We use xatu to execute our first query: We want to get the block number and the gas used of a block in a certain slot:

df = xatu.get_slots(
   slot = [9000000, 9000010],
   columns="slot, execution_payload_block_number, execution_payload_gas_used",
   orderby="slot"
)

print(df)
slot execution_payload_block_number execution_payload_gas_used
9000000 19796604 18026681
9000001 19796605 13920219
9000002 19796606 12498513
9000003 19796607 2914192
9000004 19796608 29996743
... ... ...

Second, let's say we want to know which validator attested correctly in a certain epoch:

df = xatu.get_elaborated_attestations(slot = 9000000)

print(df.head().to_markdown(index=False))
slot validator status vote_type
9000000 7 correct source
9000000 1179655 correct source
9000000 524305 correct source
9000000 17 correct source
9000000 1179681 correct source
... ... ... ...

Next, we want to get all bids accross all mevboost relays for a specific slot:

df = xatu.mevboost.get_bids(slot = 9096969)

print(df.groupby("relay")["value"].median().reset_index().to_markdown(index=False))
relay value
aestus 3.92872e+16
bloxroute (max profit) 3.89533e+16
bloxroute (regulated) 3.89042e+16
eden 3.07634e+16
flashbots 3.89779e+16

and the delivered mevboost payloads:

df = xatu.mevboost.get_payloads(slot = 9814162)

print(df.groupby("relay")["value"].median().reset_index().to_markdown(index=False))
relay value
bloxroute (max profit) 1.39261e+16
ultra sound 1.39261e+16

What if we need a mappling from validator ids to labels:

xatu.validators.mapping[["validator_id", "deposit_address", "label", "lido_node_operator"]]
validator_id deposit_address label lido_node_operator
1545106 0xfddf38947afb03c621c71b06c9c70bce73f12999 lido Develp GmbH
1545105 0xfddf38947afb03c621c71b06c9c70bce73f12999 lido Develp GmbH
1546068 0xd523794c879d9ec028960a231f866758e405be34 everstake
1546067 0xe3cbd06d7dadb3f4e6557bab7edd924cd1489e8f mantle
1546066 0xd4039ecc40aeda0582036437cf3ec02845da4c13 kraken
1546065 0xd4039ecc40aeda0582036437cf3ec02845da4c13 kraken
1545103 0xfddf38947afb03c621c71b06c9c70bce73f12999 lido Launchnodes
1545102 0xfddf38947afb03c621c71b06c9c70bce73f12999 lido Launchnodes

Contribution Guidelines

Please follow these steps to contribute:

  1. Fork the Repository: Start by forking the repository to your GitHub account.
  2. Create a New Branch: Create a new branch for your feature or bugfix.
    git checkout -b feature/new-feature
    
  3. Write Tests: Ensure your code is well-tested and follows the project's coding standards.
  4. Submit a Pull Request: Once you're ready, submit a pull request for review.

New contributions that help improve PyXatu are more than welcome!


For any additional questions or support, feel free to open an issue on the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyxatu-1.10.1.tar.gz (47.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyxatu-1.10.1-py3-none-any.whl (36.5 kB view details)

Uploaded Python 3

File details

Details for the file pyxatu-1.10.1.tar.gz.

File metadata

  • Download URL: pyxatu-1.10.1.tar.gz
  • Upload date:
  • Size: 47.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for pyxatu-1.10.1.tar.gz
Algorithm Hash digest
SHA256 3e0cdbd575e36a912ae88644b3c636c0badd8bc460e6298f183bbba5b62cf181
MD5 fc2cd2fe8b6745913bb220ddd3b886de
BLAKE2b-256 5d57773d25e1a3d8a1f8635d2d67a30d0376f1b95f7a47fabc9632e3a2f5789b

See more details on using hashes here.

File details

Details for the file pyxatu-1.10.1-py3-none-any.whl.

File metadata

  • Download URL: pyxatu-1.10.1-py3-none-any.whl
  • Upload date:
  • Size: 36.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for pyxatu-1.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8d2c654a72e7fc36b2df6a57c576a45c539a3c3503eae2333fe3bbd11ca90c3
MD5 dc67906c82aa3bfcc36de47b1628bc7f
BLAKE2b-256 59f2ea744f9638f6e5dbc70124ce1ac5a0f88ca2c3361864cf7bafa761e907e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page