当前位置:网站首页>Technology | diverse substrate formats

Technology | diverse substrate formats

2022-07-06 10:16:00 GearFans

SS58 Address

SS58 Is a simple address format , Designed to be based on Substrate The chain of development . There is no problem using other address formats , but SS58 Is a default . SS58 Bitcoin based Base58-check Format , And made some modifications .

Type prefix

SS58 The format contains an address type prefix , Used to identify belonging to a specific network ( Parallel chain ) The address of . Different type prefixes , The beginning of the generated address is different .

polkadot There are many parallel chains on the network , Each parallel chain will specify 1 Prefixes , This will have its own specific format , It will be distinguished from the addresses of other parallel chains .

for instance :

  • General purpose substrate The address is always in numbers 5 start
  • polkadot The address is always in numbers 1 start
  • kusama The address always begins with a capital letter , Such as C、D、F、G、H、J

following 4 The addresses look completely different , If you use subkey inspect Tools , You will find that they have the same public key, Public key .

5CCvtLnaPwk1cBo8wuayYAuwgCumHnssrY5Nxk7S7t1ruBU2 # substrate  Type address 
19E2g3eFj1V3ioeuYdygKk6XpuQz6S1w2os836nfy3P5bYL # polkadot  Type address 
CiYYf8T2JkwMqcaicQ2S8GwpoC16Th4Juv8MQPPbgEMe6dv # kusama  Type address 
211pcbTg6dkkcJrHxsSDTLQLzgLMXvjDpSMBGsXoJWzFtbPS # acala  Type address 

Friends with technical background can try  subkey inspect, This command also shows which network the address is ( Parallel chain ) Of .

subkey inspect 5CyREBErNFhogptd92dtC8ybuoUczVYh2ijvdhTpS2PJGeq7

  Network ID/version: substrate
  Public key (hex):   0x28340716214bbe2fc67db7eec79ae267cb664fe74395ad9831dafa4d36d21716
  Account ID:         0x28340716214bbe2fc67db7eec79ae267cb664fe74395ad9831dafa4d36d21716
  SS58 Address:       5CyREBErNFhogptd92dtC8ybuoUczVYh2ijvdhTpS2PJGeq7

###########

subkey inspect 1uiNWVvE2yH8Mu96fgtLHokmRUGgo6q7DUQnzTAz7QpT5c5

  Network ID/version: polkadot
  Public key (hex):   0x28340716214bbe2fc67db7eec79ae267cb664fe74395ad9831dafa4d36d21716
  Account ID:         0x28340716214bbe2fc67db7eec79ae267cb664fe74395ad9831dafa4d36d21716
  SS58 Address:       1uiNWVvE2yH8Mu96fgtLHokmRUGgo6q7DUQnzTAz7QpT5c5

So these networks ( Parallel chain ) How is the type prefix specified ? You can check it out  ss58-registry. Here is a simple table .

Prefix Address type Address start Address example
0polkadot119E2g3eFj1V3ioeuYdygKk6XpuQz6S1w2os836nfy3P5bYL
2kusamaC、D、F、G、H、J etc. CiYYf8T2JkwMqcaicQ2S8GwpoC16Th4Juv8MQPPbgEMe6dv
42substrate55CCvtLnaPwk1cBo8wuayYAuwgCumHnssrY5Nxk7S7t1ruBU2
10acala2211pcbTg6dkkcJrHxsSDTLQLzgLMXvjDpSMBGsXoJWzFtbPS
30phala33zm1nSHjnTFHjUwa5X2h1MiqvPCEdbKdbFRoaYPpZct1XJgD

Different types of address translation

Yes 1 individual substrate Type of address  5CyREBErNFhogptd92dtC8ybuoUczVYh2ijvdhTpS2PJGeq7, How to convert it into polkadot The address of the type ?

We can use online tools  Home | Polkadot Address Convertor  Get the results  1uiNWVvE2yH8Mu96fgtLHokmRUGgo6q7DUQnzTAz7QpT5c5.

Subkey

Subkey It's follow Substrate Key generation program developed together . Its main function is to generate key pairs ( The current support sr25519, ed25519 and secp256k1), Yes SS58 Encode the address and restore the key from the mnemonic and the original seed . It can also be in the message ( Including encoded transactions ) Create and verify signatures on .

Generate address and key

generate Command to generate keys and addresses

subkey generate #  Default generation sr25519 secret key 

 Output results 

Secret phrase `spend report solution aspect tilt omit market cancel what type cave author` is account:
  Secret seed:      0x554b6fc625fbea8f56eb56262d92ccb083fd6eaaf5ee9a966eaab4db2062f4d0
  Public key (hex): 0x143fa4ecea108937a2324d36ee4cbce3c6f3a08b0499b276cd7adb7a7631a559
  Account ID:       0x143fa4ecea108937a2324d36ee4cbce3c6f3a08b0499b276cd7adb7a7631a559
  SS58 Address:     5CXFinBHRrArHzmC6iYVHSSgY1wMQEdL2AiL6RmSEsFvWezd

generate We also support the following Sons command

subkey generate -n polkadot
subkey generate --scheme ed25519 #  Generate  ed25519  Type key 
subkey generate --words 12 # ( Support 12、15、18、21 and 24)

Inspection address

inspect The command can recalculate the public key and address of the key pair according to the given key seed .

subkey inspect 5CyREBErNFhogptd92dtC8ybuoUczVYh2ijvdhTpS2PJGeq7

 Output results 

  Network ID/version: substrate #  Address type 
  Public key (hex):   0x28340716214bbe2fc67db7eec79ae267cb664fe74395ad9831dafa4d36d21716 # Public key 
  Account ID:         0x28340716214bbe2fc67db7eec79ae267cb664fe74395ad9831dafa4d36d21716
  SS58 Address:       5CyREBErNFhogptd92dtC8ybuoUczVYh2ijvdhTpS2PJGeq7

Provided 1 Invalid address ,inspect You will be prompted that the address is invalid .

subkey inspect 5GearBErNFhogptd92dtC8ybuoUczVYh2ijvdhTpS2PJGeq7

 Output results 

Invalid phrase/URI given


About GearFans

Gear It's the computing component of Boca Ecology ,GearFans yes Gear Enthusiast community .

原网站

版权声明
本文为[GearFans]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131719085970.html

随机推荐