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

Add TrustNet to Slip-0044 #1866

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

qikdauie
Copy link

I would like to reserve coin type index 975 for use with TrustNet. This is a blockchain used for decentralized identity, but in the future we intend on having our wallets support different crypto currencies as well, so a coin type is required to manage the user's various identities and crypto wallets.

You can see our identity offering here
You can see our DID Method here
You can also see our PR for registration to the w3c as a DID method here

This coin type is currently in use in our wallet, but the repository is private for now. I am providing a code snippet for proof of its usage in a wallet.

    // Convert mnemonic to seed without a passphrase
    let seed = mnemonic.to_seed("");

    // Check seed length for generating keypair
    if seed.len() < ed25519_dalek::SECRET_KEY_LENGTH {
        error_result.error_message = "Seed is too short".to_string();
        return error_result;
    }

    // Create the HD path to be used for ed25519 primary key derivation, this needs
    // to be the BIP32 standard because slip-10 uses BIP32 paths
    let ed25519_hdpath = match hdpath::CustomHDPath::from_str("m/44'/975'/0'/0'/0'") {
        Ok(p) => p,
        Err(_e) => {
            error_result.error_message = format!("Failed to create HD path for ed25519");
            return error_result;
        }
    };

    // We need to convert the main hdpath to a BIP32Path for use with slip-10 crate
    let bip32path = match slipped10::path::BIP32Path::from_str(&ed25519_hdpath.to_string()) {
        Ok(p) => p,
        Err(e) => {
            error_result.error_message = format!("Failed to create BIP32 path: {}", e);
            return error_result;
        }
    };

    // Create the primary ed25519 keypair from the seed
    let ed25519_secret: slipped10::Key =
        match slipped10::derive_key_from_path(&seed, slipped10::Curve::Ed25519, &bip32path) {
            Ok(s) => s,
            Err(e) => {
                error_result.error_message =
                    format!("Failed to derive key from seed using BIP32 path: {}", e);
                return error_result;
            }
        };

Reserve 975 for TrustNet usage
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.

1 participant