Skip to content
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

I can't run it using Cygwin on Windows 7 #49

Open
Mr-N00B opened this issue Oct 6, 2020 · 9 comments
Open

I can't run it using Cygwin on Windows 7 #49

Mr-N00B opened this issue Oct 6, 2020 · 9 comments

Comments

@Mr-N00B
Copy link

Mr-N00B commented Oct 6, 2020

OS: Windows 7 x64
I'm using the recommended compiler Cygwin with the required packages.
if I used the following:
./bitcoin-tool \ --network bitcoin \ --input-type private-key \ --input-format raw \ --input-file key.bin \ --output-type private-key-wif \ --output-format base58check \ --public-key-compression compressed
it results
-bash: ./bitcoin-tool: Is a directory
it gives the same result even if I cd to the bitcoin-tool folder ..
also when I try:
apt-cyg http://github.com/matja/bitcoin-tool.git install
it results:

Installing http://github.com/matja/bitcoin-tool.git
Unable to locate package http://github.com/matja/bitcoin-tool.git

I tried make -f Makefile too .. but it results undefined reference to __errno

I have like 2000 text files filled with random WIF (~300M) keys which I thought this tool may help me to convert them to addresses ..
can someone please explain to me how to use it correctly? I'm totally new to Cygwin and I truly have no idea what to do .. I have been trying for like a week .. I searched for any solution or anyone who may have faced the same issues but not so many people using this tool ..
Also, I tried to install Gentoo on my other laptop .. and it is really hard work and still can't install Gentoo 😆
It would be really appreciated if you can explain to me how to use this tool.
Thanks in advance :)
P.S: I know it is mentioned in the README file that it was tested on Windows10 .. I tried it on Windows10 .. same results .. and by the way .. is it only me or the cygwin reads //comments as code lines I had to remove the comments manually!
@matja

@streamofstars
Copy link

streamofstars commented Oct 6, 2020

If you have access to a Windows 10 machine you may have more success using Windows Subsystem for Linux with Ubuntu instead of Cygwin. Within WSL you can compile and run the tool the same way as you would on normal Linux machine. Since @matja provided only instructions for Gentoo, which I believe is not a very popular distro nowadays, let me give you steps for Ubuntu:

sudo apt install git make gcc libssl-dev
git clone https://github.com/matja/bitcoin-tool
cd bitcoin-tool/
make
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-tool

I have just tested it on Ubuntu 20.04.1 LTS x86_64 minimal image on Google Cloud Virtual Machine. The last step (sudo install...) is not necessary but if you follow it then you will be able to call the tool binary from anywhere in your system by just typing bitcoin-tool <parameters> If you skip that step, you must run either from within the folder you have the binary in or by providing the full path and obviously prepending with dot and slash so e.g. ./bitcoin-tool <parameters>

Also, if you have a file with multiple WIF keys and want to get addresses, your command is wrong. Use the below:
bitcoin-tool --input-type private-key-wif --input-format base58check --input-file YOURFILE.bin --batch --output-type address --output-format base58check

@Mr-N00B
Copy link
Author

Mr-N00B commented Oct 6, 2020

bitcoin-tool --input-type private-key-wif --input-format base58check --input-file YOURFILE.bin --batch --output-type address --output-format base58check

regarding the file extension .bin .. I have the WIF keys in text files with .txt extension .. can't I use these text files instead or it has to be converted to .bin?
P.S: My name is not a joke, I'm really noob regarding linux, C & bitcoin 🤣

@streamofstars
Copy link

Extension does not matter, in your example there is key.bin so I used the same one in mine, but it can be anything. The extension does not matter as long as the file is actually a text file and you provide the right name as argument.

@Mr-N00B
Copy link
Author

Mr-N00B commented Oct 6, 2020

Extension does not matter, in your example there is key.bin so I used the same one in mine, but it can be anything. The extension does not matter as long as the file is actually a text file and you provide the right name as argument.

ok thank you for your reply .. I will install ubuntu and try out your solution and let you know the results ..

@Mr-N00B
Copy link
Author

Mr-N00B commented Oct 7, 2020

bitcoin-tool --input-type private-key-wif --input-format base58check --input-file YOURFILE.bin --batch --output-type address --output-format base58check
It worked on Ubunto just fine no issues at all .. but I tried using this command and I edited the file name to PKs.txt "which is my text file with the WIF keys" .. it resulted:

Invalid character (ASCII 13)
Failed to decode Base58Check input (invalid format)

BUT not with all of them .. I think this may because the text file encoding itself because I created those files on Windows I'm not sure though .. it read one of the files and it gave the expected results .. now I have a question .. is it possible to make it create a text files and add the results to it? I mean .. I want it to read and convert from A and store them to B .. is it possible?

@streamofstars
Copy link

I don't know how the tool behaves when reading files that have mixed line endings. Aside from that, check if all WIFs are OK, maybe some WIFs are incomplete (too short) or you have some extra empty lines in file.
When it comes to the tool output to a file, there is no a switch for that. But of course you can just redirect output to a file. In Linux somecommmand > outputfile.txt:
bitcoin-tool --input-type private-key-wif --input-format base58check --input-file INPUTFILE.TXT --batch --output-type address --output-format base58check > OUTPUTFILE.TXT

@Mr-N00B
Copy link
Author

Mr-N00B commented Oct 8, 2020

The tool works fine on the OS you suggested and following your steps ..
Thank you for taking time to help me solve it ..
regarding this part:
bitcoin-tool --input-type private-key-wif --input-format base58check --input-file INPUTFILE.TXT --batch --output-type address --output-format base58check > OUTPUTFILE.TXT
I have tried this but it works only once then it won't work again if I changed the input and the output files ..
I tried > , >> both won't work more than once ..

@streamofstars
Copy link

What do you mean by won't work more than once, do you get any error message?

@dextronomous
Copy link

for that ascii13 error you need to save your txt file trough notepad+ as EOL conversion to unix LF,
after that that error won't be there anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants