无法将助记词转换为 solana 钱包的种子
Failing in convert a mnemonic to a seed for a solana wallet
我正在尝试在后端使用钱包种子,使用 nodejs
,在区块链中进行连接。来自 "@solana/web3.js" library has a fromSeed
method, that I use with input from another method, from the bip39 库的 Keypair
模块,将我的助记符转换为种子。这是我的代码
const mnemonic = <My-mnemonic>
console.log(bip39.validateMnemonic(mnemonic)) // true
bip39.mnemonicToSeed(mnemonic).then(buffer => Keypair.fromSeed(buffer)).catch(err => console.log(err))
这是我的错误
Error: bad seed size
at Function.nacl.sign.keyPair.fromSeed (/home/diazrock/Carrera/Elasbit/NFT's/mint-nft-solana/node_modules/tweetnacl/nacl-fast.js:2329:11)
at Function.fromSeed (/home/diazrock/Carrera/Elasbit/NFT's/mint-nft-solana/node_modules/@solana/web3.js/lib/index.cjs.js:5625:53)
at bip39.mnemonicToSeed.then.buffer (repl:1:55)
我正在尝试在后端使用钱包种子,使用 nodejs
,在区块链中进行连接。来自 "@solana/web3.js" library has a fromSeed
method, that I use with input from another method, from the bip39 库的 Keypair
模块,将我的助记符转换为种子。这是我的代码
const mnemonic = <My-mnemonic>
console.log(bip39.validateMnemonic(mnemonic)) // true
bip39.mnemonicToSeed(mnemonic).then(buffer => Keypair.fromSeed(buffer)).catch(err => console.log(err))
这是我的错误
Error: bad seed size
at Function.nacl.sign.keyPair.fromSeed (/home/diazrock/Carrera/Elasbit/NFT's/mint-nft-solana/node_modules/tweetnacl/nacl-fast.js:2329:11)
at Function.fromSeed (/home/diazrock/Carrera/Elasbit/NFT's/mint-nft-solana/node_modules/@solana/web3.js/lib/index.cjs.js:5625:53)
at bip39.mnemonicToSeed.then.buffer (repl:1:55)