Smart Contract Method ID Finder

Look up smart contract method signatures by their 4-byte method ID

Enter the first 4 bytes of a function selector to look it up
Common Examples
How it works: This tool searches the 4byte.directory database, which maintains a registry of Ethereum function signatures and their corresponding 4-byte method IDs. Click "Search" to open results in a new tab.

1. What is a Method ID?

A method ID (or function selector) is the first 4 bytes of the Keccak-256 hash of a function signature. It's used to identify which function to call in a smart contract transaction.

2. How does it work?

4byte.directory

4byte.directory is a community-maintained database of Ethereum function signatures. When you see an unknown method ID in a transaction, you can look it up here to find the human-readable function signature.

Use Cases

  • Identify unknown function calls in transactions
  • Reverse-engineer contract interactions
  • Understand what a transaction is trying to do
  • Verify function signatures match expected values

3. Examples

ERC-20 transfer

0xa9059cbb → transfer(address,uint256)

ERC-20 approve

0x095ea7b3 → approve(address,uint256)

ERC-20 transferFrom

0x23b872dd → transferFrom(address,address,uint256)

4. Source Code

typescript
1// npm install viem
2
3import { keccak256, toBytes } from 'viem';
4
5// Get method ID (4-byte selector) from function signature
6function getMethodId(signature: string): string {
7  const hash = keccak256(toBytes(signature));
8  return hash.slice(0, 10); // First 4 bytes (8 hex chars + "0x")
9}
10