Consider adding __cdk_name

4
open
lastmjs
lastmjs
Posted 5 months ago

Consider adding __cdk_name #317

I've opened this issue with 3 additional CDK projects:

As we've been developing CDKs (TypeScript/JavaScript with Azle and Python with Kybra), we've been thinking about how to measure adoption of various CDKs. In addition to GitHub metrics (such as analyzing dfx.json), it might be a powerful metric to know exactly how many canisters use a particular CDK. For Azle and Kybra, we're adding a simple method __cdk_name that returns a string with the name of the CDK. This will allow canister indexers like https://icscan.io/ to index canisters by CDK. This could allow viewing of various CDK metrics over time, which I think would be very interesting to many different parties on the IC.

Here's our suggested implementation of the method in cdk-rs:

#[ic_cdk_macros::query]
fn __cdk_name() -> String {
    "cdk-rs".to_string()
}

Here's our suggested implementation of the method in Azle:

#[ic_cdk_macros::query]
fn __cdk_name() -> String {
    "azle".to_string()
}

Here's our suggested implementation of the method in Kybra:

#[ic_cdk_macros::query]
fn __cdk_name() -> String {
    "kybra".to_string()
}

Do you have any thoughts on this pattern?

nomeata
nomeata
Created 5 months ago

I raised some questions about the design at https://github.com/dfinity/motoko/issues/3462

lastmjs
lastmjs
Created 5 months ago

I think it's best to move forward with what is being suggested here: https://github.com/dfinity/motoko/issues/3462#issuecomment-1258599165

roman-kashitsyn
roman-kashitsyn
Created 5 months ago

A custom metadata section (e.g., icp:public cdk_name) might be a better option. https://internetcomputer.org/docs/current/references/ic-interface-spec/#state-tree-canister-information

UPD: Ah, Joachim suggested the same thing.

sesi200
sesi200
Created 5 months ago

We'd like to discuss this topic more in the next developer tooling working group. Please join if you can!