BIP122 Namespace - Chains

Author Simon Warta, ligi, Pedro Gomes
Discussions-To https://github.com/ChainAgnostic/namespaces/pulls/3
Status Draft
Type Standard
Created 2019-12-05
Updated 2022-03-27
Requires CAIP-2
Withdrawal reason CAIP-4

CAIP-2

For context, see the CAIP-2 specification.

Rationale

The chain ID identifiers for BIP122 are specified in BIP122’s chain ID definition.

Syntax

The syntax for BIP122 chain ID can be summarized as a 32-character prefix from the hash of the genesis block of a given chain, in lowercase hex representation.

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:

// Request
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "getblockhash",
  "params": [0]
}

// Response
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
}

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.

Test Cases

This is a list of manually composed examples:

# Bitcoin mainnet (see [chain ID section of BIP122](https://github.com/bitcoin/bips/blob/master/bip-0122.mediawiki#definition-of-chain-id))
bip122:000000000019d6689c085ae165831e93

# Litecoin
bip122:12a765e31ffd4059bada1e25190f6e98

# Feathercoin (Litecoin fork)
bip122:fdbe99b90c90bae7505796461471d89a

References

  • BIP13: Bitcoin Improvement Proposal specifying “Script Hash” addresses
  • BIP21: Bitcoin Improvement Proposal specifying bitcoin URI scheme
  • BIP122: Bitcoin Improvement Proposal specifying blockchain URI scheme

Rights

Copyright and related rights waived via CC0.

Citation

Please cite this document as:

Simon Warta, ligi, Pedro Gomes, "namespaces/bip122-caip2: BIP122 Namespace - Chains [DRAFT]," Chain Agnostic Namespaces, bip122-caip2, December 2019 / March 2022. [Online serial]. Available: https://github.com/ChainAgnostic/namespaces/bip122-caip2.md