-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
530 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<configSections> | ||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> | ||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
</configSections> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
<appSettings> | ||
<add key="CleanupInterval" value="120000" /> | ||
<add key="MaxDegreeOfParallelism" value="8" /> | ||
</appSettings> | ||
<entityFramework> | ||
<providers> | ||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> | ||
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /> | ||
</providers> | ||
</entityFramework> | ||
|
||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
using Nethereum.Hex.HexTypes; | ||
using Nethereum.Web3; | ||
using Nethereum.Web3.Accounts; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
class Program | ||
{ | ||
// Data structure to store Ethereum addresses and balances | ||
static Dictionary<string, double> ethAddressBalanceMap; | ||
|
||
// Counter to track total statistics | ||
static int totalKeyCount = 0; | ||
|
||
// Counter to track local statistics | ||
static int localKeyCount = 0; | ||
|
||
// StreamWriter için bir kilit nesnesi | ||
private static readonly object writerLock = new object(); | ||
|
||
// Interval to clean up memory | ||
static int cleanupInterval = Convert.ToInt32(ConfigurationManager.AppSettings["CleanupInterval"]); | ||
|
||
// Max degree of parallelism | ||
static int maxDegreeOfParallelism = Convert.ToInt32(ConfigurationManager.AppSettings["MaxDegreeOfParallelism"]); | ||
|
||
static void Main() | ||
{ | ||
// Load eth_list.tsv file | ||
LoadEthList(Environment.CurrentDirectory + "\\eth_list.tsv"); | ||
|
||
// Check if the data structure is loaded successfully | ||
if (ethAddressBalanceMap != null && ethAddressBalanceMap.Any()) | ||
{ | ||
Console.WriteLine("Data loaded successfully."); | ||
Console.WriteLine($"Number of addresses in the loaded data: {ethAddressBalanceMap.Count}"); | ||
} | ||
else | ||
{ | ||
Console.WriteLine("Error loading data or no addresses found."); | ||
Console.ReadKey(); | ||
} | ||
|
||
|
||
|
||
// Ethereum connection | ||
//var web3 = new Web3(); | ||
|
||
// Start time | ||
DateTime startTime = DateTime.Now; | ||
|
||
// Parallel options with max degree of parallelism | ||
ParallelOptions parallelOptions = new ParallelOptions | ||
{ | ||
MaxDegreeOfParallelism = maxDegreeOfParallelism | ||
}; | ||
|
||
// StreamWriter for writing to a file | ||
using (StreamWriter writer = new StreamWriter("export.txt")) | ||
{ | ||
// Generate random private key and address in parallel with a limited number of threads | ||
Parallel.ForEach(Enumerable.Range(0, int.MaxValue), parallelOptions, _ => | ||
{ | ||
// Generate random private key and address in an infinite loop | ||
while (true) | ||
{ | ||
// Generate a random private key | ||
var privateKey = GenerateRandomPrivateKey(); | ||
|
||
// Create an Ethereum account (address) from the private key | ||
var account = new Account(privateKey); | ||
|
||
|
||
|
||
// Get the balance of the address | ||
//var balance = GetBalance(web3, account.Address); | ||
|
||
// Increment local counter | ||
localKeyCount++; | ||
|
||
// Increment total counter atomically | ||
System.Threading.Interlocked.Increment(ref totalKeyCount); | ||
|
||
// Check the newly generated address | ||
bool status = CheckEthAddress(account.Address); | ||
|
||
// Check if the balance is not zero | ||
if (status == true) | ||
{ | ||
// Write the results to the file | ||
lock (writerLock) | ||
{ | ||
// Write the results to the file | ||
writer.WriteLine($"Private Key: {privateKey}"); | ||
writer.WriteLine($"Address: {account.Address}"); | ||
//writer.WriteLine($"Balance: {balance} wei"); | ||
writer.WriteLine(); | ||
} | ||
|
||
// Print the results to the console if desired | ||
Console.WriteLine($"Private Key: {privateKey}"); | ||
Console.WriteLine($"Address: {account.Address}"); | ||
//Console.WriteLine($"Balance: {balance} wei"); | ||
Console.WriteLine(); | ||
|
||
// Wait for a key press before generating the next key | ||
Console.WriteLine("Press any key to generate the next key..."); | ||
Console.ReadKey(true); | ||
} | ||
|
||
// Print statistics when a certain number of keys have been generated | ||
if (localKeyCount % 10000 == 0) | ||
{ | ||
// End time | ||
DateTime endTime = DateTime.Now; | ||
|
||
// Calculate elapsed time in seconds | ||
double elapsedSeconds = (endTime - startTime).TotalSeconds; | ||
|
||
// Calculate total keys per second | ||
double totalKeysPerSecond = totalKeyCount / elapsedSeconds; | ||
|
||
// Print total statistics to the console | ||
Console.WriteLine($"Total Key Count: {totalKeyCount}"); | ||
Console.WriteLine($"Total Keys Per Second: {totalKeysPerSecond:F2} keys/second"); | ||
Console.WriteLine(); | ||
// Check if elapsed time is greater than or equal to 60 seconds | ||
//if (elapsedSeconds >= 60) | ||
//{ | ||
// End the program | ||
//return; | ||
//} | ||
} | ||
|
||
// Check if it's time to clean up memory | ||
if (localKeyCount % cleanupInterval == 0) | ||
{ | ||
// Clean up memory | ||
GC.Collect(); | ||
GC.WaitForPendingFinalizers(); | ||
Console.WriteLine("Memory cleaned up."); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
|
||
// Function to load Ethereum addresses and balances from the file into a dictionary | ||
static void LoadEthList(string filePath) | ||
{ | ||
ethAddressBalanceMap = new Dictionary<string, double>(); | ||
|
||
try | ||
{ | ||
// Dosyanın var olup olmadığını kontrol et | ||
if (!File.Exists(filePath)) | ||
{ | ||
Console.WriteLine($"File not found: {filePath}"); | ||
return; | ||
} | ||
|
||
// Read the file line by line | ||
foreach (var line in File.ReadLines(filePath).Skip(1)) // Skip the header line | ||
{ | ||
// Split the line into parts | ||
string[] parts = line.Split('\t'); | ||
|
||
// Extract the address and balance | ||
string address = parts[0]; | ||
double balance = double.Parse(parts[1]); | ||
|
||
// Add to the dictionary | ||
ethAddressBalanceMap.Add(address, balance); | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine($"File loading error: {ex.Message}"); | ||
} | ||
} | ||
|
||
|
||
// Function to generate a random Ethereum address (replace with your own implementation) | ||
static string GenerateRandomEthAddress() | ||
{ | ||
return "0x" + Guid.NewGuid().ToString("N").Substring(0, 40); | ||
} | ||
|
||
// Function to check if an Ethereum address is in the loaded dictionary | ||
static bool CheckEthAddress(string address) | ||
{ | ||
if (ethAddressBalanceMap.ContainsKey(address)) | ||
{ | ||
double balance = ethAddressBalanceMap[address]; | ||
//Console.WriteLine($"Address found: {address}, Balance: {balance}"); | ||
return true; | ||
} | ||
else | ||
{ | ||
//Console.WriteLine($"Address not found: {address}"); | ||
return false; | ||
} | ||
} | ||
|
||
// Function to generate a random private key | ||
static string GenerateRandomPrivateKey() | ||
{ | ||
var randomBytes = new byte[32]; | ||
using (var rng = new System.Security.Cryptography.RNGCryptoServiceProvider()) | ||
{ | ||
rng.GetBytes(randomBytes); | ||
} | ||
return "0x" + BitConverter.ToString(randomBytes).Replace("-", ""); | ||
} | ||
|
||
// Function to get the balance of an Ethereum address | ||
static ulong GetBalance(Web3 web3, string address) | ||
{ | ||
// Call the web3.Eth.GetBalance.SendRequestAsync method to get the balance | ||
var balanceTask = web3.Eth.GetBalance.SendRequestAsync(address); | ||
|
||
// Wait for the task to complete and return the result | ||
return balanceTask.Result.ToUlong(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
[assembly: AssemblyTitle("WalletHunter")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("WalletHunter")] | ||
[assembly: AssemblyCopyright("Copyright © 2025")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
|
||
[assembly: ComVisible(false)] | ||
|
||
[assembly: Guid("31F693EA-6119-4A7F-8BFF-F0C72FF921AC")] | ||
|
||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Oops, something went wrong.