Closed CoinInn-Aries closed 3 years ago
They are using different crypto types - one is using sr25519 while the other is using ed25519
To illustrate here a code snippet - the comments are what gets logged to the console:
import { Keyring } from '@polkadot/api';
import { cryptoWaitReady } from '@polkadot/util-crypto';
async function main(): Promise<void> {
await cryptoWaitReady();
const m =
'fringe history shy cupboard orbit supreme skin ladder soup shallow unaware wasp';
const keyring1 = new Keyring({ ss58Format: 42, type: 'sr25519' });
const keypair1 = keyring1.addFromUri(m);
console.log(keypair1.address);
// 5Gj1TdhEP1TSrcEYwUMUqFS8XwMUqgxDcMCGeW9pxXgyKfRS
const keyring2 = new Keyring({ ss58Format: 42, type: 'ed25519' });
const keypair2 = keyring2.addFromUri(m);
console.log(keypair2.address);
// 5GgrbTa5op5Xkv1wY6PAVNFdCyS5BLPhErYLGGiywskBSV8K
}
main().catch(console.log);
Thanks, solved my problem
paritytech/txwrapper create address: const mnemonic = mnemonicGenerate(); console.log(" memonic: ", mnemonic); // fringe history shy cupboard orbit supreme skin ladder soup shallow unaware wasp console.log(keyring.createFromUri(mnemonic).address); // 5GgrbTa5op5Xkv1wY6PAVNFdCyS5BLPhErYLGGiywskBSV8K
use import polkadot{.js} extension The address generated by importing mnemonic words is: 5Gj1TdhEP1TSrcEYwUMUqFS8XwMUqgxDcMCGeW9pxXgyKfRS
why?