venko.tech

How to Import a MetaMask Transaction History Without Gaps

Importing a MetaMask transaction history without gaps requires combining the wallet's native CSV export with an Etherscan API pull or a third-party aggregator, because MetaMask's own export omits certain transaction types and older records.

Why gaps occur in metamask exports

MetaMask's built-in CSV export (available via the wallet's "Account Details" menu) only covers transactions visible in the active wallet interface at the time of export. It excludes:

These gaps can cause your portfolio tracker to undercount holdings, miscalculate cost basis, or report a lower balance than the blockchain actually shows.

Step 1: Export the Standard MetaMask CSV

Open MetaMask, select the account you want to export, click the three-dot menu, choose "Account Details," then "Export Transactions." Save the CSV file. This gives you a starting set of data, but treat it as incomplete.

Step 2: Cross-Check Against the Blockchain Explorer

The only complete record of any Ethereum-based address is the blockchain itself. For a MetaMask wallet, the canonical source is Etherscan (or the equivalent block explorer for the network you use, such as BscScan or PolygonScan).

Paste your wallet address into Etherscan. Under the "Transactions" tab, you will see every on-chain transaction the address has ever signed. The "Internal Txns" tab shows contract-internal transfers. The "Token Transfers" tab shows ERC-20 movements.

Compare the total number of rows in your MetaMask export against the count on Etherscan for the same date range. If they match, you likely have no gaps. If Etherscan shows more, you need to fill them.

Step 3: Use the Etherscan API to Pull Full History

Manually copying from a block explorer is error-prone for more than a handful of transactions. Use the Etherscan API instead:

  1. Get an API key - Register at etherscan.io and generate a free API key (rate-limited but sufficient for personal use).
  2. Choose the right endpoint - Use txlist for normal transactions, txlistinternal for internal transactions, and tokentx for ERC-20 transfers.
  3. Set the date range - Specify startblock and endblock parameters. To get everything, set startblock=0 and endblock=99999999.
  4. Handle pagination - The API returns a maximum of 10,000 records per call. If your address has more, loop through page parameters.
  5. Export to CSV - Most portfolio tracking tools accept a CSV format. Write a simple script (Python or JavaScript) to convert the API JSON response into a CSV with columns matching your tracker’s import template.

If you do not want to code, tools like Zapper, Zerion, or Rotki can pull the same data via their own API integrations and export a consolidated history.

Step 4: Merge the Exports and Deduplicate

You now have two datasets: the MetaMask CSV (incomplete) and the Etherscan export (complete but may include transactions you already have). Import both into your portfolio tracker, then use its deduplication feature to remove identical rows. Most trackers match on transaction hash and timestamp. If yours does not, sort by hash and delete duplicates manually in a spreadsheet before importing.

Common deduplication pitfalls:

Step 5: Validate the Final Import

After merging, check that the total transaction count matches Etherscan’s count for the address. Then verify a few specific transactions that you know occurred but might have been missing from MetaMask - such as an airdrop claim, a failed swap, or an internal transfer from a DeFi protocol. If those appear correctly, your history is gap-free.

When Gaps Persist

If your balance still does not match after following these steps, the gap may not be in the transaction history itself. Check for:

In those cases, the fix is not re-importing MetaMask data but adding the correct on-chain positions to your tracker, often by connecting the relevant chain’s API or manually entering the position.

Practical Limits

For a wallet with thousands of transactions, the Etherscan API’s free tier (5 calls per second, 100,000 calls per day) is usually sufficient for a one-time historical pull. If you need continuous gap-free tracking, set up a scheduled script to pull new transactions daily and append them to your tracker, bypassing MetaMask’s export entirely.

Not financial advice. venko.tech publishes market data and general information about digital assets. Crypto assets are volatile and you can lose everything you put in. Nothing here is a recommendation to buy, sell or hold, and we make no price predictions.

Prices are sourced from third parties and may be delayed or wrong. Verify anything you intend to act on against a primary source.

Back to portfolio