feat(nbcr-2023-002): adopt hex-string + UAI dot form for token-ids#19
Merged
Merged
Conversation
- Introduce 'hex-string = #6.263(bstr)' (IANA CBOR tag 263) as an alternative encoding for canonically hex token identifiers, halving the on-wire size for EVM contract addresses. - Switch the ERC-1155 example from ':' to the '.' separator per UAI (NBCR-2024-001), aligning with the "tokenid[.subtype...]" convention used elsewhere in the paper. - Generalise the per-chain comment block to cover ERC-721, drop the "decimal" prescription on ERC-1155 token ids (EIP-1155 defines _id as uint256; rendering is implementation choice). - Tighten grammar from '[+ string]' to '[+ tstr / hex-string]'. - Fix typo '#6.308(output-descriptor)' → '#6.40308(...)'. - Add NBCR-2024-001, hexString, and EIP-1155 references. No wire-format change for existing tstr payloads. Previously-emitted detailed-accounts decode unchanged. Refs LIQ-842
e2e62ee to
b08c569
Compare
adbena
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Aligns
detailed-account(NBCR-2023-002, Layer 3) with:hex-string = #6.263(bstr)(IANA CBOR tag 263) as an alternative encoding for canonically hex token identifiers, primarily EVM contract addresses..separator (per NBCR-2024-001) for compound identifiers such as ERC-721 / ERC-1155.tstrremains valid. Previously-emitted payloads decode unchanged.On-wire impact
For an EVM ERC-20 contract address (20 bytes on-chain, 42 characters as
0x…text):tstr(previous)hex-string(tag 263)A portfolio with 20 ERC-20 identifiers saves ~400 bytes total, often enough to drop one or two animated-QR frames from a sync flow (recommended fragment size is 200 characters per QR).
Parser impact
Tag
41402(detailed-account) and the keymap (account = 1,token-ids = 2) are unchanged. The change is additive: one new alternative inside thetoken-idsarray union.tstrpath decodes as before. No action needed for backward compatibility.bstrinsidetoken-ids. The wrapped bytes are the hex-interpreted identifier (20 bytes for an EVM contract address; variable for future encodings). Display layers render with a0xprefix, lowercase, preserving round-trip parity with the caller's input.token-idsentries are consumed.0x<lowercase hex>.tstrpath for non-hex identifiers (e.g. SPL mint addresses).@ngraveio/ur-hex-string, consumed byDetailedAccountin feat(DetailedAccount): addhexstring to token-id definition ur-registry#49.Backward compatibility
[+ string]grammar decode unchanged under[+ tstr / hex-string].:(e.g.0xabc:123) remain decodable aststr. The grammar does not constrain the separator; it is a prose convention. Producers SHOULD migrate to.to match UAI; consumers MAY continue accepting both during the transition.Other editorial changes
#6.308(output-descriptor)→#6.40308(...)in the CDDL comment (tag 308 is the deprecatedcrypto-output; the actual rule correctly uses 40308)._idasuint256; rendering is implementation choice.stringto RFC 8610's canonicaltstr.Not in this PR
tstrform for ERC-20 addresses. They remain valid under the new spec; a follow-up can regenerate them to showcasehex-string(also touches the accompanying CBOR hex and UR encodings below each diagnostic example).[hex-string, biguint]for compound identifiers (separate proposal).References