Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Section "Resolution Method" of CAIP 2 has a statement that is incorrect if the chain is a fork or its block hashes are over 16 bytes #116

Open
daira opened this issue Jun 18, 2024 · 1 comment

Comments

@daira
Copy link

daira commented Jun 18, 2024

https://namespaces.chainagnostic.org/bip122/caip2#resolution-method :

To query for a Chain ID to represent or checksum a BIP122 reference, make a JSON-RPC request to the blockchain node with method getblockhash, for example:
[...]
The response will return as a result value the hash for the block with height 0 that should be sliced to its first 16 bytes (32 characters for base 16) to be compatible with the reference syntax defined above.

This is inconsistent with BIP 122 for forked chains:

The chain ID of a chain is the block hash of the corresponding genesis block. For forked chains, it's the block hash of the first block after fork.

So querying the hash will typically give the height of the fork, not height 0. Also, this method typically will not return any height if the chain has block hashes that are not expressed as 32 hex digits (or its nodes do not have a getblockhash JSON-RPC method).

@bumblefudge
Copy link
Collaborator

Hey, this is worrisome to hear! Would a simple wordsmithing PR address the Resolution Method section?

As for the 32hex digit hashes, which BIP122 chains use a different hash expression? What would you recommend for defining CAIP-2s for those chains?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants