Skip to content

Query Transfer History

Lars Kuhtz edited this page Mar 23, 2021 · 1 revision

This gist contains a bash script for efficiently querying Pact TRANSFER events.

It can be used as follows from a bash command line:

  1. Make sure that git, curl, and jq are installed

  2. Clone and install the script:

    git clone https://gist.github.com/068e28540ba8309362f6bde141d71c65.git transfer-history`
    cd transfer-history
  3. List TRANSFER events:

    CHAIN=1 bash ./transfers.sh
    

    This will query all TRANSFER events for that last 100 blocks on chain 1.

    It is possible to select a different block height range by setting MINHEIGHT and MAXHEIGHT environment variables:

    CHAIN=1 MINHEIGHT=1467781 MAXHEIGHT=1469781 bash ./transfers.sh

    the default MAXHEIGHT value is the height of the latest block. The default MINHEIGHT value is the MAXHEIGHT-100.

The script can be easily adapted to query different kinds of events, change the output format, include additional information from transaction outputs, or connect to a chainweb node other than api.chainweb.com.