从 SS58 地址获取公钥

问题描述

根据The Subkey Tool。我们可以使用 #include "Cellphone.h" #include "Electronic_device.h" #include "Laptop.h" #include "Smartwatch.h" #include <vector> #include <typeinfo> int main() { string name; int i = 0; Electronic_device** ptr = new Electronic_device*[100]; Cellphone c1("Samsung",1023,"black",250.00,1); Smartwatch s1("IBM",10,"red",350.00,2); Laptop l1("HP",102,1250.00,16,true); ptr[0] = &c1; ptr[1] = &s1; ptr[2] = &l1; ptr[0]->print(); for (i = 0; i < sizeof(ptr); i++) { if (typeid(*ptr[i]) == typeid(Cellphone)) { cout << "Cellphone" << endl; } if (typeid(*ptr[i]) == typeid(Smartwatch)) { cout << "Smartwatch" << endl; } if (typeid(*ptr[i]) == typeid(Laptop)) { cout << "Laptop" << endl; } } ((Cellphone *)ptr[0])->printCellphone(); } 生成一个 pub/private 密钥,如下所示:

subkey generate

我的问题:

我如何从 $ subkey generate Secret phrase `cement drum say almost secret series daughter eager ceiling fetch about duck` is account: Secret seed: 0xb84c6858ca5f331a703203e853d3537eac0a3d4b54838dc69d8e6d395ab4ec6f Public key (hex): 0x5075808dbd0eb02828a525c6332596f0e95c3d0b9ecfede376195ca95bca415b Account ID: 0x5075808dbd0eb02828a525c6332596f0e95c3d0b9ecfede376195ca95bca415b SS58 Address: 5DtCbNMGwhnP5wJ25Zv59wc5aj5uo3wYdr8536qSRxbvmLdK 获取 Public key在这个例子中,是否可以从 SS58 Address 得到 0x5075808dbd0eb02828a525c6332596f0e95c3d0b9ecfede376195ca95bca415b

解决方法

您可以通过 subkey inspect <ss58> 实现这一点。