Skip to content

Add NEAR Protocol namespace (near) with CAIP-2 profile - #203

Open
okwme wants to merge 1 commit into
ChainAgnostic:mainfrom
okwme:add-near-namespace
Open

Add NEAR Protocol namespace (near) with CAIP-2 profile#203
okwme wants to merge 1 commit into
ChainAgnostic:mainfrom
okwme:add-near-namespace

Conversation

@okwme

@okwme okwme commented Sep 14, 2026

Copy link
Copy Markdown

Adds a CAN for NEAR Protocol with a CAIP-2 Blockchain ID profile.

This answers the open request in #106 ("CAIP-2 for NEAR"), which pointed at ChainAgnostic/CAIPs#43 — that PR was closed unmerged in 2023 with "please make all namespace PRs in the namespaces repo", and nobody did. There is no near/ folder and no other NEAR PR, so this should not collide with in-flight work.

Who wrote this, and why you should read it sceptically

I do not represent the NEAR ecosystem. I maintain FAR, an open cross-reference between CAIP-19, CoinGecko and ISO 24165 (DTI) identifiers, which needs a CAIP-2 for NEAR in order to name 72 assets that exist on it. This is offered as a starting point for NEAR's maintainers to correct, adopt or replace, and I would rather it carried their name than mine. Happy to close it in favour of a NEAR-authored version.

Proposal

near: + the nearcore chain_id string, verbatim and case-sensitive.

near:mainnet
near:testnet

Verified live (2026-09-14)

  • status on rpc.mainnet.near.org and rpc.testnet.near.org, and independently on free.rpc.fastnear.com / test.rpc.fastnear.com — all four agree chain_id is literally "mainnet" / "testnet".
  • RpcStatusResponse.chain_id is a required field in nearcore's own OpenAPI, documented "Unique chain id", with the warning "If your testnet blockchains do not have unique chain IDs, you will have a bad time".
  • Network constants read from core/primitives-core/src/chains.rs.

Why the human-readable id rather than a genesis hash

Two reasons the spec argues rather than asserts:

  1. NEAR has no block 0. Both public endpoints return UNKNOWN_BLOCK for block 0 — genesis heights are 9,820,210 (mainnet) and 42,376,888 (testnet), because each network's genesis is a state snapshot rather than a bootstrapped empty chain. An implementer following the usual "query block 0" recipe gets an error.
  2. The genesis hash is 44 base58 characters, over CAIP-2's 32-char limit, and base58 truncation lands on no byte boundary — the truncated value would be neither the hash nor a hash of anything. bip122's 32 hex chars are exactly the first 16 bytes; base58 has no such property.

Precedent cited: cosmos (cosmos:cosmoshub-3 appears in CAIP-2's own test cases), sui, flow, stellar, tezos.

Flagged for whoever writes the CAIP-19 profile

NEAR account ids may contain _ (verified live: v3.oin_finance.near is a working NEP-141 token), and _ is not legal in either a CAIP-19 asset_reference or a CAIP-10 account_address. Percent-encoding as %5F is legal under both and is named as the obvious candidate, but I deliberately left that decision to whoever writes those profiles rather than pre-empting it from outside the ecosystem.

discussions-to points at 0xcounting/FAR#1, which also carries the wider gap list.

Adds a CAN for the near ecosystem with a CAIP-2 Blockchain ID profile.
Drafted by the maintainers of FAR, an open cross-reference between CAIP-19,
CoinGecko and ISO 24165 identifiers, which needs a CAIP-2 for this chain to
name assets that exist on it. The authors do not represent the near ecosystem
and offer this as a starting point for its community to correct, adopt or
replace. Discussion: 0xcounting/FAR#1
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

Successfully merging this pull request may close these issues.

1 participant