Hive - CAIP-10

stoodkev(71)
Published in
#hive
Words
217
Reading
1 min
Listen
Play
5y

image.png

CAIP

To read about CAIP and the motivations for proposing CAIP-2 and CAIP-10 standards for Hive, please read this post first.

The CAIP-2 regarding Hive namespace definition has been submitted for review in this pull request.

CAIP-10

The scope of this post is to propose an account ID standard matching the Hive usernames.
CAIP 10 is defined as:

CAIP-10 defines a way to identify an account in any blockchain specified by CAIP-2 blockchain id.

The original chain agnostic account ID goes as follow :

account_id:        chain_id + ":" + account_address
chain_id:          [:-a-zA-Z0-9]{5,41}
account_address:   [a-zA-Z0-9]{1,64}

The problem with that definition is that it only includes alphanumeric characters, while some Hive usernames also contain . and/or -.

CAIP-10 for Hive

I've started a draft of a Hive-compatible CAIP-10 here, based on the required template.

Proposed account ID definition is as follow, based on a Hive username regex by mintrawa@mintrawa (vote for witness). Note that only the account_address changes.

account_id:        chain_id + ":" + account_address
chain_id:          [:-a-zA-Z0-9]{5,41}
account_address:   ^(?=.{3,16}$)[a-z]([0-9a-z]|[0-9a-z\-](?=[0-9a-z])){2,}([\.](?=[a-z][0-9a-z\-][0-9a-z\-])[a-z]([0-9a-z]|[0-9a-z\-](?=[0-9a-z])){1,}){0,}$

The simplicity of Hive username regex is a beauty to behold =p

Using CAIP-94 (CAIP-2 for Hive namespace) and this CAIP, chain agnostic dApps could define Hive accounts as follow :

# @hiveio account on mainnet
hive:beeab0de000000000000000000000000:hiveio

## Accounts with special characters (`-`,`.`)

# @hive.fund account on mainnet
hive:beeab0de000000000000000000000000:hive.fund

# @hive-blockchain account on testnet
hive:18dcf0a285365fc58b71f18b3d3fec95:hive-blockchain

The second and third examples above aren't currently possible because of the limitations of current CAIP-10 (as explained above). This CAIP aims to solve this issue.

Future work

  • Submit for review and follow up
  • Hive AuthProvider on Ceramic
Hive - CAIP-10 | Ecency