Skip to content

Question: Extension of CAIP-10 for smart contract and operation hashes? #347

Open
@jdsika

Description

@jdsika

The did:pkh method, along with the CAIP-10 specification, could provide a standardized way to represent blockchain addresses, including those for smart contracts and operations. However, the current specifications may not fully cover all use cases, such as Tezos KT1 accounts and operation hashes (or for Ethereum).

Issues with KT1 Accounts and Operation Hashes

  1. KT1 Accounts:

    • KT1 addresses on Tezos are originated accounts that can hold smart contracts. They are computed from an origination nonce and are unique to the chain they are created on .
    • The CAIP-10 specification for Tezos primarily focuses on implicit accounts (tz1, tz2, tz3, tz4), which are derived from public key hashes. It does not explicitly define how to handle KT1 addresses, which are derived differently .
  2. Operation Hashes:

    • Operation hashes are unique identifiers for operations on the Tezos blockchain, such as transactions or smart contract calls. The CAIP-10 specification does not currently define a standard way to represent these hashes within the did:pkh method .

Potential Solutions

To address these gaps, you could consider the following approaches:

  1. Extend CAIP-10:

    • Propose an extension to the CAIP-10 specification that includes a standardized way to represent KT1 addresses and operation hashes. This would involve defining new formats and ensuring they are consistent with the existing specification.
  2. Custom URN Schema:

    • Develop a custom URN schema that can represent KT1 addresses and operation hashes in a way that is compatible with the did:pkh method. This schema should be designed to be flexible and extensible to accommodate future changes.

Example Custom URN Schema

Here's an example of how you might define a custom URN schema for Tezos:

  • Smart Contracts (KT1 Addresses): urn:tezos:contract:<chain-id>:<kt1-address>
  • Operation Hashes: urn:tezos:operation:<chain-id>:<operation-hash>

These URNs would provide a clear and consistent way to identify smart contracts and operations across different Tezos networks.

By addressing these issues, you can create a more comprehensive and standardized way to represent Tezos-specific identifiers within the did:pkh method and CAIP-10 specification.

The question is to extend CAIP-10 and therefore the did:pkh method to better represent Tezos KT1 accounts and operation hashes. However, there are some potential challenges and alternative considerations based on existing standards in Ethereum and other blockchain ecosystems.

1. Existing Standardized Approaches for Identifiers in Ethereum

  • Ethereum Smart Contracts:

    • Ethereum smart contract addresses are simply Ethereum addresses (0x prefixed, 160-bit identifiers).
    • They are referenced in transactions, logs, and contract calls without any additional encoding in Ethereum standards.
    • Ethereum Name Service (ENS) provides a human-readable identifier (contract.eth).
    • ERC-681 defines a URI scheme for smart contract calls (ethereum:<address>), but it doesn’t natively handle operation hashes.
  • Ethereum Transaction Hashes (Operation Identifiers)

    • Ethereum transaction hashes (operation hashes) are 256-bit Keccak hashes.
    • There is no widely accepted URI format for Ethereum transaction references beyond Etherscan-style URLs.
    • Some projects use ethereum:tx:<tx-hash> informally, but it isn’t standardized.
  • Ethereum’s did:pkh Implementation

    • The did:pkh method follows CAIP-10 to represent blockchain accounts as DIDs.
    • The format did:pkh:eip155:1:0xabc123... is used for Ethereum addresses.
    • It does not inherently support contract or transaction hashes, but it could be extended.

2. Challenges with Extending CAIP-10

  • Implicit vs. Explicit Accounts

    • CAIP-10 focuses on account-based identities rather than operational or contract-based references.
    • Adding smart contracts (KT1 addresses) into CAIP-10 would require defining whether they are treated as identities or simply as objects referenced by identities.
  • Operation Hashes Are Ephemeral

    • Unlike accounts, operation hashes (transaction IDs) are one-time-use identifiers.
    • While CAIP-10 extends to blockchain namespaces, it was not designed for ephemeral, one-time transaction identifiers.
    • This could require a separate DID method or another approach.

3. Potential Alternative Solutions

  • Leverage did:pkh for Smart Contracts

    • Extending did:pkh with an optional contract identifier could work.
    • Example:
      did:pkh:tezos:NetXnHfVqm9iesp:KT1PCaD2kmgCHy15wQ1gpqZUy9RLxyBVJdTF
      
    • This follows the existing pattern of did:pkh but includes smart contract addresses.
  • Use a Custom did:tezos Method for Operation Hashes

    • Since operations are more akin to ephemeral proofs than persistent identities, a new DID method could be warranted.
    • Example:
      did:tezos:NetXnHfVqm9iesp:oojtGLnHuS8og5WGf8jF8EoxTbegfrXvpxzvyPiW2GYZFGbFLaJ
      
    • This approach isolates transaction references from account-based DIDs.
  • Adopt a TZIP-21-Like URI Schema

    • The Tezos ecosystem could define a URI standard similar to TZIP-21 for contracts and operations.
    • Example URNs:
      urn:tezos:contract:NetXnHfVqm9iesp:KT1PCaD2kmgCHy15wQ1gpqZUy9RLxyBVJdTF
      urn:tezos:operation:NetXnHfVqm9iesp:oojtGLnHuS8og5WGf8jF8EoxTbegfrXvpxzvyPiW2GYZFGbFLaJ
      
    • This aligns well with structured metadata and ensures interoperability across different tools.

5. Conclusion

The idea to extend CAIP-10 and did:pkh is logical, but the challenges of handling smart contracts and operation hashes in an identity-based system suggest alternative approaches. Using did:pkh for KT1 addresses and a custom URN (urn:tezos:operation:<chain-id>:<operation-hash>) for transaction references might be the most practical way forward.

Question

What are the thoughts and experiences of the maintainers here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions