1msc.xyz

What Is a Blacklist Function in a Token Contract, and How Do You Spot It?

A blacklist function in a token contract allows the contract owner or an authorized address to prevent specific wallet addresses from sending or receiving the token. You spot it by reading the contract’s source code on a block explorer for functions like blacklist, addBlacklist, isBlacklisted, or similar names, or by checking for events like BlacklistUpdated. This feature is a central point of control that can be used to freeze your tokens if the owner decides to add your address.

Why a Blacklist Function Matters for Safety

Blacklists are not inherently malicious. Some legitimate projects use them to comply with sanctions lists, block known scam addresses, or prevent money-laundering activity. However, in an unknown token, a blacklist function is a red flag because it gives the deployer unilateral power to block holders. If the owner can blacklist you after you buy, you cannot sell or transfer the token. That is a honeypot mechanism - you hold an asset you cannot exit.

A blacklist function is distinct from a pause function (which stops all trading) or a tax function (which takes a fee on transfers). A blacklist targets specific addresses, not the whole market. It is more surgical but equally dangerous to the targeted holder.

How to Spot a Blacklist Function in the Contract

You need to read the contract’s source code on a block explorer such as Etherscan, BscScan, or Polygonscan. The token must be verified (its source code published) for you to do this. If the contract is unverified, you cannot inspect it directly; treat that as a strong warning sign.

Follow these steps:

  1. Open the token’s contract page on the block explorer. If you have not verified the contract address, do that first using the site’s guide on verifying addresses. The contract page shows a “Contract” tab.

  2. Click the “Contract” tab, then “Code” or “Source Code.” You will see the full Solidity or Vyper source. If the code is flattened (common for proxy contracts), look across the entire file.

  3. Search for blacklist-related keywords. Use your browser’s find function (Ctrl+F or Cmd+F) and search for these strings:

  4. blacklist (case-insensitive)
  5. addBlacklist
  6. removeBlacklist
  7. isBlacklisted
  8. _blacklist
  9. setBlacklist
  10. blacklistAddress

Also search for mapping (address => bool) public blacklist or similar state variable declarations.

  1. Look for the functions that use the blacklist mapping. A typical pattern is: ```solidity mapping(address => bool) public blacklist;

function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { require(!blacklist[from] && !blacklist[to], "Blacklisted address"); super._beforeTokenTransfer(from, to, amount); } `` The_beforeTokenTransfer` hook is common in OpenZeppelin-based contracts. If a blacklist check appears there, the token will revert any transfer involving a blacklisted address.

  1. Check who can call the blacklist functions. Look for modifiers like onlyOwner, onlyRole(DEFAULT_ADMIN_ROLE), or onlyAdmin. If the owner or a single admin role can add addresses, that is a central point of failure. If the function is public and anyone can call it, that is a bug or a scam. Legitimate projects sometimes use a multi-signature wallet or a timelock for blacklist changes, but even then, the risk remains.

  2. Search for events related to blacklisting. An event like event BlacklistUpdated(address indexed account, bool isBlacklisted) shows the contract emits a log when the list changes. You can see past blacklist events on the explorer’s “Events” tab. If multiple addresses have been blacklisted historically, that is a sign the function is actively used.

What to Do If You Find a Blacklist Function

How blacklist functions differ from similar controls

Final Advice

A blacklist function in an unknown token is a strong reason to avoid it. Legitimate projects rarely need to freeze individual holders. If you see one, assume it can be used against you. The safest tokens have no such function, or the function is renounced (transferred to a null address or removed from the code). Always check the contract yourself; do not rely on third-party claims that a token is “safe.”

Not financial advice. 1msc.xyz 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 token safety