or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/web3@7.13.x
tile.json

tessl/pypi-web3

tessl install tessl/pypi-web3@7.13.0

A Python library for interacting with Ethereum blockchain

Agent Success

Agent success rate when using this tile

88%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.01x

Baseline

Agent success rate without this tile

87%

task.mdevals/scenario-10/

Gas Price Monitoring Service

Create a Python service that monitors and reports current Ethereum gas prices in multiple units.

Requirements

Your service should provide functionality to:

  1. Connect to an Ethereum node and retrieve the current gas price
  2. Convert the gas price from Wei to both Gwei and Ether
  3. For EIP-1559 compatible networks, retrieve the recommended priority fee for the next block
  4. Return all pricing information in a structured format

Implementation Details

Create a Python module that exports a function get_gas_report() which:

  • Returns a dictionary containing:
    • gas_price_wei: The current gas price in Wei (as an integer)
    • gas_price_gwei: The current gas price in Gwei (as a float)
    • gas_price_ether: The current gas price in Ether (as a float)
    • priority_fee_gwei: The recommended priority fee in Gwei (as a float, or None if not available)

The function should handle connection to an Ethereum node provider (you may use any provider configuration that works for testing).

Test Cases

  • Calling get_gas_report() returns a dictionary with all required keys @test
  • The gas_price_wei value is a positive integer @test
  • The gas_price_gwei and gas_price_ether conversions are mathematically correct relative to gas_price_wei @test
  • The function successfully retrieves priority fee information when available @test

@generates

API

def get_gas_report() -> dict:
    """
    Retrieve current gas pricing information from the Ethereum network.

    Returns:
        dict: A dictionary containing:
            - gas_price_wei (int): Current gas price in Wei
            - gas_price_gwei (float): Current gas price in Gwei
            - gas_price_ether (float): Current gas price in Ether
            - priority_fee_gwei (float or None): Recommended priority fee in Gwei
    """
    pass

Dependencies { .dependencies }

web3 { .dependency }

Provides Ethereum blockchain interaction capabilities.