Stoodkev avatar

Hive - CAIP-10

stoodkev

Published: 09 Feb 2022 › Updated: 09 Feb 2022Hive - CAIP-10

Hive - CAIP-10

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 mintrawaHive account@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

Leave Hive - CAIP-10 to:

Written by

Witness. Building Keychain and Hive Multisig.

Read more #hive posts


Best Posts From Stoodkev

We have not curated any of stoodkev's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Stoodkev