scorta / GuessPrivateKey

Searching Private Key(s) for given Bitcoin address(es)
https://scorta.github.io/GuessPrivateKey/
42 stars 39 forks source link

Invalid point error #12

Closed marssystems closed 3 years ago

marssystems commented 3 years ago

I got this error when running GuseePrivateKey -

Exception in thread "Thread-3" java.lang.IllegalArgumentException: Invalid point at org.spongycastle.math.ec.ECAlgorithms.validatePoint(ECAlgorithms.java:193) at org.spongycastle.math.ec.AbstractECMultiplier.multiply(AbstractECMultiplier.java:22) at org.spongycastle.crypto.generators.ECKeyPairGenerator.generateKeyPair(ECKeyPairGenerator.java:73) at org.bitcoinj.core.ECKey.(ECKey.java:179) at org.bitcoinj.core.ECKey.(ECKey.java:168) at GuessKeyThread.searchForKey(GuessPrivateKey.java:128) at GuessKeyThread.run(GuessPrivateKey.java:66)

marssystems commented 3 years ago

Got the same error again -

Exception in thread "Thread-0" java.lang.IllegalArgumentException: Invalid point at org.spongycastle.math.ec.ECAlgorithms.validatePoint(ECAlgorithms.java:193) at org.spongycastle.math.ec.AbstractECMultiplier.multiply(AbstractECMultiplier.java:22) at org.spongycastle.crypto.generators.ECKeyPairGenerator.generateKeyPair(ECKeyPairGenerator.java:73) at org.bitcoinj.core.ECKey.(ECKey.java:179) at org.bitcoinj.core.ECKey.(ECKey.java:168) at GuessKeyThread.searchForKey(GuessPrivateKey.java:128) at GuessKeyThread.run(GuessPrivateKey.java:66)

marssystems commented 3 years ago

Got the same error again. Raised an issue with spongy castle.

Exception in thread "Thread-1" java.lang.IllegalArgumentException: Invalid point at org.spongycastle.math.ec.ECAlgorithms.validatePoint(ECAlgorithms.java:193) at org.spongycastle.math.ec.AbstractECMultiplier.multiply(AbstractECMultiplier.java:22) at org.spongycastle.crypto.generators.ECKeyPairGenerator.generateKeyPair(ECKeyPairGenerator.java:73) at org.bitcoinj.core.ECKey.(ECKey.java:179) at org.bitcoinj.core.ECKey.(ECKey.java:168) at GuessKeyThread.searchForKey(GuessPrivateKey.java:128) at GuessKeyThread.run(GuessPrivateKey.java:66)

scorta commented 3 years ago

What's your command to run the program?

marssystems commented 3 years ago

I use this in a .bat file -

java -jar D:\Guess\GuessPrivateKey.jar 6 bit.txt

scorta commented 3 years ago

I'm not sure, may be it's a bug of bitcoinj (the library I use). But the way you search is not efficient (looking randomly). Normally, I'd search sequentially from a number (right now I'm searching for something between 2^63 and 2^64). The command could be: $java -jar -Xmx6g GuessPrivateKey.jar 8 bit.txt up 8897948761493052818

marssystems commented 3 years ago

Is there any way to test the program with a known private key and wallet address to see if it works as it should or if something isn't quite right?

marssystems commented 3 years ago

I have created a privkey/ address pair - KwYaXBMQaVAoGEMsKQBV4yzCqSjpoYUG1Mh9iNcXw1xYCBg5mtco / 12csdWkGm6qHPLtAeimY4EPJK6TYeNV4LR

I put the address in a file called test.txt I want to use the command - java -jar D:\Guess\GuessPrivateKey.jar 6 test.txt up KwYaXBMQaVAoGEMsKQBV4yzCqSjpoYUG1Mh9iNcXw1xYCBg5mtco

but I don't know if the program searches in HEX or DEC. I will need to convert the privkey to something that the program will accept. I think that at the moment the privkey is in WIF format.

scorta commented 3 years ago

You can put the following addresses into bit.txt to test:

1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH
1CUNEBjYrCn2y1SdiUMohaKUi4wpP326Lb
19ZewH8Kk1PDbSNdJ97FP4EiCjTRaZMZQA
1EhqbyUMvvs7BfL8goY6qcPbD6YKfPqb7e
1E6NuFjCi27W5zoXg8TRdcSRq84zJeBW3k
1PitScNLyp2HCygzadCh7FveTnfmpPbfp8
1McVt1vMtCC7yn5b9wgX1833yCcLXzueeC
1M92tSqNmQLYw33fuBvjmeadirh1ysMBxK
1CQFwcjw1dwhtkVWBttNLDtqL7ivBonGPV
1LeBZP5QCwwgXRtmVUvTVrraqPUokyLHqe
1PgQVLmst3Z314JrQn5TNiys8Hc38TcXJu
1DBaumZxUkM4qMQRt2LVWyFJq5kDtSZQot
1Pie8JkxBT6MGPz9Nvi3fsPkr2D8q3GBc1
1ErZWg5cFCe4Vw5BzgfzB74VNLaXEiEkhk
1QCbW9HWnwQWiQqVo5exhAnmfqKRrCRsvW
1BDyrQ6WoF8VN3g9SAS1iKZcPzFfnDVieY

the private keys of those addresses are smaller than 65535 so you can test with command: $java -jar -Xmx6g GuessPrivateKey.jar 8 bit.txt up 1

scorta commented 3 years ago

but I don't know if the program searches in HEX or DEC. I will need to convert the privkey to something that the program will accept. I think that at the moment the privkey is in WIF format.

