Search code examples
substrate

Can we use a different address format in substrate?


Substrate uses ss58 formated addresses by default? Is it possible to override this in substrate and use a different format P2PKH for example?


Solution

  • Addresses in Substrate are only superficially represented by SS58. The real underlying data the SS58 represents is an AccountId32, which is just [u8; 32].

    Substrate does support multiple different account formats using the MultiAddress abstraction: https://github.com/paritytech/substrate/blob/master/primitives/runtime/src/multiaddress.rs

    You can see here, for example, that we also support [u8; 20] which is a 20 byte address commonly used in Ethereum.

    You should be able to write code which allows any kinds of accounts/address formats or even different kinds of cryptography, however, the deeper you go, the more you will need to understand how to integrate those things into your chain.

    That being said, Substrate should totally be flexible to support anything like this.