-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generate_mnemonic will block #1
Comments
Hello, thank you for your report. Unfortunately I'm not able to reproduce the problem you're describing on perl 5.32.0 with the module version 0.993. Can you provide some more information about your environment? Also, did the module pass the test suite? There are a couple of mnemonics generated in there, so it should block there as well. Lastly, I think this problem is likely not caused by Bitcoin::Crypto itself but a dependency module Bitcoin::BIP39 which the method you're using is wrapping around. Can you try the
|
right, it also blocked. but how to reslove it ? |
my perl version is 5.26.1, and Bitcoin::Crypto module installed by metacpan. |
Since I can't personally reproduce the problem and it isn't with my code directly I can't really fix it for you unless I drop the dependency. I'm happy to help you troubleshoot tho, but you should later file a bug report to the author of Bitcoin::BIP39 (or its dependency, Bytes::Random::Secure). You forgot to mention if the test suite has successfully passed for you when you were installing the module, but since you don't mention any --force flags on metacpan I'm taking it as a yes. Is the place in code you're having a hang a part of a bigger script or does it also block when all you have in a script is mnemonic generation? Is your perl installation coming from ubuntu's Looking at the |
After having a thought about this and reading a bit more of Bytes::Random::Secure docs, I'm pretty sure its all about a blocking source of entropy, and seems like it's non-blocking on FreeBSD which I am currently using, so no wonder I can't reproduce it locally. Unfortunately, Bitcoin::BIP39 does not give us any way to parametrize the random number generator, so the workaround below is not so straightforward. For now the solution would be to generate entropy yourself, for example via the OO interface of Bytes::Random::Secure, so then you can specify the entropy source to be non-blocking with a constructor parameter. With a generated entropy you'll be able to get a mnemonic with Of course it is a lot of modules to use, so I'll add an option to specify your own entropy for |
Commits for this issue have been released to CPAN. Feel free to re-open the issue if you encounter any more problems. |
my $mnemonic = Bitcoin::Crypto::Key::ExtPrivate->generate_mnemonic();
say "your mnemonic code is: $mnemonic";
above example. when execute twice , the first returns right, but the second the programe will block and it don't return any more.
The text was updated successfully, but these errors were encountered: