Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Method-Specific Identifier

The unique, method-defined string within a Decentralized Identifier (DID) that follows the namespace, used to locate and manage the DID on its specific registry.
Chainscore © 2026
definition
BLOCKCHAIN GLOSSARY

What is a Method-Specific Identifier?

A precise definition of the Method-Specific Identifier, a core concept in Ethereum smart contract interaction.

A Method-Specific Identifier (MSI), commonly known as a function selector, is the first four bytes of the Keccak-256 hash of a smart contract function's signature, used to uniquely identify which function to execute in an Ethereum Virtual Machine (EVM) transaction. This compact identifier is the critical piece of data in the data field of a transaction that tells the receiving contract precisely which logic to run, distinguishing between functions like transfer(address,uint256) and approve(address,uint256).

The process of generating an MSI is deterministic: the function's canonical signature—its name and the parenthesized, comma-separated list of its parameter types—is hashed using Keccak-256, and the first four bytes (eight hexadecimal characters) of the resulting hash are taken. For example, the widely used transfer(address,uint256) function hashes to 0xa9059cbb..., making its MSI 0xa9059cbb. This mechanism allows the EVM to efficiently route calls without needing to parse complex human-readable strings during execution.

Understanding MSIs is essential for developers interacting with or analyzing smart contracts. They appear directly in raw transaction data on-chain, in event logs, and are used internally for function dispatch within a contract's bytecode. When building transactions programmatically using libraries like web3.js or ethers.js, the MSI is automatically computed and appended to the call data. Analysts and block explorers use these identifiers to decode and interpret transaction purposes, making them a fundamental element for blockchain transparency and interoperability.

how-it-works
DECODING THE IDENTIFIER

How It Works in DID Resolution

A Method-Specific Identifier (MSI) is the unique, core string within a Decentralized Identifier (DID) that is defined and processed by a specific DID method. This section explains how this component functions within the DID resolution process to locate a DID document.

A Method-Specific Identifier (MSI) is the component of a Decentralized Identifier (DID) that follows the did:<method-name>: prefix and is uniquely defined by that specific DID method. For example, in the DID did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a, the MSI is the Ethereum address 0xb9c5714089478a327f09197987f16f9e5d936e8a. The DID method's specification dictates the syntax, generation rules, and resolution logic for this identifier, making it the key that the resolver uses to query the underlying ledger, blockchain, or system where the associated DID Document is anchored.

During the DID resolution process, the resolver first parses the DID string to extract the method name and the MSI. The resolver then invokes the corresponding DID method driver—a software module that understands how to interact with that specific decentralized system. The driver uses the MSI as a direct lookup key or input to a specific algorithm. For instance, a did:key method might decode the MSI directly into a public key, while a did:ion method would use the MSI to query a Sidetree-based blockchain for anchor files containing the DID Document's state.

The design of the MSI is critical for deterministic resolution. A well-formed MSI must allow any compliant resolver to locate the exact same DID Document data from the target system, ensuring global consistency. This is why MSIs are often cryptographically derived values like public key hashes or ledger-specific addresses. The separation of the method prefix from the MSI enables the DID architecture to be extensible and interoperable, allowing new verification methods and ledger technologies to be integrated without altering the core resolution framework, as long as they define a clear scheme for their method-specific identifiers.

key-features
METHOD-SPECIFIC IDENTIFIER

Key Features

A Method-Specific Identifier (MSI) is a unique, deterministic hash derived from a smart contract's function signature. It is the core mechanism for routing and identifying function calls on-chain.

01

Function Selector

The Function Selector is the first 4 bytes (8 hex characters) of the Keccak-256 hash of a function's canonical signature (e.g., transfer(address,uint256)). It is the primary MSI used in the EVM call data to specify which function to execute. This compact identifier is essential for contract-to-contract interaction and is what the EVM's dispatch logic matches against.

02

Deterministic Generation

MSIs are generated deterministically from the function signature, ensuring consistency across all implementations. The process is:

  • Take the canonical function string (e.g., balanceOf(address)).
  • Compute its Keccak-256 hash.
  • Take the first 4 bytes of the hash as the selector. This allows any tool or contract to precompute the exact identifier for a known function, enabling static analysis and safe low-level calls.
03

