web3research.btc.BitcoinProvider

class web3research.btc.BitcoinProvider(api_token, backend: str | None = None, database: str = 'bitcoin', settings: Dict[str, Any] | None = None, generic_args: Dict[str, Any] | None = None, **kwargs)

Bases: web3research.db.provider.ClickhouseProvider

BitcoinProvider is a provider for fetching data on Bitcoin from the backend.

Parameters:
  • backend (Optional[str])

  • database (str)

  • settings (Optional[Dict[str, Any]])

  • generic_args (Optional[Dict[str, Any]])

database = 'bitcoin'
blocks(where: str | None = None, order_by: Dict[str, bool] | None = {'height': True}, limit: int | None = 100, offset: int | None = 0, parameters: Dict[str, Any] | None = None) Generator[Dict[str, Any], None, None]

Get blocks from the database.

Args:

where (str, optional): The WHERE clause. Defaults to None. order_by (Dict[str, bool], optional): The ORDER BY clause. Defaults to height ascending. limit (int, optional): The LIMIT clause. Defaults to 100. offset (int, optional): The OFFSET clause. Defaults to 0. parameters (Dict[str, Any], optional): The query parameters. Defaults to None.

Returns:

Generator[Dict[str, Any], None, None]: A generator of blocks.

Parameters:
  • where (Optional[str])

  • order_by (Optional[Dict[str, bool]])

  • limit (Optional[int])

  • offset (Optional[int])

  • parameters (Optional[Dict[str, Any]])

Return type:

Generator[Dict[str, Any], None, None]

inputs(where: str | None = None, order_by: Dict[str, bool] | None = {'blockHeight': True, 'txIndex': True, 'index': True}, limit: int | None = 100, offset: int | None = 0, parameters: Dict[str, Any] | None = None) Generator[Dict[str, Any], None, None]

Get transaction inputs from the database.

Args:

where (str, optional): The WHERE clause. Defaults to None. order_by (Dict[str, bool], optional): The ORDER BY clause. Defaults to blockHeight, txIndex and index ascending. limit (int, optional): The LIMIT clause. Defaults to 100. offset (int, optional): The OFFSET clause. Defaults to 0. parameters (Dict[str, Any], optional): The query parameters. Defaults to None.

Returns:

Generator[Dict[str, Any], None, None]: A generator of transaction inputs.

Parameters:
  • where (Optional[str])

  • order_by (Optional[Dict[str, bool]])

  • limit (Optional[int])

  • offset (Optional[int])

  • parameters (Optional[Dict[str, Any]])

Return type:

Generator[Dict[str, Any], None, None]

outputs(where: str | None = None, order_by: Dict[str, bool] | None = {'blockHeight': True, 'txIndex': True, 'index': True}, limit: int | None = 100, offset: int | None = 0, parameters: Dict[str, Any] | None = None) Generator[Dict[str, Any], None, None]

Get transaction outputs from the database.

Args:

where (str, optional): The WHERE clause. Defaults to None. order_by (Dict[str, bool], optional): The ORDER BY clause. Defaults to blockHeight, txIndex and index ascending. limit (int, optional): The LIMIT clause. Defaults to 100. offset (int, optional): The OFFSET clause. Defaults to 0. parameters (Dict[str, Any], optional): The query parameters. Defaults to None.

Returns:

Generator[Dict[str, Any], None, None]: A generator of transaction outputs.

Parameters:
  • where (Optional[str])

  • order_by (Optional[Dict[str, bool]])

  • limit (Optional[int])

  • offset (Optional[int])

  • parameters (Optional[Dict[str, Any]])

Return type:

Generator[Dict[str, Any], None, None]

transactions(where: str | None = None, order_by: Dict[str, bool] | None = {'blockHeight': True, 'txIndex': True}, limit: int | None = 100, offset: int | None = 0, parameters: Dict[str, Any] | None = None) Generator[Dict[str, Any], None, None]

Get unique transactions from the database by aggregating inputs.

This method provides a view of Bitcoin transactions by selecting unique transaction information from the inputs table, which contains transaction-level data.

Args:

where (str, optional): The WHERE clause. Defaults to None. order_by (Dict[str, bool], optional): The ORDER BY clause. Defaults to blockHeight and txIndex ascending. limit (int, optional): The LIMIT clause. Defaults to 100. offset (int, optional): The OFFSET clause. Defaults to 0. parameters (Dict[str, Any], optional): The query parameters. Defaults to None.

Returns:

Generator[Dict[str, Any], None, None]: A generator of transactions.

Parameters:
  • where (Optional[str])

  • order_by (Optional[Dict[str, bool]])

  • limit (Optional[int])

  • offset (Optional[int])

  • parameters (Optional[Dict[str, Any]])

Return type:

Generator[Dict[str, Any], None, None]