Utilities and base libraries for use across polkadot-js for Polkadot and Substrate. Includes base libraries, crypto helpers and cross-environment helpers.
Apache License 2.0
254
stars
147
forks
source link
Question for how to get publickey and privatekey & how to verify those key? #1889
Hi, I'm using polkadotjs. When I create a wallet, I create a mnemonic first.
After generating the mnemonic, I tried to get some information(address, publickey, privatekey) like below source code.
Plz check these below source code and result, and give me some feedback which one is incorrect. If incorrect how can I modify that?
import { mnemonicGenerate, cryptoWaitReady, encodeAddress, mnemonicToMiniSecret, randomAsHex, ed25519PairFromSeed } from '@polkadot/util-crypto';
import { Keyring } from '@polkadot/keyring';
import { u8aToHex, stringToU8a, hexToU8a, u8aToString } from '@polkadot/util';
Hi, I'm using polkadotjs. When I create a wallet, I create a mnemonic first. After generating the mnemonic, I tried to get some information(address, publickey, privatekey) like below source code. Plz check these below source code and result, and give me some feedback which one is incorrect. If incorrect how can I modify that?
Additionally, How can I get "mnemonic" from secretKey?