Collision Resistance

While the 4-byte space is limited (~4.3 billion possibilities), the cryptographic hash function provides sufficient collision resistance for practical use. However, developers must be aware that short or similar signatures can theoretically collide. This is why standardized function signatures (like ERC-20's) are critical. The EVM treats the selector as an absolute identifier; a collision would cause a contract to execute the wrong function.

04

Application Binary Interface (ABI) Encoding

The MSI is the leading component in ABI-encoded call data. The full calldata is structured as: [4-byte Selector][32-byte Arg1][32-byte Arg2]... This standardized encoding allows wallets (like MetaMask), indexers, and other contracts to correctly encode transactions and decode logs. Tools like Ethers.js and web3.js automatically compute selectors and handle this encoding.

05

Event Topics

For smart contract events, the first topic in the log is the Keccak-256 hash of the event signature (e.g., Transfer(address,address,uint256)). This acts as an MSI for log filtering. Indexers and clients use this topic to efficiently scan for specific events across blocks without needing to decode every log. It's a critical performance optimization for blockchain data queries.

06

Beyond the EVM: Other VMs

Other virtual machines use analogous constructs. In Solana, the instruction discriminator serves a similar purpose—a unique byte array prepended to serialized data to identify the program instruction. In CosmWasm, a string-based identifier is often used within the message enum. The core concept of a compact, pre-agreed identifier for contract logic is universal across smart contract platforms.

syntax-and-structure
SYNTAX AND STRUCTURE

Method-Specific Identifier

A method-specific identifier, commonly known as a **function selector**, is a unique 4-byte hash used in Ethereum and EVM-compatible blockchains to specify which function in a smart contract should be executed.

The identifier is generated by taking the first four bytes (the most significant 32 bits) of the Keccak-256 hash of the function's canonical signature. This signature is the function name followed by the parenthesized, comma-separated list of its parameter types, without spaces or parameter names (e.g., transfer(address,uint256)). The resulting 8-character hexadecimal prefix, like 0xa9059cbb, acts as a compact, collision-resistant pointer within the contract's bytecode.

When a user or another contract initiates a transaction, the call data must begin with this 4-byte selector. The EVM uses it to jump to the correct function logic. This mechanism is fundamental to contract ABI (Application Binary Interface) interoperability, allowing external systems to encode calls predictably. Without the correct selector, a transaction will either revert or, in rare cases, invoke a fallback function.

Understanding selectors is crucial for developers performing low-level calls using call(), delegatecall(), or staticcall(), as they must construct the calldata manually. They are also key in signature replay security and event topic indexing, where the selector of a function forms the first topic of its event log. Tools like Ethers.js and Web3.js libraries abstract this calculation, but the underlying hash is always present.

examples
IDENTIFIER FORMATS

Examples Across DID Methods

A Decentralized Identifier (DID) is anchored to a specific DID method, which defines the syntax and operations for its creation, resolution, and management. The method-specific identifier is the unique string that follows the method name in a DID URI.

01

did:ethr (Ethereum)

The did:ethr method uses Ethereum addresses as its method-specific identifier. It typically represents a public key or a smart contract on the Ethereum blockchain.

  • Format: did:ethr:<ethereum_address>
  • Example: did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a
  • The identifier is derived from an Ethereum EOA (Externally Owned Account) or a contract, enabling control via the corresponding private key.
02

did:key (Public Key)

The did:key method encodes a raw public key directly into the identifier itself, making it self-contained and verifiable without a blockchain.

  • Format: did:key:<multibase_encoded_public_key>
  • Example: did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
  • The identifier is the multibase encoding of a multicodec-prefixed public key, supporting various cryptographic suites (Ed25519, secp256k1).
03

did:web (Web Domains)

The did:web method uses a domain name as its identifier, allowing DIDs to be resolved via HTTPS from a well-known location on the web.

  • Format: did:web:<domain_name>[:path]
  • Example: did:web:example.com:user:alice
  • The method-specific identifier maps to a URL where the DID Document is hosted, providing a simple, non-blockchain decentralized identity solution.
04

did:ion (Sidetree on Bitcoin)

The did:ion method uses the Sidetree protocol atop Bitcoin to create scalable, self-certifying identifiers. The identifier is a long-form or short-form hash.

  • Format: did:ion:<method-specific-id>
  • Example (Short): did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w
  • The identifier is a Base64URL-encoded hash of the initial DID Document state, enabling recoverable and updateable DIDs on an immutable ledger.
05

did:btcr (Bitcoin Transaction)

The did:btcr method anchors an identifier to a specific, unspent Bitcoin transaction output (UTXO).

  • Format: did:btcr:<tx_hash>-<output_index>
  • Example: did:btcr:xz35-jznz-q9yu-p7t (encoded)
  • The method-specific identifier points to the TXREF encoding of a Bitcoin transaction, tying identity control to the ability to spend from that UTXO.
06

did:sov (Sovrin / Hyperledger Indy)

The did:sov method, originally for the Sovrin network, uses a base58-encoded string representing a verkey (verification key) on a permissioned ledger.

  • Format: did:sov:<method-specific-id>
  • Example: did:sov:WRfXPg8dantKVubE3HX8pw
  • The identifier is derived from the initial public key written to the ledger, with control facilitated through a NYM transaction on the Indy network.
DECENTRALIZED IDENTITY

Comparison: Identifier vs. DID Document

Contrasts the core components of a Decentralized Identifier (DID) system as defined by the W3C specification.

FeatureDID (Identifier)DID Document

Primary Function

Persistent, resolvable URI for a subject

Machine-readable document describing the DID subject

Syntax

did:method:method-specific-id

JSON-LD or JSON data structure

Location / Storage

Referenced on-chain or in a decentralized system

Resolved from the DID's method-specific endpoint or ledger

Core Components

Method scheme, method name, method-specific identifier

id, verification methods, authentication, service endpoints

Mutability

Immutable (persistent identifier)

Mutable (can be updated via DID Controller)

Cryptographic Proof

Identifier itself is not a proof

Contains public keys and verification methods for proofs

Primary Use Case

Addressing and referencing a subject

Enabling authentication and interaction with the subject

technical-details
TECHNICAL DETAILS AND CONSTRAINTS

Method-Specific Identifier

An explanation of the unique identifiers used to specify functions within smart contracts on a blockchain.

A Method-Specific Identifier, commonly known as a function selector or method ID, is the first four bytes of the Keccak-256 hash of a function's canonical signature, used to uniquely identify which function to execute within an Ethereum Virtual Machine (EVM) smart contract. This compact, four-byte prefix is prepended to the encoded call data in every transaction or message call, allowing the EVM to route execution to the correct contract logic efficiently. For example, the selector for a function transfer(address,uint256) is 0xa9059cbb.

The canonical signature is derived by taking the function name and the parenthesized, comma-separated list of its parameter types, without spaces or parameter names. This standardization is crucial for interoperability, ensuring that wallets, indexers, and other contracts compute the same identifier. Selectors are deterministic and collision-resistant, though the four-byte space is finite, leading to potential selector clashes where different function signatures hash to the same identifier, a critical security consideration during contract development.

Beyond basic function dispatch, method IDs are fundamental to Ethereum's Application Binary Interface (ABI) specification, which defines how data is encoded for the EVM. They enable higher-level functionalities such as contract introspection and the implementation of generic proxy patterns like the ERC-1967 upgradeable proxy standard, where a fallback function delegates calls based on the selector. Understanding selector generation and usage is essential for debugging transactions and building secure, composable decentralized applications.

METHOD-SPECIFIC IDENTIFIER

Frequently Asked Questions

Common questions about Method-Specific Identifiers (MSIs), a core concept for identifying and analyzing smart contract interactions on the blockchain.

A Method-Specific Identifier (MSI) is a unique, standardized hash derived from a smart contract function's signature, used to precisely identify and categorize on-chain transactions. It is generated by taking the Keccak-256 hash of a function's canonical string (e.g., transfer(address,uint256)) and taking the first 4 bytes (8 hexadecimal characters) of the resulting hash, known as the function selector. This compact identifier, such as 0xa9059cbb for a standard ERC-20 transfer, is prepended to the encoded call data of every transaction, allowing nodes, indexers, and analytics platforms to instantly determine which function is being invoked without needing the full contract ABI. This enables efficient filtering, decoding, and analysis of on-chain activity at scale.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team