ERC-777 Explained: The modern token standard with hooks

LeeMaimaiLeeMaimai
/Oct 16, 2025
ERC-777 Explained: The modern token standard with hooks

Key Takeaways

• ERC-777 provides built-in hooks for contracts to react to token transfers within the same transaction.

• Operator-based transfers simplify token management for custodians and services.

• Security considerations are crucial due to potential reentrancy risks introduced by hooks.

• ERC-777 is backward compatible with ERC-20, but requires careful handling of new features.

• The standard is particularly beneficial for use cases needing event-driven token behavior.

ERC-777 is a newer Ethereum token standard designed to address long-standing limitations of ERC-20 while introducing programmable “hooks” for richer token flows. If you’ve been following developer conversations around composability, safer approvals, and protocol automation, ERC-777 sits at the intersection of those needs. This article explains how ERC-777 works, why it exists, where it shines, the security trade-offs to watch, and how users and builders can approach it in 2025.

The problem ERC-777 set out to solve

ERC-20 became the default fungible token standard, but it has notable pain points:

  • Approvals are clunky and error-prone (e.g., forgetting to reset allowances).
  • Contracts cannot react automatically when tokens arrive; they need pull-style interactions.
  • Transfer semantics are limited, making complex flows (fees, callbacks, multi-step workflows) harder.

ERC-777 attempts to modernize this by offering:

  • Built-in send/receive hooks so contracts can react to transfers within the same transaction.
  • Operator-based transfers, which simplify token management for custodians and services.
  • Backward compatibility with ERC-20 interfaces to ease ecosystem adoption.

For a formal specification, see the canonical ERC-777 standard on the Ethereum Improvement Proposals site: EIP-777. To situate it within the broader token ecosystem, Ethereum’s developer docs on token standards provide context and links across related EIPs: Ethereum token standards overview.

How ERC-777 works: hooks and operators

Two core ideas power ERC-777.

  1. Hooks
  • tokensToSend: A sender-side hook called before tokens move.
  • tokensReceived: A receiver-side hook called after tokens arrive.
  • These are opt-in and discovered via the global interface registry, EIP-1820.

Using hooks, contracts can implement business logic during transfers: auto-staking, fee splitting, logging, gating, or rejecting unexpected tokens. Hooks increase composability and reduce the need for separate “approve then call” flows.

  1. Operators
  • An operator is authorized to transfer tokens on behalf of a holder, similar to a delegated custodian.
  • Default operators can be set by a token, and users may revoke them at any time.
  • Operators on ERC-777 are a more explicit and flexible model compared to ERC-20 allowances.

In practice, most teams rely on audited libraries. OpenZeppelin provides a widely used implementation with clear APIs and guardrails: OpenZeppelin ERC-777 contracts.

A minimal developer example

