matja / bitcoin-tool

Tool for converting Bitcoin keys and addresses
216 stars 118 forks source link

option to skip invalid inputs when in batch mode #12

Closed y closed 8 years ago

y commented 8 years ago

I'm trying to recover a private key and know most of it and am using a program to generate the possible full private keys. So I'm calling bitcoin-tool like so:

./generate-keys | bitcoin-tool --batch --network bitcoin --input-type private-key-wif --input-format base58check --input-file - --output-type address --output-format base58check --public-key-compression compressed

But bitcoin-tool exits when it encounters any keys which fail to decode properly with base58check, so I'm forced to call bitcoin-tool in a shell script for each individual key, which is a lot slower. Is it possible to add an option to just skip invalid input when under batch mode?

matja commented 8 years ago

Thanks for this suggestion, great idea. I've added an option --ignore-input-errors to continue processing the input in the event of errors. Base58 decoding errors are now output to stderr like the other types of errors (this was a bug), so you can filter them out with 2>&1 if required.