Install Substreams CLI

    Install the Substreams CLI via Homebrew, binary or from source.

    Homebrew
    brew install streamingfast/tap/substreams
    Binary · Modify for your OS
    LINK=$(curl -s https://api.github.com/repos/streamingfast/substreams/releases/latest | awk '/download.url.*linux/ {print $2}' | sed 's/"//g')
    curl -L $LINK | tar zxf -
    Source
    git clone https://github.com/streamingfast/substreams
    cd substreams
    go install -v ./cmd/substreams

    Retrieve API Token

    Get your Pinax or StreamingFast API key to use with the CLI.

    Add to .bashrc or .zshrc
    export STREAMINGFAST_API_KEY=YOUR_STREAMINGFAST_API_KEY
    function sftoken {
    export SUBSTREAMS_API_TOKEN=$(curl https://auth.streamingfast.io/v1/auth/issue -s --data-binary '{"api_key":"'$STREAMINGFAST_API_KEY'"}' | jq -r .token)
    echo "Token set on SUBSTREAMS_API_TOKEN"
    }
    Generate New API Token
    sftoken

    Run Substreams CLI

    Run Substream CLI commands against a Pinax or StreamingFast Firehose endpoint.

    Stream Command
    substreams run \
    http://spygpc.com/api/spkg/clntnpi1g00dro9c4a68a3x1j \
    map_transfers \
    -e mainnet.eth.streamingfast.io:443 \
    --start-block -7141
    GUI Command
    substreams gui \
    http://spygpc.com/api/spkg/clntnpi1g00dro9c4a68a3x1j \
    map_transfers \
    -e mainnet.eth.streamingfast.io:443 \
    --start-block -7141
    Info Command
    substreams info http://spygpc.com/api/spkg/clntnpi1g00dro9c4a68a3x1j
    Mermaid Graph Command
    substreams graph http://spygpc.com/api/spkg/clntnpi1g00dro9c4a68a3x1j