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

Update and extend tezos-caip2/10/122 + Tezos namespace #104

Merged

Conversation

jdsika
Copy link
Contributor

@jdsika jdsika commented Feb 21, 2024

@bumblefudge I can finally make some time to finalize this work which has been started in #40 .

I think you can review the following documents and decide if this qualifies for a status "final":

  • readme
  • tezos-caip-2
  • tezos-caip-10

I am not sure if the required specifications need to list the respective namespace derivative or the original specification (or both)?

requires: ["CAIP-2", "CAIP-10"]

I have addressed this comment here:

Could we update CAIP-2 (and the chainIDs in CAIP-10 while we're here) with a Limanet and a Ghostnet example? If you could add, as I did in the CAIP-2 the genesis block hash, it helps people test their own computation of the chainID string for private chains or future testnets...

I will continue with your comments regarding the tezos-caip122

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…os-caip122

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
add tezos namespace prefix to cahin ID
@jdsika
Copy link
Contributor Author

jdsika commented Feb 21, 2024

Question:
If the chain ID is determined by the genesis block hash we have multiple chains with the same chain ID if a hard fork occurred where both chains share the same genesis block hash. How to handle this correctly?

@jdsika
Copy link
Contributor Author

jdsika commented Feb 21, 2024

Question: If the chain ID is determined by the genesis block hash we have multiple chains with the same chain ID if a hard fork occurred where both chains share the same genesis block hash. How to handle this correctly?

The answer to this could be that the namespace prefix tells what the main chain is and we need to define a criteria in the tezos namespace document on how to determine "social consensus" like e.g. "the longest chain in Bitcoin"

add tezos namespace
Use correct hash function description
* define ghostnet and mainnet as aliases
* use mainnet and ghostnet as chain id aliases
* added Networks as chain ID aliases
* remove Qibing Li (@QibingLee) as user does not exist
* remove Qibing Li (@QibingLee) as user does not exist
@bumblefudge
Copy link
Collaborator

Question: If the chain ID is determined by the genesis block hash we have multiple chains with the same chain ID if a hard fork occurred where both chains share the same genesis block hash. How to handle this correctly?

this is truly a difficult problem, engineered with different combinations of technical and/or social mechanisms in each namespace! feel free to describe the tezos solution (non-normatively, and with links to the most-normative/most-canonical doc you can find in the tezosphere) in caip10.md and tag me for review when you're happy with the new draft 💪

@jdsika
Copy link
Contributor Author

jdsika commented Feb 22, 2024

Can you point me to a document of a chain that has solved in the most elegant way? I actually think it is not solved in tezos (doing research ATM)

Also is it allowed to define an alias for the chain ID as I did it?

Update: I have described the Tezos solution in a paragraph. In addition I have created a ticket regarding a registry for aliases:
https://gitlab.com/tezos/tezos/-/issues/7023 because of the response here: ChainAgnostic/CAIPs#267

jdsika and others added 9 commits February 28, 2024 11:40
* update integrity gurantees for chain IDs
* add tz4 addresses
* add reference to CAIP-104
Update data model
* use account_id instead of address
Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>
Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>
@jdsika
Copy link
Contributor Author

jdsika commented Mar 7, 2024

@bumblefudge can you tell me what the rational was to not include the public key in the CAIP-122 data model but only the account id information?

@jdsika
Copy link
Contributor Author

jdsika commented Mar 7, 2024

@royscheeren could you add a complete sample plain text message and a base64url-encoded byte representation as example in caip-122, please?

royscheeren and others added 2 commits March 7, 2024 16:57
Signed-off-by: Roy Scheeren <hi@royscheeren.com>
Signed-off-by: Carlo van Driesten <carlo.van-driesten@vdl.digital>
Signed-off-by: Carlo van Driesten <carlo.van-driesten@vdl.digital>
@jdsika jdsika marked this pull request as ready for review March 7, 2024 16:26
@jdsika
Copy link
Contributor Author

jdsika commented Mar 7, 2024

@bumblefudge can you tell me what the rational was to not include the public key in the CAIP-122 data model but only the account id information?

Is the reason that looking at Ethereum the public key can be extracted from secp256k1 and the data model was taken from the EIP?

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
@bumblefudge
Copy link
Collaborator

@bumblefudge can you tell me what the rational was to not include the public key in the CAIP-122 data model but only the account id information?

Is the reason that looking at Ethereum the public key can be extracted from secp256k1 and the data model was taken from the EIP?

i'm not sure I understand the question entirely. In EVM, ECRecover is how you check a signature against an address (not knowing the pubkey per se, but being able to derive two of them from the address and check both against the signature). In other systems, like BTC and derivatives, different recovery mechanisms allow you to derive a public key from an address and a signature produced by its privkey. in systems like Solana or Polkadot where the address is (or is a simple transformation of) the public key, the derivation is simpler and does not require a signature. the logic of CAIP-122 is that these mechanics should be specified in the namespace's CAIP-10 profile, and left out-of-scope, since an account, rather than a public key, is what is being authenticated. does that help?

@jdsika
Copy link
Contributor Author

jdsika commented Mar 12, 2024

@bumblefudge can you tell me what the rational was to not include the public key in the CAIP-122 data model but only the account id information?

Is the reason that looking at Ethereum the public key can be extracted from secp256k1 and the data model was taken from the EIP?

i'm not sure I understand the question entirely. In EVM, ECRecover is how you check a signature against an address (not knowing the pubkey per se, but being able to derive two of them from the address and check both against the signature). In other systems, like BTC and derivatives, different recovery mechanisms allow you to derive a public key from an address and a signature produced by its privkey. in systems like Solana or Polkadot where the address is (or is a simple transformation of) the public key, the derivation is simpler and does not require a signature. the logic of CAIP-122 is that these mechanics should be specified in the namespace's CAIP-10 profile, and left out-of-scope, since an account, rather than a public key, is what is being authenticated. does that help?

Yes, it helped and that is what I meant to ask. I do not see the requirement to derive a public key in CAIP-10?

Rationale
The goals of the general account ID format is:

Uniqueness between chains regardless if they are mainnet or testnet
Readibility using the prefix of a chainId to quickly identify before parsing the address
Restricted to constrained set of characters and length for parsing

I think I will not put the public key in the data model of SIWX and make a section that explains on how to get in Tezos and that is the responsibility of the connection layer between app and wallet.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
@jdsika
Copy link
Contributor Author

jdsika commented Mar 12, 2024

@bumblefudge I clarified the public key exchange. Feel free to start your review. Who should be the second necessary reviewer?

@bumblefudge
Copy link
Collaborator

Getting there! Just wordsmithing at this point, the content seems good
StakeNow#1

jdsika added 3 commits March 25, 2024 09:43
Editorial pass for minor style guide issues and clarity
* revert alias to URN
* Refine the alias explanation
Copy link
Contributor Author

@jdsika jdsika left a comment

Choose a reason for hiding this comment

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

Included @bumblefudge editorial review and discussion results

@jdsika
Copy link
Contributor Author

jdsika commented Apr 2, 2024

Ping @bumblefudge

@bumblefudge
Copy link
Collaborator

Sorry! missed the notif that you'd merged the last PR on your side. 🤝

@bumblefudge bumblefudge merged commit 2d72d92 into ChainAgnostic:main Apr 3, 2024
@bumblefudge
Copy link
Collaborator

feel free to tag me in any implementation threads out in the world, or if i can help on the tezos gitlab, i just updated my gitlab email so i should be taggable there as well (also @ bumblefudge)

@jdsika jdsika deleted the feat/extend-tezos-CAIP-2-10-122 branch April 3, 2024 07:07
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