Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Commit

Permalink
Version 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Gustafsson committed Mar 11, 2018
1 parent 9ad9c8e commit 89ed68c
Show file tree
Hide file tree
Showing 13 changed files with 9,203 additions and 9,397 deletions.
642 changes: 317 additions & 325 deletions Dispatcher.cpp

Large diffs are not rendered by default.

63 changes: 30 additions & 33 deletions Dispatcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
#include <fstream>
#include <CL/cl.h>
#include <string>
#include <chrono>
#include <mutex>
#include <list>
#include "types.hpp"

#include "SpeedSample.hpp"
#include "CLMemory.hpp"
#include "types.hpp"
#include "Mode.hpp"

#define PROFANITY_SPEEDSAMPLES 20

class Dispatcher {
private:
class OpenCLException : public std::runtime_error {
Expand All @@ -21,93 +24,87 @@ class Dispatcher {
static void throwIfError(const std::string s, const cl_int res);
};

struct SpeedSample {
unsigned long long scanned;
std::chrono::time_point<std::chrono::steady_clock> time;
};

struct Device {
static cl_command_queue createQueue(cl_context & clContext, cl_device_id & clDeviceId);
static cl_kernel createKernel(cl_program & clProgram, const std::string s);

Device(Dispatcher & parent, cl_context & clContext, cl_program & clProgram, cl_device_id clDeviceId, const size_t worksizeLocal);
~Device();

Dispatcher & m_parent;

cl_device_id m_clDeviceId;
const size_t m_worksizeLocal;
cl_uchar m_clScoreMax;
cl_command_queue m_clQueue;

cl_kernel m_kernelBegin;
cl_kernel m_kernelInversePre;
cl_kernel m_kernelInverse;
cl_kernel m_kernelInversePost;
cl_kernel m_kernelEnd;

CLMemory<point> m_memPrecomp;
CLMemory<point> m_memPoints1;
CLMemory<point> m_memPoints2;
CLMemory<bignum> m_memInverse;
CLMemory<cl_uchar> m_memPass;

CLMemory<result> m_memResult;

// Data parameters used in some modes
CLMemory<cl_uchar> m_memData1;
CLMemory<cl_uchar> m_memData2;

// Current seed for this device
cl_ulong4 m_clSeed;
std::list<SpeedSample> m_lSpeed;
unsigned long long m_scanned;

// Speed sampling
SpeedSample m_speed;
};

public:
Dispatcher(cl_context & clContext, cl_program & clProgram, const Mode mode, const size_t worksizeMax, const cl_uchar clScoreQuit = 0);
~Dispatcher();

void addDevice(cl_device_id clDeviceId, const size_t worksizeLocal);
void run();

private:
void init(Device & d);
void dispatch(Device & d);
void enqueueKernel(cl_command_queue & clQueue, cl_kernel & clKernel, size_t worksizeGlobal, const size_t worksizeLocal);
void handleResult(Device & d);
void randomizeSeed(Device & d);

void sampleAdd( std::list<SpeedSample> & lSpeed, const unsigned long long & scanned );
unsigned int sampleSpeed( std::list<SpeedSample> & lSpeed );


void onEvent(cl_event event, cl_int status, Device & d);


void printSpeed();

private:
static void CL_CALLBACK staticCallback(cl_event event, cl_int event_command_exec_status, void * user_data);
static std::string formatSpeed(float s);
static void CL_CALLBACK staticCallback(cl_event event, cl_int event_command_exec_status, void * user_data);

static std::string formatSpeed(double s);

private: /* Instance variables */
cl_context & m_clContext;
cl_program & m_clProgram;
const Mode m_mode;
const size_t m_worksizeMax;
cl_uchar m_clScoreMax;
cl_uchar m_clScoreQuit;

std::list<Device *> m_lDevices;

cl_event m_eventFinished;

// Run information
std::mutex m_mutex;
std::chrono::time_point<std::chrono::steady_clock> timeStart;
std::list<SpeedSample> m_lSpeed;
unsigned long long m_scanned;
unsigned int m_countPrint;
unsigned int m_countRunning;
bool m_quit;

};

#endif /* HPP_DISPATCHER */
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CC=g++
CFLAGS=-c -std=c++11 -Wall -mmmx -O2
CDEFINES=
LDFLAGS=-s -lOpenCL
SOURCES=Dispatcher.cpp Mode.cpp precomp.cpp profanity.cpp
SOURCES=Dispatcher.cpp Mode.cpp precomp.cpp profanity.cpp SpeedSample.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=profanity.x64

Expand Down
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,63 @@
# profanity
Profanity is a high performance (probably the fastest!) vanity address generator for Ethereum. Create cool customized addresses that you never realized you needed! Recieve Ether in style! Wow!

![Screenshot](/img/screenshot.png?raw=true "Wow! That's a lot of zeros!")

### Releases
Latest release compiled for 64-bit Windows & Linux can be found [here](https://github.com/johguse/profanity/releases).

### Disclaimer
Always verify that a private key generated by this program corresponds to the public key printed by importing it to a wallet of your choice. This program like any software might contain bugs and it does by design cut corners to improve overall performance.

### Usage
```
usage: ./profanity [OPTIONS]
Basic modes:
--benchmark Run without any scoring, a benchmark.
--zeros Score on zeros anywhere in hash.
--letters Score on letters anywhere in hash.
--numbers Score on numbers anywhere in hash.
Modes with arguments:
--leading <single hex> Score on hashes leading with given hex character.
--matching <hex string> Score on hashes matching given hex string.
Advanced modes:
--leading-range Scores on hashes leading with characters within
given range.
--range Scores on hashes having characters within given
range anywhere.
Range:
-m, --min <0-15> Set range minimum (inclusive), 0 is '0' 15 is 'f'.
-M, --max <0-15> Set range maximum (inclusive), 0 is '0' 15 is 'f'.
Misc:
-s, --skip <index> Skip device given by index.
-w, --work <size> Set OpenCL local work size. [default = 64]
-W, --workmax <size> Set OpenCL maximum work size. [default = 1048576]
Examples:
./profanity --leading f
./profanity --matching dead
./profanity --matching badXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXbad
./profanity --leading-range -m 0 -M 1
./profanity --leading-range -m 10 -M 12
./profanity --range -m 0 -M 1
About:
profanity is a vanity address generator for Ethereum that utilizes
computing power from GPUs using OpenCL.
Author: Johan Gustafsson <[email protected]>
Beer donations: 0x000dead000ae1c8e8ac27103e4ff65f42a4e9203
```
### Benchmarks
|Model|Clock Speed|Memory Speed|Modified straps|Speed|Time to match eight characters|
|:-:|:-:|:-:|:-:|:-:|:-:|
|R9 290|1150|1400|NO|100 MH/s| ~43 s
|R9 290|1040|1300|NO|91 MH/s| ~47 s
|RX 480|1266|2000|YES|83 MH/s| ~52 s
|RX 580|1366|1750|YES|79 MH/s | ~54 s
|RX 470|1206|1650|YES|72 MH/s| ~60 s
35 changes: 35 additions & 0 deletions SpeedSample.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "SpeedSample.hpp"

SpeedSample::SpeedSample(const size_t length) :
m_length(length),
m_lastTime(now())
{

}

SpeedSample::~SpeedSample() {

}

double SpeedSample::getSpeed() const {
double speed = 0;
for( auto & v : m_lSpeeds) {
speed += v / m_lSpeeds.size();
}

return speed;
}

void SpeedSample::sample(const double V) {
const timepoint newTime = now();
auto delta = std::chrono::duration_cast<std::chrono::milliseconds>(newTime - m_lastTime).count();
m_lSpeeds.push_back((1000 * V) / delta);
m_lastTime = newTime;
if (m_lSpeeds.size() > m_length) {
m_lSpeeds.pop_front();
}
}

SpeedSample::timepoint SpeedSample::now() {
return std::chrono::steady_clock::now();
}
26 changes: 26 additions & 0 deletions SpeedSample.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef HPP_SPEEDSAMPLE
#define HPP_SPEEDSAMPLE
#include <chrono>
#include <list>

class SpeedSample {
private:
typedef std::chrono::time_point<std::chrono::steady_clock> timepoint;

public:
SpeedSample(const size_t length);
~SpeedSample();

double getSpeed() const;
void sample(const double V);

private:
static timepoint now();

private:
const size_t m_length;
timepoint m_lastTime;
std::list<double> m_lSpeeds;
};

#endif /* HPP_SPEEDSAMPLE */
Loading

0 comments on commit 89ed68c

Please sign in to comment.