简体   繁体   English

Flutter 应用程序在生成 bip39 密钥对时崩溃

[英]Flutter app crashes when generating bip39 keypair

I am generating keypair from memnomic phrase for my crypto app, and anytime i try to generate the address and private key, the whole app start to lag and crashes,i have also tried using the coompute isolate for this case, it is still the same,我正在为我的加密应用程序从 memnomic 短语生成密钥对,每当我尝试生成地址和私钥时,整个应用程序开始滞后和崩溃,我也尝试过在这种情况下使用 ccompute isolate,它仍然是一样的,

// how it been called
var keys = await compute(calculateDashKey, mnemonic);

// implementation
Map calculateDashKey(String seedPhrase) {
  final seed = bip39.mnemonicToSeed(seedPhrase);
  final root = bip32.BIP32.fromSeed(seed);
  final node = root.derivePath("m/44'/5'/0'/0/0");
  var address = P2PKH(
          data: PaymentData(
            pubkey: node.publicKey,
          ),
          network: dash)
      .data
      .address;
  return {
    'address': address,
    'private_key': "0x${HEX.encode(node.privateKey)}"
  };
}

I think the problem is with the library bip39.我认为问题出在库 bip39 上。 If you're using this bip39 library then you should look at the GitHub. It was last updated 2 years ago and it is a known issue that it freezes your UI .如果您正在使用这个 bip39 库,那么您应该查看 GitHub。它最近一次更新是在 2 年前,它会冻结您的 UI 是一个已知问题 Perhaps you should find a new library or contact the original developer.也许你应该找一个新的库或联系原来的开发者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM