Skip to main content

Filter Spam Airdrops and Dust Attacks from Transfers API

Anyone can send a token to any address. A busy wallet's incoming transfers fill up with tokens nobody asked for, copies of real tokens with the same symbol, transfers of zero, and tiny amounts sent from look-alike addresses. This page shows the filters that remove them from a Transfers query, so the history you show or store holds only the transfers you care about.

The filters work the same way on every chain the Transfers cube serves. EVM chains (EVM(network: eth), bsc, base, arbitrum, optimism, matic and the other EVM networks) use the same fields; change only the network. Tron and Solana use slightly different field names, shown in their own sections.

What spam and dust look like in transfer data​

PatternWhat you see in TransfersFilter that removes it
Spam airdropA token you never bought, usually with AmountInUSD of 0 because it has no priceKeep known token contracts, or set a USD floor
Fake token copyCurrency.Symbol is USDT or USDC, but Currency.SmartContract is not the real contractFilter on SmartContract, never on Symbol
Zero-value transferAmount is 0, often made to look as if the wallet itself sent itAmount: {gt: "0"}
Dust attackA real token in an amount worth a fraction of a cent, sent from an address that looks like one the wallet paidAmountInUSD: {ge: "1"}

Spam tokens with a price exist too: a token with a thin liquidity pool can carry a USD value of a few dollars. A USD floor alone does not remove them, so for a clean history combine the floor with a list of token contracts you accept.

See what a wallet receives before filtering​

This query lists the last 7 days of incoming transfers to 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 on Ethereum with no spam filter. Most rows are tokens the wallet never asked for, with AmountInUSD of 0.

Run this query in the IDE

