Skip to content

Commit

Permalink
Merge pull request #5 from WanderingPhilosopher/main
Browse files Browse the repository at this point in the history
missing dll error
  • Loading branch information
ilkerccom authored Feb 3, 2023
2 parents 39fd97f + 4120c51 commit 5bf1ec2
Show file tree
Hide file tree
Showing 4 changed files with 299 additions and 20 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Bitcoin-Puzzle-Scanner

I had a few people want me to update this program to include new challenges. (The original only had challenge #64.)
I have updated it up to challenge #108. I will add the others as time permits.

![bitcoin-puzzle-scanner](https://i.ibb.co/v4QmWtL/Ekran-Resmi-2022-01-18-20-15-58.png)

## Scan Types

You can use the following scan types.

- **next** : It scans sequentially from the first HEX value to the last HEX value.
- **prev** : It scans in reverse order from the last HEX value to the first HEX value.
- **random** : It scans by generating completely random HEX values. The generated HEX values are derived from the HEX ranges of the entered Puzzle.
- **SB** : It scans sequentially from the beginning HEX value to the last HEX value; first to last.
- **SE** : It scans in reverse order from the end HEX value to the beginning HEX value; last to first.
- **R** : It scans by generating completely random HEX values. The generated HEX values are derived from the HEX ranges of the entered Puzzle.


> On a Macbook Pro 2019, Core i9 2.3Ghz computer, approximately 20,000 addresses are scanned per second with 4 threads.
Expand Down Expand Up @@ -73,4 +76,4 @@ https://dotnet.microsoft.com/en-us/download/dotnet/3.1
ALL THE CODES, PROGRAM AND INFORMATION ARE FOR EDUCATIONAL PURPOSES ONLY. USE IT AT YOUR OWN RISK. THE DEVELOPER WILL NOT BE RESPONSIBLE FOR ANY LOSS, DAMAGE OR CLAIM ARISING FROM USING THIS PROGRAM.

**Libraries used**
https://github.com/MetacoSA/NBitcoin
https://github.com/MetacoSA/NBitcoin
20 changes: 11 additions & 9 deletions bitcoinpuzzlescanner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,27 @@ static void Main(string[] args)
// User select puzzle number
while (!PuzzleList.GetPuzzles().Any(e => e.Number == Puzzle))
{
Helpers.WriteInfo("Select puzzle number [" + String.Join('/', PuzzleList.GetPuzzles().Select(e => e.Number).ToArray()) + "] :");
Helpers.WriteInfo("Select challenge number [" + String.Join('/', PuzzleList.GetPuzzles().Select(e => e.Number).ToArray()) + "] :");
Puzzle = Console.ReadLine();
}

// User enter scan type
while (!Enum.GetValues(typeof(models.ScanType)).Cast<models.ScanType>().Any(e => e.ToString().ToLower() == ScanType.ToLower()))
{
Helpers.WriteInfo("Select scan type [" + String.Join('/', Enum.GetValues(typeof(models.ScanType)).Cast<models.ScanType>()) + "] :");
Helpers.WriteInfo("Select scan type ([SB=Sequential from Beginning], [SE=Sequential from End], [R=Random]) [" + String.Join('/', Enum.GetValues(typeof(models.ScanType)).Cast<models.ScanType>()) + "] :");
ScanType = Console.ReadLine().ToLower();
}

// User enter thread(s) count
while (Thread <= 0)
{
Helpers.WriteInfo("Enter thread(s) count [1-24] :");
Helpers.WriteInfo("Enter # of CPU thread(s) to use [1-24] :");
int.TryParse(Console.ReadLine().ToString(), out Thread);
}

// Define selected puzzle
ActivePuzzle = PuzzleList.GetPuzzles().Where(e => e.Number == Puzzle).First();

ActivePuzzle = PuzzleList.GetPuzzles().Where(e => e.Number == Puzzle).First();
// Set puzzle info
PuzzleInfo = new models.PuzzleInfo
{
Expand Down Expand Up @@ -123,18 +123,18 @@ static void Scan(int Thread)


// Scan type
if (Helpers.ParseEnum<models.ScanType>(ScanType) == models.ScanType.Random)
if (Helpers.ParseEnum<models.ScanType>(ScanType) == models.ScanType.R)
{
// Random generate
KeyList = Helpers.RandomHexList(ActivePuzzle.HexStart, ActivePuzzle.HexStop, ParallelScan);
}
else if (Helpers.ParseEnum<models.ScanType>(ScanType) == models.ScanType.Next)
else if (Helpers.ParseEnum<models.ScanType>(ScanType) == models.ScanType.SB)
{
// From first hex to last hex
BigInteger NextToScan = Attempts == 1 ? Helpers.HexToBigInteger(ActivePuzzle.HexStart) : Helpers.HexToBigInteger(ActivePuzzle.HexStart) + (Attempts * ParallelScan);
KeyList = Helpers.RandomHexList(NextToScan, ActivePuzzle.HexStop, ParallelScan);
}
else if (Helpers.ParseEnum<models.ScanType>(ScanType) == models.ScanType.Prev)
else if (Helpers.ParseEnum<models.ScanType>(ScanType) == models.ScanType.SE)
{
// From last hex to first hex
BigInteger PrevToScan = Attempts == 1 ? Helpers.HexToBigInteger(ActivePuzzle.HexStop) : Helpers.HexToBigInteger(ActivePuzzle.HexStop) - (Attempts * ParallelScan);
Expand All @@ -159,6 +159,7 @@ static void Scan(int Thread)
Console.Clear();
double CompletedPercentage = (double)((Attempts * ParallelScan) * 100) / (double)PuzzleInfo.MaxKeys;
double LuckyPercentage = (double)(1 * 100) / (double)PuzzleInfo.MaxKeys;
//double LuckyPercentage = (double)(Attempts) / (double)PuzzleInfo.MaxKeys;

// Time info
DateTime Current = DateTime.Now;
Expand All @@ -170,7 +171,8 @@ static void Scan(int Thread)

// Write info
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(String.Format("Running Bitcoin Puzzle #{0}# for {1} days, {2} hours, {3} minutes, {4} seconds ({5} k/seconds)", ActivePuzzle.Number, Days, Hours, Minutes, Seconds, PerSeconds));
Console.WriteLine(String.Format("Running Bitcoin Challenge #{0}# for {1} days, {2} hours, {3} minutes, {4} seconds ({5} Keys/second)", ActivePuzzle.Number, Days, Hours, Minutes, Seconds, PerSeconds));
//Console.WriteLine(String.Format("# of CPU threads running ({0})", Thread));
Console.WriteLine(String.Format("Target address ({0}) Last address ({1})", ActivePuzzle.Address, KeyList.Last().Address));
Console.WriteLine("====================================================================================");
Console.WriteLine(String.Format("Lucky ratio => %{0}", LuckyPercentage.ToString("0.0000000000000000000000000000000000000000000000000000000000000000000")));
Expand Down
Loading

0 comments on commit 5bf1ec2

Please sign in to comment.