Author

Topic: Bitcoin Address Generation Emulator? NEED FEEDBACK! (Read 364 times)

sr. member
Activity: 336
Merit: 250
This tells you how to make a valid address: https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses

If you don't care about the private key, start at step 4 with a 160-bit (20 bytes) value.


I'm going to check this one, thank you!

I'm no expert, but i'm sure it needs more resources to generate a bitcoin than your random 35 characters because there's more steps when you generate a bitcoin address.
Also, bitcoin core is open source, so you can look at the source code anytime you want Smiley

Exact, there's too many steps but I just wanted to implement the "random strings" step.

I know that It's Open source and I've made a small look at the files, I was completely lost Sad If someone could've told me the name of the file that contains the address generation that would have made things more easier.
legendary
Activity: 4466
Merit: 3391
This tells you how to make a valid address: https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses

If you don't care about the private key, start at step 4 with a 160-bit (20 bytes) value.
sr. member
Activity: 336
Merit: 250
Vanitygen is a command-line tool that can be used to generate random bitcoin addresses. It also has OpenCL-compatible GPU version called oclvanitygen. Both can be built from source, GitHub.

Oh I know that one but I never thought about looking at the sources, going to check this, thankx mate!
full member
Activity: 159
Merit: 100
Vanitygen is a command-line tool that can be used to generate random bitcoin addresses. It also has OpenCL-compatible GPU version called oclvanitygen. Both can be built from source, GitHub.
sr. member
Activity: 336
Merit: 250
Hi pals,

As I've told in a recent post, I'm starting out as a self-taught C++ programmer.

Yesterday (actually today at a VERY early hour, like 4 AM) I was playing around with my Atom and I made something very simple.

Basically, It's not really like Bitcoin Addresses (as they seem to have a length of 34 characters), mine generates random potential addresses with 35 characters.

Check out the screen.



It's been generating random potential addresses for like 10 hours now and It stills do It, I made It so that It makes like 1000000000 addresses before finishing. I also made a condition that IF EVER two addresses are the same, the program should stop and It didn't (so every address made Is unique so far Tongue).

I'm posting the code too! I want some feedback please.

Code:
#include
#include
#include
#include
#include

using namespace std;

class Hash
{
  public:

    Hash()
 {
     m_letters = "abcdefghijklmnopqrstvwxyzABCDEFGHIJKLMNOPQRSTVWXYZ0123456789:;";
     m_hash = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
     m_same = false;
     m_hashes = 1000000000;
 }

 void generate()
 {
   default_random_engine engine(time(0));
   uniform_int_distribution random(0, 61);

   for(int i = 0; i < 35; i++)
   {
     m_random = random(engine);
     m_hash[i] = m_letters[m_random];
   }

   cout << m_hash << endl;
 }

 void abortThis()
 {
   cout << "FOUND TWO HASHES WITH 100\% SAME DATA" << endl;
   while(1)
   {

   }
 }

 void massGenerate()
 {
   default_random_engine engine(time(0));
   uniform_int_distribution random(0, 61);
   for(int i = 0; i < m_hashes; i++)
   {
    for(int i = 0; i < 35; i++)
      {
        m_random = random(engine);
        m_hash[i] = m_letters[m_random];
      }

      for(auto c : m_massVerify)
      {
        if(m_hash == c)
          abortThis();
      }

      m_list.push_back(m_hash);
      m_massVerify.push_back(m_hash);
      cout << m_hash << endl;


    }

    cout << "GENERATED " << m_hashes << " DIFFERENT HASHES SUCCESFULLY." << endl;
 }

 void show_all()
 {
   for(auto m_data : m_list)
    cout << m_data << endl;
 }





  private:
    int m_random;
    unsigned int m_hashes;
    string m_letters;
    string m_hash;
    string m_current;
    bool m_same;
    vector m_massVerify;
    vector m_list;

};



int main()
{
  Hash test;
  test.massGenerate();
}
Specially SEE the default constructor of Hash class, and the function massGenerate.
YOU CAN ALSO FIND THE CODE HERE BUT IT WON'T COMPILE ON ONLINE IDE. http://cpp.sh/7g7o

PLEASE,
Don't comment about that using namespace std; I know It's bad.
Don't comment about me using one file instead of a .cpp & .hpp, I know It's bad too.
Don't comment about variables name, I know It's good Cheesy

What I would REALLY BE INTERESTED IN, Is to find the piece of code that generates BITCOIN ADDRESSES in BITCOIN CORE!
I'm COMPLETELY aware that the generated addresses doesn't start with 1 or 3. It has been done ON PURPOSE! Cheesy
Jump to: