XRPLF / xrpl.js

A JavaScript/TypeScript API for interacting with the XRP Ledger in Node.js and the browser
https://xrpl.org/
1.19k stars 507 forks source link

xrpl.Wallet.fromSeed generates different wallet than it should #2636

Closed fakirpic closed 5 months ago

fakirpic commented 5 months ago

i generate a random wallet at somewhere else than xrpl, trying to import by xrpl, but getting different address as example for this shTBcvGPVw9tzTZhWpkzBAkiqdFz6 seed key i get rfA77Zy5HT1XKNQDR56xaR8TL7HxzJCYKM as address at osmwallet, but at xrpl i get

image

xrpl.Wallet.fromSeed("shTBcvGPVw9tzTZhWpkzBAkiqdFz6") Wallet { publicKey: 'EDC675EEC8D183AEE43124882D70B924D3F14131A4F52310A4F95EC8DF92847FA4', privateKey: 'ED4C3B490EBF4CDE1624F5A692CA8B48DF3A2A738F1ADF2E5698F090F5F42EE6E7', classicAddress: 'rfRp96xJebfYdXdWSmPDEDjXcbYmcodfun', seed: 'shTBcvGPVw9tzTZhWpkzBAkiqdFz6' } why,is this a bug or what may I be doing wrong?

JST5000 commented 5 months ago

The issue is that by default the Wallet uses an ED25519 encoding instead of the older but less performant Secp256k1 encoding. When generating your wallet, please specify algorithm = ECDSA.secp256k1 (or equivalently: algorithm = "ecdsa-secp256k1")