Home

Awesome

⛓🔍 Check the Chain (ctc) 🔎⛓

ctc is a tool for collecting and analyzing data from Ethereum and other EVM chains

It can be used as either 1) a python package or 2) a cli tool

ctc is in beta, please report bugs to the issue tracker

Features

For detailed information check out the documentation

Contents

  1. Example Usage
    1. ERC20: get all token transfers and balances of an ERC20
    2. Uniswap: get swaps, mints, and burns of a Uniswap pair
    3. Chainlink: get historical data for a Chainlink feed
    4. DAO: get DAO proposals and votes
  2. Installation
  3. FAQ
  4. Similar Projects
<table> <tbody> <tr> <td> <b>📜 Legal Disclaimer 📜</b> <code>ctc</code> is available under either the MIT license or the Apache license at your option. As stated in both licenses, <code>ctc</code> comes with no warranty of any kind. The authors of <code>ctc</code> accept no responsibility for any damages or negative outcomes that result from using <code>ctc</code> or <code>ctc</code>-derived data. <code>ctc</code> is not audited and using it as a basis for making financial decisions is not recommended. </td> </tr> </tbody> </table>

Example Usage

for more examples see examples in the docs

Get all token transfers of an ERC20

# python

from ctc import evm

# get token transfers
transfers = await evm.async_get_erc20_transfers(
    token='0x956f47f50a910163d8bf957cf5846d573e7f87ca',
    event_name='Transfer',
)

# get holdings of each address for a given block
holdings = await evm.async_get_erc20_balances_from_transfers(transfers=transfers, block=12345789)
# bash

ctc erc20 transfers 0x956f47f50a910163d8bf957cf5846d573e7f87ca \
    --export transfers.csv

ctc erc20 balances 0x956f47f50a910163d8bf957cf5846d573e7f87ca \
    --export balances.csv \
    --block 12345789

Get DAO proposals and votes

# python

from ctc import evm

dao_address = '0x0bef27feb58e857046d630b2c03dfb7bae567494'

proposals = await evm.async_get_events(
    contract_address=dao_address,
    event_name='ProposalCreated',
)

votes = await evm.async_get_events(
    contract_address=dao_address,
    event_name='VoteCast',
    include_timestamps=True,
)
# bash

DAO="0x0bef27feb58e857046d630b2c03dfb7bae567494"

ctc events $DAO ProposalCreated --export proposals.csv
ctc events $DAO VoteCast --export votes.csv

Get historical data for a Chainlink feed

# python

from ctc.protocols import chainlink_utils

feed = '0x31e0a88fecb6ec0a411dbe0e9e76391498296ee9'

data = await chainlink_utils.async_get_feed_data(feed)
# bash

ctc chainlink 0x31e0a88fecb6ec0a411dbe0e9e76391498296ee9 --export data.csv

Get swaps, mints, and burns of a Uniswap pool

# python

from ctc.protocols import uniswap_v2_utils

pool = '0x94b0a3d511b6ecdb17ebf877278ab030acb0a878'

swaps = await uniswap_v2_utils.async_get_pool_swaps(pool)
mints = await uniswap_v2_utils.async_get_pool_mints(pool)
burns = await uniswap_v2_utils.async_get_pool_burns(pool)
# bash

POOL="0x94b0a3d511b6ecdb17ebf877278ab030acb0a878"

ctc uniswap swaps $POOL --export swaps.csv
ctc uniswap mints $POOL --export mints.csv
ctc uniswap burns $POOL --export burns.csv

Installation

Two steps:

  1. pip install checkthechain
  2. run ctc setup in terminal to specify data provider and data storage path

If your shell's PATH does not include python scripts you may need to do something like python3 -m pip ... and python3 -m ctc ...

Detailed instructions can be found in the installation documentation.

ctc requires python >= 3.7 (supports 3.7, 3.8, 3.9, 3.10, and 3.11).

FAQ

Similar Projects