Bitcoin Forum
June 27, 2024, 09:33:44 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Importing vanitygen txt file into mysql database  (Read 929 times)
mistersisco (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 09, 2013, 08:17:00 AM
 #1

I am trying to import some vanitygen created Bitcoin addresses into a sql database.
The vanitygen .txt data looks like this :

Pattern : 1
Address : 1btcwefhhiZUzjcilcdjcdijcdicd     
Privaddress : 5kihfrierhf8hfreriierhow8945h4589
Pattern : 1
Address : 1ltcwbvwerbvuhiBGUOGZo12gg23413g     
Privaddress : 5ZVGOUVZouvzuvocdzgwe8of7g487gbf73o
Pattern : 1
Address : 1ppczif868tgfouiblfuhipfh45pfh45f     
Privaddress : 5BBHJogzup98zhpf489f5h4pf45fp894f89     


This is just a example of pub. and priv. key I am trying to import this into a sqldatabase which name is bitcoin and the table is called one with the files pattern, address and privaddress.

mysql> LOAD DATA LOCAL INFILE '/path/one.txt' INTO TABLE one

COLUMNS TERMINATED BY     Huh?



   





Snub
Hero Member
*****
Offline Offline

Activity: 812
Merit: 500



View Profile
August 09, 2013, 09:14:39 AM
 #2

What operating system are you using?

Are you physically at the system or are you connecting through a ssh?
J35st3r
Full Member
***
Offline Offline

Activity: 196
Merit: 100



View Profile
August 09, 2013, 11:25:20 AM
 #3

You need to reformat your input so that each table row is on one line.

As snub said, it really depends on your OS and what tools you have available, but this is a perl script to do it

Code:
while (<>) {
chomp;
if (/^Pattern: (.*)/) { $pattern = $1; }
if (/^Address: (.*)/) { $address = $1; }
if (/^Privkey: (.*)/) {
$privkey = $1;
print "$pattern\t$address\t$privkey\n";
}
}

It runs as a filter
$ perl join.pl <input.txt >output.txt

If your vanitygen is labelling the Privkey as Privaddress, you'll need to change the code slightly ... if (/^Privaddress: (.*)/) {

1Jest66T6Jw1gSVpvYpYLXR6qgnch6QYU1 NumberOfTheBeast ... go on, give it a try Grin
mistersisco (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 09, 2013, 01:43:38 PM
 #4

Thanks for the posts, sorry made an mistake I am running mysql not sql like in my first post. I am using Ubuntu the newest release an 64bit processor and I am using the command line for the mysql. I am running the server on my own system (LOCAL).


J35st3r
Full Member
***
Offline Offline

Activity: 196
Merit: 100



View Profile
August 09, 2013, 01:57:01 PM
 #5

Thanks for the posts, I am using Ubuntu the newest release an 64bit processor and I am using the command line for the mysql. I am running the server on my own system (LOCAL).
Then you should be fine with the perl script, you may want to add the top line
#!/usr/bin/perl
and "chmod +x join.pl" (assuming you save it as that), to make it executable stand-alone.

I assume the
Quote
Pattern : 1
Address : 1btcwefhhiZUzjcilcdjcdijcdicd     
Privaddress : 5kihfrierhf8hfreriierhow8945h4589
is a typo as my vanitygen gives
Quote
$ vanitygen 1x
Difficulty: 1353
Pattern: 1x
Address: 1x37ithpwe4pnP4pJUm13LXKEJa2bhsCE
Privkey: 5J3cvzKQN8S5GWnFUF6xbiLvkD56cV6mXjA9WPtYiLWu1SZBVzd
Note the lack of a space before the ":", and Privkey rather than Privaddress. The script will work for my output but not yours (its easy to tweak though).

Then again, looking at those outputs, your Privaddress is 33 chars, while my Privkey is the standard 51, so perhaps I'm misunderstanding what you are doing there. No matter, just tweak the perl script to match your input.

1Jest66T6Jw1gSVpvYpYLXR6qgnch6QYU1 NumberOfTheBeast ... go on, give it a try Grin
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!