Skip to main content

Backfill wallet history across chains: a worked example with Feeds

Page a wallet's full transfer history on 9 EVM chains with one Goldsky Feeds endpoint. A worked run: 151,595 transfers in 152 requests and 3 minutes.

Backfill wallet history across chains: a worked example with Feeds cover image
Written by
image of Javier Trujillo
Javier Trujillo

Account Executive

We pulled the full transfer history of one wallet with a 30-line script and no infrastructure: 151,595 transfers on 8 chains, back to September 2015. It took 152 requests to one endpoint and a little over 3 minutes, and it cost about 5 cents. The endpoint is Transfers in Goldsky Feeds, which returns a wallet's native and token transfers on every chain we support, newest first, so a backfill is a loop that keeps asking for the next page.

Your script runs a backfill loop and a live read against the Transfers endpoint of Goldsky Feeds. The loop asks for 1,000 rows a page until the page token is null, and the live read asks again from the newest time you stored. Feeds data sync, in early access, pushes each new row as it lands. The rows go into one transfers table in your database, with a key from each row's position.

The loop: one endpoint and one page token

A backfill is the same request repeated with the next_page_token of the page before, until the token comes back null. page_size=1000 is the largest page. This is the function we ran:

python
import json
import os
import urllib.parse
import urllib.request

URL = "https://edge.goldsky.com/data/feeds/wallets/transfers"
KEY = os.environ["GOLDSKY_FEEDS_API_KEY"]


def backfill(address, out_path, max_pages=None, **filters):
    params = {"address": address, "page_size": 1000, **filters}
    pages = rows = 0
    with open(out_path, "w") as out:
        while True:
            req = urllib.request.Request(
                URL + "?" + urllib.parse.urlencode(params),
                headers={"X-API-Key": KEY},
            )
            with urllib.request.urlopen(req, timeout=60) as resp:
                page = json.load(resp)
            for row in page["data"]:
                out.write(json.dumps(row) + "\n")
            pages += 1
            rows += len(page["data"])
            token = page["pagination"]["next_page_token"]
            if not token or (max_pages and pages >= max_pages):
                return pages, rows, bool(token)
            params["page_token"] = token

We called it with the sample wallet from our Feeds quickstart (opens in a new tab), 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045, and include_position="true". The request names no chain, so it reads all of them. A page token only works with the filters it was issued for, so keep the same filters for the whole run.

What came back

One address returned its history on 8 chains in one pass, and the oldest row is an Ethereum transfer from September 28, 2015. The run on November 30, 2026 wrote 151,595 rows in 191 seconds, in order from newest to oldest.

ChainTransfersOldest transfer
Ethereum101,5342015-09-28
BNB Smart Chain21,8992021-10-21
Base15,7292023-08-08
Polygon8,1182021-05-13
Arbitrum One3,2342021-11-27
Optimism9912021-12-16
Robinhood Chain892026-07-08
Arc12026-09-02

Of those rows, 117,186 are native transfers and 34,409 are ERC-20 transfers of 865 tokens. All but 945 are inbound, because a well-known address collects a lot of dust and airdrops. Each row has the counterparty, the token's symbol and decimals, the raw amount, and the block and transaction it came from.

Bound the backfill

You rarely need everything, and every bound is a query parameter. The **filters argument of the function takes any of these:

ParameterWhat it bounds
from, toA time range, as RFC 3339 timestamps
chainsOne or more chains, such as ethereum,base
from_block, to_blockA block range. It needs exactly one chain in chains
transfer_typenative, erc20, or both
directionin or out
token_symbol, token_addressUp to 100 tokens

A time range works across chains in one request. A block range is for one chain, because block numbers mean different things on different chains. Our post on tracking ERC-20 transfers for a list of wallets has examples of the token and direction filters.

Store the rows so that a second run is safe

Ask for include_position=true and build your key from it, because a transfer has no ID. With it, each ERC-20 row has a log_index and each native row has a trace_address. In our run, the key of chain, transaction hash, transfer type, position, and direction was unique for all 151,595 rows. Without the position, 596 keys matched more than one row, 3,455 rows in total, so a key built from the hash, the addresses, the token, and the amount would have dropped real transfers.

Two more things to plan for:

  • A reorg removes a row with no notice. Read the most recent window again after the backfill, and replace what you stored for it.
  • price_usd can be null. We price a transfer when you request it, from the last price we recorded shortly before its block. In this run, 30,250 rows had a USD value, nearly all of them from 2025 and 2026. Store amount_raw and token_decimals for every row, and read the USD value again later if you need it for older ones, because it fills in as our price history grows.

Many wallets

Each wallet is its own loop, so a list of wallets is the same script with more workers. A wallet with fewer than 1,000 transfers is one request. Rate limits apply to a project: 5 requests a second on Starter, 50 on Scale, 100 to 500 with a raise, and 500 and above on Enterprise.

A request costs 35 compute units, which is $0.35 per 1,000 requests. The 152 requests of our run cost about $0.05. Our pricing page (opens in a new tab) has the fee for each raise.

From the backfill to live

The newest block_timestamp you stored is where the live read starts. Call the same endpoint with from set to that time, on whatever schedule your app needs, and upsert on the same key.

If you'd rather not poll, Feeds data sync (opens in a new tab) pushes each new row to ClickHouse, Postgres, MySQL, or a webhook as it lands. Data sync is in early access. Email [email protected] with the feed and the destination, and we turn it on for your project. Our post on the wallet balance and transfer history API covers the Balances endpoint, which gives you the current holdings next to this history.

FAQ

How far back does the history go?
For the sample wallet, the oldest row is from September 28, 2015 on Ethereum. On each of the other chains, the oldest row is from 2021 or later.

Which chains does one request cover?
An EVM address reads 9 chains in one request: Ethereum, Base, Arbitrum One, Optimism, Polygon, BNB Smart Chain, Robinhood Chain, Arc, and Elysium. A Solana address reads Solana.

Does the history include internal transfers?
Yes. A native row with a trace_address that isn't empty is a transfer made by an internal call, and 57,921 of the 117,186 native rows in our run were. Our post on deposit detection for wallet providers covers that case.

What does a backfill cost?
$0.35 per 1,000 requests, and one request returns up to 1,000 transfers. There's no minimum spend.

How do I start?
Create a Feeds API key on the API keys tab of the Feeds dashboard, set it as GOLDSKY_FEEDS_API_KEY, and run the function in this post with your own wallet.

© Endless Sky Inc. All rights reserved.

PrivacyTermsSecurity

System status