1

In the substrate node runtime, I can see this :

pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;

where Signature is just this:

pub enum MultiSignature {
    /// An Ed25519 signature.
    Ed25519(ed25519::Signature),
    /// An Sr25519 signature.
    Sr25519(sr25519::Signature),
    /// An ECDSA/SECP256k1 signature.
    Ecdsa(ecdsa::Signature),
}

And then in frame_system::Config, I would've expected the type of AccountId to specify this but I a bit confused to not see that happen:

impl frame_system::Config for Runtime {
    type AccountId = AccountId;
    ...
}

Which leads me to my question, where does one actually specify what kind of crypto keys the chain uses for standard accounts?

3
  • Have a look at this question and let me know if there is still anything uncertain. substrate.stackexchange.com/questions/5385/… Commented Jan 25, 2023 at 9:09
  • @DaanvanderPlas This is helpful but I don't feel it addresses my question. Where in the code do I tell my chain what crypto from MultiSignature am I using for keypairs?
    – RoboT
    Commented Jan 25, 2023 at 10:48
  • Or is it the case that substrate by default supports all three crypto signatures (ECDSA, ed25519, sr25519) and that an account may be represented by any crypto pair as long as the pubkey is SS58 encodable?
    – RoboT
    Commented Jan 25, 2023 at 10:55

1 Answer 1

2

This is determined offchain when an account is created. So you can choose to make an account from one of the signature schemes you can see in Multisignature

This is one functionality a wallet provider offers for example. Substrate provides subkey (code) and if you run:

cargo +nightly build --package subkey --release

./target/release/subkey generate --help

You can see the possibility for using the different signature schemes:

enter image description here

2
  • Just to reiterate, you're saying I can have two accounts, alice using ecdsa and bob using sr25519 on the same runtime?
    – RoboT
    Commented Jan 25, 2023 at 14:53
  • Correct that is possible Commented Jan 25, 2023 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.