Skip to content

EmperorMew/python-snowtrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-snowtrace

Codacy Badge Maintainability GitHub Python 3.10

Maintained by Snowcones.io

A minimal, yet complete, Python API for Snowtrace.io.

All standard endpoints are provided.

Available on PyPI. Powered by Snowtrace.io APIs.


Endpoints

The following endpoints are provided:

Contracts (source)

  • get_contract_abi
  • get_contract_source_code
Accounts (source)

  • get_normal_txs_by_address
  • get_normal_txs_by_address_paginated
  • get_internal_txs_by_address
  • get_internal_txs_by_address_paginated
  • get_internal_txs_by_txhash
  • get_internal_txs_by_block_range_paginated
  • get_erc20_token_transfer_events_by_address
  • get_erc20_token_transfer_events_by_contract_address_paginated
  • get_erc20_token_transfer_events_by_address_and_contract_paginated
  • get_erc721_token_transfer_events_by_address
  • get_erc721_token_transfer_events_by_contract_address_paginated
  • get_erc721_token_transfer_events_by_address_and_contract_paginated
  • get_mined_blocks_by_address
  • get_mined_blocks_by_address_paginated
  • get_eth_balance
  • get_eth_balance_multiple
Transactions (source)

  • get_tx_receipt_status
Blocks (source)

  • get_block_reward_by_block_number
  • get_est_block_countdown_time_by_block_number
  • get_block_number_by_timestamp
GETH/Parity Proxy (source)

  • get_proxy_block_number
  • get_proxy_block_by_number
  • get_proxy_uncle_by_block_number_and_index
  • get_proxy_block_transaction_count_by_number
  • get_proxy_transaction_by_hash
  • get_proxy_transaction_by_block_number_and_index
  • get_proxy_transaction_count
  • get_proxy_transaction_receipt
  • get_proxy_call
  • get_proxy_code_at
  • get_proxy_storage_position_at
  • get_proxy_gas_price
  • get_proxy_est_gas
Tokens (source)

  • get_total_supply_by_contract_address
  • get_acc_balance_by_token_and_contract_address
Stats (source)

  • get_total_eth_supply

If you think that a newly-added method is missing, kindly open an issue as a feature request and I will do my best to add it.

Installation

Before proceeding, you should register an account on Snowtrace.io and generate a personal API key to use.

Install from source:

pip install git+https://github.com/EmperorMew/python-snowtrace.git

Alternatively, install from PyPI:

pip install python-snowtrace

Usage

In python, create a client with your personal Snowtrace.io API key:

from etherscan import Snowtrace
avax = Snowtrace(YOUR_API_KEY) # key in quotation marks

Then you can call all available methods, e.g.:

print(avax.get_contract_source_code(address="0x37B608519F91f70F2EeB0e5Ed9AF4061722e4F76"))

> ''

Examples

Examples (arguments and results) for all methods may be found as JSON files here. For example, if you want to use the method get_eth_balance, you can find the supported arguments and the format of its output in its respective JSON file:

{
  "method": "get_eth_balance",
  "module": "accounts",
  "kwargs": {
    "address": "0x9f8c163cBA728e99993ABe7495F06c0A3c8Ac8b9"
  },
  "log_timestamp": "2022-08-08-12:34:29",
  "res": "40891631566070000000000"
}

where kwargs refer to the required named arguments and res refers to the expected result if you were to run:

print(avax.get_eth_balance(address="0x9f8c163cBA728e99993ABe7495F06c0A3c8Ac8b9"))

> '938731131805911191538419' # This will return AVAX balance of the address.

Disclaimer: Those examples blindly use the arguments originally showcased here and the selected wallets/contracts do not reflect any personal preference. You should refer to the same source for additional information regarding specific argument values.

Issues

For problems regarding installing or using the package please open an issue. Kindly avoid disclosing potentially sensitive information such as your API keys or your wallet addresses.

Cite

Snowcones.io, EmperorMew/python-snowtrace (2022).

Feel free to leave a ⭐ if you found this package useful.


Powered by Snowtrace.io APIs.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 5

Languages