{
EVM(network: eth) {
Transfers(
orderBy: {descending: Block_Time}
limit: {count: 20}
where: {
Block: {Time: {since_relative: {days_ago: 7}}}
Transfer: {Receiver: {is: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"}}
TransactionStatus: {Success: true}
}
) {
Block { Time }
Transaction { Hash From }
Transfer {
Amount
AmountInUSD
Sender
Type
Currency { Name Symbol SmartContract Native }
}
}
}
}

List the spam tokens a wallet received​

To build your own blocklist, or to show a user which tokens were hidden, group the wallet's incoming transfers that have no USD value by token contract. Currency: {Native: false} leaves out the chain's gas token, and AmountInUSD: {eq: "0"} keeps only transfers with no price.

Run this query in the IDE

{
EVM(network: eth) {
Transfers(
orderBy: {descendingByField: "count"}
limit: {count: 20}
where: {
Block: {Time: {since_relative: {days_ago: 7}}}
Transfer: {Receiver: {is: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"}, AmountInUSD: {eq: "0"}, Currency: {Native: false}}
}
) {
Transfer {
Currency { Name Symbol SmartContract }
}
count
senders: uniq(of: Transfer_Sender)
}
}
}

To drop those tokens from another query, put their contracts in Currency: {SmartContract: {notIn: [...]}}. A blocklist never catches the next new spam token, so for a wallet history the allowlist below is the safer choice.

Drop dust and unpriced tokens with a USD floor​

AmountInUSD: {ge: "1"} removes every transfer worth less than one dollar. That covers dust, zero-value transfers and every token with no price, in one filter. Raise the floor for a stricter feed.

Run this query in the IDE

{
EVM(network: eth) {
Transfers(
orderBy: {descending: Block_Time}
limit: {count: 20}
where: {
Block: {Time: {since_relative: {days_ago: 7}}}
Transfer: {Receiver: {is: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"}, AmountInUSD: {ge: "1"}}
TransactionStatus: {Success: true}
}
) {
Block { Time }
Transaction { Hash }
Transfer {
Amount
AmountInUSD
Sender
Currency { Symbol SmartContract }
}
}
}
}

Check the result: a priced spam token can still pass the floor. The next query closes that gap.

Keep only tokens you accept (allowlist)​

This is the filter for a clean wallet history. The query keeps transfers of four contracts only and drops everything else:

  • SmartContract: {in: [...]} lists the accepted tokens: 0x is native ETH, then USDT, USDC and WETH on Ethereum. Use the contract addresses of the tokens your app supports; on other EVM networks the gas token is also 0x.
  • Amount: {gt: "0"} drops zero-value transfers of the real tokens.
  • AmountInUSD: {ge: "1"} drops dust of the real tokens.

Run this query in the IDE

{
EVM(network: eth) {
Transfers(
orderBy: {descending: Block_Time}
limit: {count: 20}
where: {
Block: {Time: {since_relative: {days_ago: 7}}}
Transfer: {
Receiver: {is: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"}
Amount: {gt: "0"}
AmountInUSD: {ge: "1"}
Currency: {SmartContract: {in: ["0x", "0xdac17f958d2ee523a2206206994597c13d831ec7", "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"]}}
}
TransactionStatus: {Success: true}
}
) {
Block { Time }
Transaction { Hash }
Transfer {
Amount
AmountInUSD
Sender
Currency { Symbol SmartContract }
}
}
}
}

For outgoing transfers, use the same filters with Sender: {is: "..."} in place of Receiver. For both directions, write two aliased lists in one query, sent: Transfers(...) with Sender: {is: "..."} and received: Transfers(...) with Receiver: {is: "..."}, each with the same spam filters, then merge them and sort by Block.Time in your code.

Find fake copies of a token​

Fake tokens copy the name and symbol of a real one. This query lists every token on Ethereum that calls itself USDT but is not the real USDT contract (0xdac17f958d2ee523a2206206994597c13d831ec7), over the last day, with how many transfers and receiving wallets each one had. The usd column is the USD value Bitquery gave those transfers; for a fake it is 0 or close to it.

Run this query in the IDE

{
EVM(network: eth) {
Transfers(
orderBy: {descendingByField: "count"}
limit: {count: 10}
where: {
Block: {Time: {since_relative: {days_ago: 1}}}
Transfer: {Currency: {Symbol: {is: "USDT"}, SmartContract: {not: "0xdac17f958d2ee523a2206206994597c13d831ec7"}}}
}
) {
Transfer {
Currency { Name Symbol SmartContract }
}
count
receivers: uniq(of: Transfer_Receiver)
usd: sum(of: Transfer_AmountInUSD)
}
}
}

The lesson for every query: filter tokens by Currency.SmartContract (on Solana Currency.MintAddress), never by Symbol or Name.

Zero-value transfers of a real token​

A zero-value transfer of a real token makes a transfer row appear between a wallet and an address the attacker controls, so the attacker's look-alike address shows up in the wallet's history. This query lists the latest USDT transfers of zero on Ethereum in the last hour. Compare Transaction.From, the address that signed the transaction, with Transfer.Sender: in these rows they usually differ.

Run this query in the IDE

{
EVM(network: eth) {
Transfers(
orderBy: {descending: Block_Time}
limit: {count: 10}
where: {
Block: {Time: {since_relative: {hours_ago: 1}}}
Transfer: {Currency: {SmartContract: {is: "0xdac17f958d2ee523a2206206994597c13d831ec7"}}, Amount: {eq: "0"}}
}
) {
Block { Time }
Transaction { Hash From }
Transfer { Amount Sender Receiver }
}
}
}

Amount: {gt: "0"} in any transfers query removes them.

Stream transfers without spam or dust​

The same where filters work in a subscription. This stream sends every USDT transfer on Ethereum worth one dollar or more, so zero-value transfers and dust never reach your code. Add Receiver or Sender to stream one wallet.

Run this query in the IDE

subscription {
EVM(network: eth) {
Transfers(
where: {
Transfer: {
Currency: {SmartContract: {is: "0xdac17f958d2ee523a2206206994597c13d831ec7"}}
Amount: {gt: "0"}
AmountInUSD: {ge: "1"}
}
TransactionStatus: {Success: true}
}
) {
Block { Time }
Transaction { Hash }
Transfer { Amount AmountInUSD Sender Receiver }
}
}
}

Tron: fake USDT and dust senders​

Tron.Transfers uses the same field names as EVM: Transfer.Sender and Transfer.Receiver are plain addresses, Currency.SmartContract holds the token contract (real USDT is TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t), and TransactionStatus.Success marks successful transactions. Fake USDT tokens on Tron often have a contract that starts with the same characters as the real one, so compare the full contract.

Tokens that call themselves USDT but are not the real contract, in the last 6 hours:

Run this query in the IDE

{
Tron {
Transfers(
orderBy: {descendingByField: "count"}
limit: {count: 10}
where: {
Block: {Time: {since_relative: {hours_ago: 6}}}
Transfer: {Currency: {Symbol: {is: "USDT"}, SmartContract: {not: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"}}}
}
) {
Transfer {
Currency { Name Symbol SmartContract }
}
count
receivers: uniq(of: Transfer_Receiver)
}
}
}

Addresses that sent real USDT worth less than a cent to the most different wallets in the last hour. A sender that spreads tiny amounts to many wallets it has no other business with is the typical source of dust:

Run this query in the IDE

{
Tron {
Transfers(
orderBy: {descendingByField: "receivers"}
limit: {count: 10}
where: {
Block: {Time: {since_relative: {hours_ago: 1}}}
Transfer: {Currency: {SmartContract: {is: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"}}, AmountInUSD: {lt: "0.01"}}
TransactionStatus: {Success: true}
}
) {
Transfer { Sender }
receivers: uniq(of: Transfer_Receiver)
count
}
}
}

A clean incoming history for one Tron wallet: real USDT and USDC (TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8) only, one dollar or more, successful transactions, last 7 days.

Run this query in the IDE

{
Tron {
Transfers(
orderBy: {descending: Block_Time}
limit: {count: 10}
where: {
Block: {Time: {since_relative: {days_ago: 7}}}
Transfer: {
Receiver: {is: "TVfkpvewpDohw5Ju6Dm68Cbj2TgByhVsEL"}
Currency: {SmartContract: {in: ["TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", "TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8"]}}
AmountInUSD: {ge: "1"}
}
TransactionStatus: {Success: true}
}
) {
Block { Time }
Transaction { Hash }
Transfer {
Amount
AmountInUSD
Sender
Currency { Symbol SmartContract }
}
}
}
}

Solana: filter on Owner and MintAddress​

Solana differs from EVM and Tron in three places:

  • SPL tokens move between token accounts, so Transfer.Sender.Address and Transfer.Receiver.Address are token accounts. Filter the wallet on Receiver: {Owner: {is: ...}}.
  • The token is Currency.MintAddress. Native SOL is 11111111111111111111111111111111.
  • Success is Transaction: {Result: {Success: true}}.

This query keeps SOL, USDC and USDT transfers of one dollar or more to one wallet over the last 6 hours:

Run this query in the IDE

{
Solana {
Transfers(
orderBy: {descending: Block_Time}
limit: {count: 10}
where: {
Block: {Time: {since_relative: {hours_ago: 6}}}
Transfer: {
Receiver: {Owner: {is: "KfHbT5Jrr5SV3CDkQVCLiSNWyVv5DmuVaCzbAHrzMFQ"}}
Currency: {MintAddress: {in: ["11111111111111111111111111111111", "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"]}}
AmountInUSD: {ge: "1"}
}
Transaction: {Result: {Success: true}}
}
) {
Block { Time }
Transaction { Signature }
Transfer {
Amount
AmountInUSD
Sender { Owner }
Currency { Symbol MintAddress }
}
}
}
}

To check a Solana wallet for look-alike dust senders, follow Check a wallet for address poisoning on the Solana Transfers API page. The same method works on EVM and Tron with Transfer.Sender in place of Sender.Owner.

Which filter to use​

GoalFilters
Wallet history for an app or a tax reportAllowlist of token contracts, Amount: {gt: "0"}, AmountInUSD: {ge: "1"}
Every token a wallet received, minus junkAmountInUSD: {ge: "1"}, plus a notIn blocklist for priced spam you have seen
Alerts on large incoming paymentsAllowlist plus a high USD floor, in a subscription
Investigate a poisoning attemptRemove the filters and look at AmountInUSD below one cent and Amount of 0

Next steps​

FAQ​

Frequently Asked Questions

Does Bitquery mark a token as spam?

No. The Transfers cube does not hide or flag any token. You decide what to hide with the filters on this page: a list of token contracts you accept, a USD floor, and an amount greater than zero.

Why do some spam tokens have a USD value?

A spam token that has a liquidity pool and trades gets a USD price like any other token, so its transfers can pass a USD floor. Filter by an allowlist of contracts to remove them.

Can I filter spam in a wallet's balances too?

Yes. The Balances cube takes the same token contract filter on Currency.SmartContract, so a portfolio query can list only the tokens you accept. Balances cannot filter on AmountInUSD; order by Balance_AmountInUSD instead. See the Wallet Portfolio API page.

Do these filters work on BSC, Base and other EVM chains?

Yes. Change network in EVM(network: eth) to bsc, base, arbitrum, optimism, matic or another EVM network, and use that chain's token contracts in the allowlist. The native gas token is 0x on every EVM network.

Build with Bitquery

Ready to run this in production?

Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.