Below is a schematic of a receiver contract using tokensReceived via EIP-1820. Always use vetted libraries and perform audits for production code.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC777/IERC777.[sol](https://onekey.so/blog/ecosystem/best-sol-wallets-in-2025-ultimate-guide-to-software-hardware-options/)";
import "@openzeppelin/contracts/interfaces/IERC1820Registry.[sol](https://onekey.so/blog/ecosystem/best-sol-wallets-in-2025-ultimate-guide-to-software-hardware-options/)";

[contract](https://onekey.so/blog/ecosystem/what-is-a-smart-contract/) ExampleReceiver {
    IERC1820Registry constant _ERC1820 =
        IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);

    bytes32 constant TOKENS_RECIPIENT_INTERFACE_HASH =
        keccak256("ERC777TokensRecipient");

    event Received(address operator, address from, uint256 amount, bytes data, bytes operatorData);

    constructor() {
        _ERC1820.setInterfaceImplementer(address(this), TOKENS_RECIPIENT_INTERFACE_HASH, address(this));
    }

    // ERC777 tokensReceived hook
    function tokensReceived(
        [address](https://onekey.so/blog/ecosystem/what-is-a-crypto-wallet-address/) operator,
        [address](https://onekey.so/blog/ecosystem/what-is-a-crypto-wallet-address/) from,
        [address](https://onekey.so/blog/ecosystem/what-is-a-crypto-wallet-address/) /*to*/,
        uint256 amount,
        bytes calldata data,
        bytes calldata operatorData
    ) external {
        // Custom logic, e.g., record deposit or trigger internal accounting
        emit Received(operator, from, amount, data, operatorData);
    }
}

Key takeaway: hooks allow contracts to “listen” for token movements without separate function calls, reducing friction and making complex flows feel native.

Security considerations: reentrancy and protocol design

Hooks are powerful, but they introduce reentrancy risk if contracts aren’t designed defensively. In early DeFi, a series of incidents highlighted how token callbacks could unexpectedly interact with protocols that assumed ERC-20-like behavior. Those lessons pushed best practices that remain relevant today:

  • Favor checks-effects-interactions in state-changing functions.
  • Use reentrancy guards on external call paths.
  • Carefully design pool/accounting logic to be robust against callback execution mid-transfer.
  • Consider a “pull” model for sensitive operations when possible.
  • Avoid assuming transfers are side-effect free.

Even though the specific Uniswap v1 era exploits are history, the principle stands: hooks make token transfers active, not passive. Modern audits and libraries have evolved accordingly. For a foundational reference on the standard and its security notes, see EIP-777. To study well-maintained patterns and guardrails, refer to OpenZeppelin’s ERC-777 documentation.

Interoperability and migration from ERC-20

ERC-777 tokens are generally backward compatible with ERC-20 interfaces, but assumptions differ:

  • Transfers can trigger hooks, which may have side effects.
  • Operators replace or complement allowances, changing how services interact.
  • Wallets and dApps must handle metadata and hook-based flows correctly.

Some teams stick with ERC-20 plus improvements like EIP-2612 permit (gasless approvals), given broad ecosystem familiarity. Others adopt ERC-777 where programmable reception or operator semantics materially improve UX or protocol logic.

2025 landscape: where hooks fit

While ERC-20 still dominates fungible tokens, hooks have influenced design elsewhere. A clear example is Uniswap v4’s architecture, which embraces programmable “hooks” at the liquidity pool level to enable features like dynamic fees and bespoke logic, making the protocol more composable by design. For context on this evolution, see the Uniswap v4 overview and hooks discussion: Uniswap v4 announcement and hooks.

At the token level, ERC-777 adoption remains selective—particularly in contexts where automatic callbacks and operator semantics deliver tangible value, such as:

  • Custodial or service-provider flows that benefit from operator transfers.
  • On-chain loyalty programs or streaming payments that react upon receipt.
  • Infrastructure layers that want token-native callbacks for accounting or fee collection.

Meanwhile, Layer 2 networks continue to improve throughput and cost profiles, making more complex token lifecycle logic viable. This environment makes ERC-777’s programmability a timely option for teams that need richer transfer semantics but can invest in robust security engineering.

Best practices for builders

  • Use audited libraries and default to well-known implementations. Start with OpenZeppelin’s ERC-777.
  • Design hook logic for failure modes: reject unexpected tokens, validate origin, and maintain invariant checks.
  • Document default operators clearly; provide simple revoke paths for users.
  • Apply reentrancy protections, especially around tokensReceived, and avoid external calls during critical accounting steps unless strictly necessary.
  • Consider whether you truly need hooks. If not, ERC-20 plus EIP-2612 permit may simplify integration and user expectations.
  • Test across wallets and dApps that may treat ERC-777 differently. Use the EIP-1820 registry correctly to register implementers.

Practical tips for users

  • Understand that ERC-777 tokens can trigger logic when they reach certain contracts. This is usually beneficial, but it changes assumptions compared to “passive” ERC-20 transfers.
  • Review what you are approving and to whom. If a token uses operators or callbacks, make sure you trust the receiving contract’s code and reputation.
  • Prefer wallets that display clear contract method details, not just “transfer” or “send.” If something looks unfamiliar or includes arbitrary data fields, pause and verify.

When to consider ERC-777

ERC-777 makes sense when:

  • You need event-driven token behavior at the moment of transfer (e.g., auto-deposit, fee routing, custom gating).
  • Operators meaningfully simplify your service or custodial model.
  • You’re committed to rigorous security engineering and audits to handle callback-based semantics safely.

ERC-777 may be less ideal when:

  • Simplicity and broad ecosystem compatibility are paramount.
  • You can achieve your goals via ERC-20 plus permit, or higher-level protocol mechanics (e.g., application-specific controllers without token hooks).

A hardware wallet perspective

For token standards with richer behavior and potential side effects, clear transaction introspection and offline signing are invaluable. OneKey is an open-source hardware wallet that emphasizes transparent on-device confirmations and broad EVM token support. If you routinely interact with advanced token standards or DeFi protocols that leverage callbacks, using a hardware wallet helps ensure you verify exactly what you are signing and reduces exposure to malicious contracts. In other words, ERC-777’s sophistication makes secure key management and explicit, human-readable confirmations even more important—areas where a device like OneKey can provide meaningful peace of mind.

Conclusion

ERC-777 introduces modern token features—hooks and operators—that unlock richer, more composable token flows on Ethereum and EVM chains. Its power comes with responsibility: hooks are active, not passive, and demand defensive programming and careful UX. In 2025, the concept of hooks has influenced protocol design beyond tokens, as seen in Uniswap v4, while ERC-777 itself remains a targeted choice for teams who truly benefit from programmable reception and operator semantics. Whether you adopt ERC-777 or stick with improved ERC-20 patterns, pair good engineering practices with secure user workflows—and consider hardware-backed signing—so your token logic is both powerful and safe.

Secure Your Crypto Journey with OneKey

View details for OneKey ProOneKey Pro

OneKey Pro

Truly wireless. Fully offline. The most advanced air-gapped cold wallet.

View details for OneKey Classic 1SOneKey Classic 1S

OneKey Classic 1S

Ultra-thin. Pocket-ready. Bank-grade secure.

View details for OneKey SifuOneKey Sifu

OneKey Sifu

1-on-1 wallet setup with OneKey Experts.

Keep Reading