you need to pass in DEC

marssystems commented 3 years ago

OK - ran the test and got this -

D:\Guess>java -jar D:\Guess\GuessPrivateKey.jar 6 test.txt up 1 Searching keys for Bitcoin address(es) from file test.txt with 6 thread(s) SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Start importing list Bitcoin address(es) Imported 17 address(es) Run in "up" mode, checking from: 4 Run in "up" mode, checking from: 1 Run in "up" mode, checking from: 5 Exception in thread "Thread-0" java.lang.IllegalArgumentException at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108) at org.bitcoinj.core.ECKey.(ECKey.java:193) at org.bitcoinj.core.ECKey.fromPrivate(ECKey.java:259) at org.bitcoinj.core.ECKey.fromPrivate(ECKey.java:250) at GuessKeyThread.searchForKeyInRangeUpper(GuessPrivateKey.java:136) at GuessKeyThread.run(GuessPrivateKey.java:68) Run in "up" mode, checking from: 3 Found a key!!! Found a key!!! Run in "up" mode, checking from: 2 Run in "up" mode, checking from: 6 Found a key!!! Found a key!!! Found a key!!! Found a key!!! Found a key!!! Found a key!!! Found a key!!! Found a key!!! Found a key!!! Found a key!!!

marssystems commented 3 years ago

A fatal error has been detected by the Java Runtime Environment:

#

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x02989246, pid=2632, tid=0x000006c4

#

JRE version: Java(TM) SE Runtime Environment (8.0_281-b09) (build 1.8.0_281-b09)

Java VM: Java HotSpot(TM) Client VM (25.281-b09 mixed mode windows-x86 )

Problematic frame:

J 74 C1 org.spongycastle.math.ec.ECPoint.isInfinity()Z (40 bytes) @ 0x02989246 [0x02989210+0x36]

#

Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

#

An error report file with more information is saved as:

D:\Guess\hs_err_pid2632.log

#

If you would like to submit a bug report, please visit:

http://bugreport.java.com/bugreport/crash.jsp

#

D:\Guess>pause Press any key to continue . . .

marssystems commented 3 years ago

hs_err_pid2632.log

scorta commented 3 years ago

So the program is able to found keys; did it find all of them (should have some text files in the same folder)? About the error: I'm not sure, it seems that the problem is from bitcoinj; anyway, did the program keep running, or not?

marssystems commented 3 years ago

The program found 12 of the 16 keys. 13 if you count the one that failed on thread-0. The program did continue. If I run the program on just 1 core it fails straight away and stops.

D:\Guess>java -jar D:\Guess\GuessPrivateKey.jar 1 test.txt up 1 Searching keys for Bitcoin address(es) from file test.txt with 1 thread(s) SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Start importing list Bitcoin address(es) Imported 16 address(es) Run in "up" mode, checking from: 1 Exception in thread "Thread-0" java.lang.IllegalArgumentException at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108) at org.bitcoinj.core.ECKey.(ECKey.java:193) at org.bitcoinj.core.ECKey.fromPrivate(ECKey.java:259) at org.bitcoinj.core.ECKey.fromPrivate(ECKey.java:250) at GuessKeyThread.searchForKeyInRangeUpper(GuessPrivateKey.java:136) at GuessKeyThread.run(GuessPrivateKey.java:68)

D:\Guess>pause Press any key to continue . . .

marssystems commented 3 years ago

Does the program not fail for you?

scorta commented 3 years ago

The program works okay for me; and I can't solve your problem, because the error

at org.bitcoinj.core.ECKey.(ECKey.java:193)
at org.bitcoinj.core.ECKey.fromPrivate(ECKey.java:259)
at org.bitcoinj.core.ECKey.fromPrivate(ECKey.java:250)
at GuessKeyThread.searchForKeyInRangeUpper(GuessPrivateKey.java:136)
at GuessKeyThread.run(GuessPrivateKey.java:68)

is caused by bitcoinj library.

Anyway, if you have an GPU, you can try better programs, like https://github.com/brichard19/BitCrack, or https://github.com/JeanLucPons/Kangaroo -- my program is for CPU only

marssystems commented 3 years ago

Are you using a different version of bitcoinj? Did you compile the program yourself? I'm using the github version with no modifications that's why I don't understand why it doesn't work for me.

scorta commented 3 years ago

I just checked (with the current release), it seems that the program can't check from 1. So change the command to:

$ java -jar GuessPrivateKey.jar 1 bit up 2

(or any number that > 1) would run well.

marssystems commented 3 years ago

Yes - runs with no errors when I used up 2. This still doesn't explain my original error - unless the program randomly picked 1 (3 times).

scorta commented 3 years ago

Please try that again to see if it happens. I tried on my computer and it works as expected.

marssystems commented 3 years ago

As I said - running with "up 2 " works fine. I am running in random mode and so far, I've not seen the original error. The program hasn't found anything yet and it hasn't selected "1" randomly to produce the error.

scorta commented 3 years ago

Okay, so have fun playing with it. But you may know that it's almost impossible to find a key. Even with "small" number like 2^64 would take many years. But some people were lucky even with number bigger than 2^114, so who knows.

Anyway, if you're serious, take a look at https://github.com/brichard19/BitCrack, or https://github.com/JeanLucPons/Kangaroo

marssystems commented 3 years ago

Yes - I'm already using Kangaroo and Bitcrack. This program is just a little extra which can run on any computer without needing a GPU.

any chance of finding a privkey, no matter how small, is still a chance. Its like the lottery - "you have to be in it to win it".

Thanks for your help and good look with your search.