![](/img/trans.png)
[英]how to fix 'no such algorithm ecdsa for provider bc' while creating new wallet file using web3j
[英]Web3J - Creation of Light Wallet takes too long
我正在使用Web3j库在Android应用中创建钱包: https ://web3j.io/
看代码:
String seed = UUID.randomUUID().toString();
ECKeyPair exKey = Keys.createEcKeyPair();
WalletFile wallet = Wallet.createLight(seed,exKey);
它正在正确创建电子钱包,问题在于该过程需要很长时间,大约需要10分钟。
难道我做错了什么?
还有另一种方法可以使其更快吗?
您应该通过以下方式创建钱包:
try {
ECKeyPair ecKeyPair = Keys.createEcKeyPair();
BigInteger privateKeyInDec = ecKeyPair.getPrivateKey();
String sPrivatekeyInHex = privateKeyInDec.toString(16);
WalletFile aWallet = Wallet.createLight(UUID.randomUUID().toString(), ecKeyPair);
String sAddress = aWallet.getAddress();
} catch (CipherException e | InvalidAlgorithmParameterException e | NoSuchAlgorithmException e | NoSuchProviderException e) {
//
}
为了生成钱包,我更改了方法:
WalletFile wallet = Wallet.createLight(String seed, ECKeyPair exKey);
对于以下方法:
WalletFile wallet = Wallet.create(String seed,ECKeyPair exKey, int n, int p);
这比createLight快得多(过去只有10分钟,现在只有几秒钟)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.