Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference Accounts per CAIP-10 #12

Merged
merged 7 commits into from
Apr 3, 2020
Merged

Conversation

pedrouid
Copy link
Contributor

@pedrouid pedrouid commented Mar 31, 2020

Using CAIP-10 (Chain Agnostic Account ID Spec) for account-links

CAIP-10: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md

Copy link
Member

@oed oed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great :D

doctypes/account-link.md Outdated Show resolved Hide resolved
doctypes/account-link.md Outdated Show resolved Hide resolved
doctypes/account-link.md Show resolved Hide resolved
@pedrouid pedrouid marked this pull request as ready for review March 31, 2020 13:25
@pedrouid
Copy link
Contributor Author

pedrouid commented Mar 31, 2020

The only thing that is wrong with this PR that should be fixed before merging, is that there isn't any specifications as far as I know to reference polkadot blockchain IDs

CAIP-2 is a very generic for blockchain IDs which in turn have more specific CAIPs that define for each blockchain namespace. For Ethereum we got CAIP-3, for Bitcoin we got CAIP-4

While it's not required to create a CAIP to add Polkadot, it would be important define a more specific namespace for Polkadot account IDs other than my draft polkadot:polkadot-chain

PS - this shouldnt be a blocker but it would be better to ask someone from the Polkadot community to fix it before merging

@jam10o-new
Copy link

Polkadot addresses already contain a network identifier (some details here https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58)) but this is only enforced on the frontend (which converts addresses to a raw pubkey in most cases).

other than that, there aren't any standards I'm aware of to disambiguate between chains, I think the right place to start would be to grab either spec_name as declared by individual chains (which you can grab using the system.lastRuntimeUpgrade() storage value), or their genesis hashes.

@oed
Copy link
Member

oed commented Apr 1, 2020

That's very helpful @joshua-mir! Looking at your link it seems like there are only 48 address types that refer to networks. Is that right, or are you imagining that future networks when those 48 are filled up would use 128-...?

@pedrouid do you think polkadot:genesis-hash or polkadot:spec_name makes the most sense?

@joshua-mir what would happen if two different chains use the same spec_name? Is that possible?

@jam10o-new
Copy link

jam10o-new commented Apr 1, 2020

@oed it's completely possible for two networks to share the same spec_name, and I don't believe it would cause significant issues, networking and consensus all use the genesis hash, spec_name is only used in the client (to determine which folder to look for chaindata in) and "onchain".

I imagine prefixes 64 and up will also be available to networks, the spec is intentionally vague iiuc

@shawntabrizi
Copy link

I don't think the external address format is a good identifier for a chain, since many different chains may also share them.

Something like the spec_name + genesis hash makes more sense, but at that point, genesis hash should be good enough without the spec_name I think...

@pedrouid
Copy link
Contributor Author

pedrouid commented Apr 1, 2020

So basically you dont have the concept of the chainId in Polkadot? @joshua-mir @shawntabrizi

Then I guess this would be similar to Bitcoin's BIP122. Would it be possible to write a similar spec to CAIP-4 where we describe the Polkadot namespace for chainIds using the genesis hash?

https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-4.md

I can help with the PR but lets get it done on the CAIPs so that we can use it as blockchain reference for these account-links

@pedrouid
Copy link
Contributor Author

pedrouid commented Apr 2, 2020

I've updated the polkadot example to be CAIP-13 compatible @oed

Let's just wait for the CAIP-13 to be merged before merging this PR

@pedrouid
Copy link
Contributor Author

pedrouid commented Apr 3, 2020

Ready to Merge!

@oed oed merged commit f7805af into ceramicnetwork:master Apr 3, 2020
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.

4 participants