CAIPs icon indicating copy to clipboard operation
CAIPs copied to clipboard

CAIP-19: Add block number tag

Open TimDaub opened this issue 3 years ago • 7 comments

  • In today's CASA call we discussed this change and it was suggested that I e.g. use the "#" separator to indicate the block number.
  • Some writing about uri hierarchy: https://datatracker.ietf.org/doc/html/rfc3986#section-1.2.3
  • I also checked DID ethr and it doesn't use block numbers: https://github.com/decentralized-identity/ethr-did-resolver/blob/master/doc/did-method-spec.md
  • I'm not sure if I'm specifying the ABNF correctly. Happy to have someone correct me.
  • We should probably indicate that the + "#" + block_number_tag section is optional. How would I do that in ABNF?

Survey

Did a survey on which chains use ascending block number heights. All that I checked use the concept except for Hedera

ethereum: https://etherscan.io/block/15051057 bitcoin: https://blockchair.com/bitcoin/block/743020 cosmos: https://www.mintscan.io/cosmos/blocks/11082723 litecoin: https://blockchair.com/litecoin/block/2289502 lisk: https://legacy-explorer.lisk.com/block/11289477821881538126 eos: https://eosauthority.com/block/254866414?network=eos polkadot: https://explorer.polkascan.io/polkadot/block/10964158 filecoin: https://explorer.bitquery.io/filecoin/height/1943190 handshake: https://e.hnsfans.com/block/126736 tezos: https://tzstats.com/2494326 stellar: https://stellarchain.io/ledger/41553526 solana: https://explorer.solana.com/block/139663191 hedera: doesn't use block tags

TimDaub avatar Jun 30 '22 16:06 TimDaub

Do we want to be HTTP compatible (e.g., can be used by an HTTP gateway with translated HTTP URL)? If so, I would suggest using a character other than "#" as "#" will be treated as a hashtag in HTTP.

qizhou avatar Jul 11 '22 05:07 qizhou

not sure if I understand this. Wouldn't slashes and colons also interfere? I understand that if you wanted to use CAIP19 as an ID in an URL you'd be running into trouble.

Actually, I've also called this out in an issue but there is someone missing who is making the problematic abundantly clear IMO: https://github.com/ChainAgnostic/CAIPs/issues/81

TimDaub avatar Jul 11 '22 08:07 TimDaub

The issue with hashtag # is that in modern browsers, the fragment after hashtag will not be passed to the webservers, i.e., if the webservers need to process the fragment part, it will never find it in the request if the link is visited by a browser (e.g., visited by gateway_link + CAIP19_link).

For slashes and colons, I think they are fine as long as they are passed to the server (e.g., https://web3q.io/vitalikca.eth:4/ works for ERC-4804-translated URL).

qizhou avatar Jul 11 '22 20:07 qizhou

Great point, but then I think the block number tag should come after the chainId and it'll break existing CAIP-19

TimDaub avatar Jul 12 '22 07:07 TimDaub

Have ever tried a query with blockNumber attribute? This may become

asset_type: chain_id + "/" + asset_namespace + ":" + asset_reference + "&" + query

query = ("blockNumber" | "n") "=" blockNumber

qizhou avatar Jul 12 '22 18:07 qizhou

great suggestion, feel free to submit this directly as a PR superseeding/updating mine. I'll be a week on Holiday so I won't make the change sooon

TimDaub avatar Jul 13 '22 12:07 TimDaub

See https://github.com/ChainAgnostic/CAIPs/pull/125

qizhou avatar Jul 14 '22 18:07 qizhou