ERC-7950 Transaction hash notation with a chain ID (Encode chain id with transaction hash)

Final · Other · created 2025-05-22

A notation that combines a chain ID and a transaction hash into a single string. It lets you tell which chain a transaction belongs to from the string alone.

Why it is needed

A transaction hash is a unique value that identifies a single transaction recorded on a blockchain, but the hash alone does not reveal which chain the transaction occurred on. The Ethereum ecosystem has many chains distinguished by number (chain ID), so looking up a transaction by hash always requires finding out separately which chain it is on. The transaction object inside a chain contains the chain ID, but it carries too much unnecessary data to be used for locating a transaction. This standard puts the chain ID and the hash into one string, so that the correct chain can be found easily from that one string alone. For example, it can be used in a forwarder service that takes such a string and routes it to the appropriate blockchain explorer.

In depth

String composition and syntax

The encoded string consists of three elements. The first is the chain ID (chainId), the second is the transaction hash (txHash), and the third is the static string tx, which serves as a type identifier. The syntax is chainId:txHash:tx. The transaction hash MUST include the 0x prefix. As an example from the specification, a transaction with hash 0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef on chain ID 1 is written as 1:0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef:tx.

Chain IDs follow EIP-155

The chain ID used in the string MUST be based on EIP-155 and the chain ID repository specified in that EIP. EIP-155 is a standard that puts the chain ID into transaction signatures so that transactions are distinguished per chain, and this standard adopts that chain ID scheme as is. The requires field also lists 155.

Case-insensitive

All characters in the string are case-insensitive. Therefore, whether the hash part is written in uppercase or lowercase, it must be interpreted as referring to the same transaction.

Why the element order and the tx suffix

The chain ID is the most important piece of information when routing a query with this standard, so it is placed as the first element of the string. The transaction hash is the second most important element, so it comes next. The trailing tx suffix is there to distinguish the string from, for example, an address. Without tx, it is impossible to tell whether the encoded string points to an address, a transaction hash, or something else.

Why a new string instead of existing formats

The chain ID is already included in some object formats, such as the transaction object inside a blockchain. However, such objects contain a lot of data that is unnecessary for the purpose of finding a transaction's chain. This standard solves that purpose with one lightweight string that contains only the chain ID, the hash, and a type identifier. This proposal is a standard finalized with Final status.

Things to watch out for

Original ERC · ← ERCs