主页EIPs周刊
EIPsERC-7950
ERC-7950

Encode chain id with transaction hash

Encode a chain ID and transaction hash into a unique string format
FinalStandards Track: ERC
创建时间: 2025-05-22
关联 EIP: EIP-155
Lauri Peltonen (@microbecode)
社区讨论原文链接编辑
1 分钟了解
欢迎补充好内容
去提交
相关视频
欢迎补充好内容
去提交
正文

Abstract

This standard proposes a way to encode the combination of a chain ID and a transaction hash into one string.

Motivation

Looking up a transaction by its hash always requires the context of the chain - a transaction hash alone is not enough to identify the used chain. If the chain information is included in the string itself, finding the right chain for the transaction is easy.

Such strings can then be used, for example, in a forwarder service that forwards to the correct blockchain explorer.

The chain id is included in some object formats, such as the transaction object inside the blockchain itself, but that object has a lot of unneeded data for our purposes.

Specification

The encoded string has three components:

  • A chain ID, denoted as chainId. The used chain id MUST be based on EIP-155 and the chain ID repository stated in that EIP.
  • A transaction hash, denoted as txHash. The hash MUST include the 0x prefix.
  • A static string tx, acting as a type identifier.

The syntax is: chainId:txHash:tx.

An example for a transaction with hash 0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef that was issued on chain ID 1 is: 1:0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef:tx.

All of the characters are case-insensitive.

Rationale

The chain ID is the most important detail when routing queries based on this standard and is therefore the first element in the string. The transaction hash is the second most important element.

The suffix tx is used to differentiate from, for example, addresses. Without the tx it would remain unclear whether an encoded string refers to an address, a transaction hash or something else.

Security Considerations

This EIP does not introduce direct security risks. It is up to the external service providers (such as wallet developers and blockchain explorers) to decide how and if they want to incorporate this EIP.

Copyright and related rights waived via CC0.

扩展阅读
欢迎补充好内容
去提交
相关项目
欢迎补充好内容
去提交

不想错过最新的 EIP 动态?

订阅 EIPs Fun 周刊以跟进相关更新,建⽴你与 EIP 之间的连接 ,更好地建设以太坊。

详情
支持以太坊贡献者,推动生态建设
资源
GitHub