CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-web3

A Python library for interacting with Ethereum blockchain

Overall
score

88%

Evaluation88%

1.01x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-2/

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.

Install with Tessl CLI

npx tessl i tessl/pypi-web3

tile.json