dserrano5
Legendary
Offline
Activity: 1974
Merit: 1029
|
|
July 01, 2011, 07:38:12 PM |
|
I don't understand anything of what you just said. Anyway... If you want a vanity address starting with any letter from "STUVWXYZabcdefghijkmnopqrstuvwxyz", you're going to have to spend a lot more cycles to find it.
That must be why "1ibm" was available .
|
|
|
|
davux
|
|
July 04, 2011, 02:15:16 AM |
|
Hmm, if I quote the regex in the shell, the generated address is shorter: $ ./bitcoind getnewaddress '' '^11'
[...]
$ ./bitcoind getnewaddress '' ^11
In the shell, '^11' and ^11 are exactly the same thing, because the '^' character doesn't have any magical meaning here, so it doesn't need to be quoted. Does that make sense? I understand addresses have a fixed length.
No, they don't. There's no relation between the length of the addresses and the way you wrote the vanity regex.
|
1DavuxH9tLqU4c7zvG387aTG4mA7BcRpp2 México (Oaxaca) – France - Leeds
|
|
|
dserrano5
Legendary
Offline
Activity: 1974
Merit: 1029
|
|
July 04, 2011, 06:58:17 AM |
|
Hmm, if I quote the regex in the shell, the generated address is shorter: $ ./bitcoind getnewaddress '' '^11'
[...]
$ ./bitcoind getnewaddress '' ^11
In the shell, '^11' and ^11 are exactly the same thing, because the '^' character doesn't have any magical meaning here, so it doesn't need to be quoted. Which is exactly the reason why generated addresses should be the same length. ...Or at least that's what I thought before I remembered (before reading your response) that addresses don't have a fixed length. The fact that giving a quoted parameter resulted in a shorter address must have been just a coincidence. Thanks in any case .
|
|
|
|
pB11
Newbie
Offline
Activity: 12
Merit: 2
|
|
July 04, 2011, 05:27:56 PM Last edit: July 04, 2011, 05:41:56 PM by pB11 |
|
It seems someone already played with cool-looking addresses/hashes back in 2010: http://blockexplorer.com/address/11126yHiXjavR3oNVwV2GRNso2ah4MnZtm (there was >1k BTC at this address!) HASH160 BTC_IN 0000000000000000000000000000000000000000 00000000.07110007 0000000000000000000000000000000000000001 00000000.01000000 000001aa6aa32fb6138c08d5e91f9a502656abdb 00000000.00000001 0000094d87949ffa143d5f3c049a5f071a16a941 00000000.00000001 00000d645142c1b4c07e6a14a854acf4412d8713 00000000.00000001 00000f3b345053879dc45e2ffa23deb781af36e3 00000000.00000001 000013bd967f59213494a10a3fdf49e0b79371cd 00000000.00000001 000018fc5a9d6eae103f0e572ff02c6e8412d42c 00000000.00000001 00001a969f9529cedba0cb353553667874e5c263 00000000.00000001 000020b4868dbb9f9ea4ae2cb23a05b6c7a50737 00000000.00000001 00002ccc7e36c6e7077dc186d33e5f60c76edf58 00000000.00000001 00002e5019ebe4c717080cae027fdb7b1c5045c4 00000000.01000000 000032a07a118a18f4ca16ad4255fbf91a12f0a3 00000000.00000001 00003629f51465a2d757e25dcf189cc260fc392d 00000000.00000001 00003710b5473b680675ba9c0d52ef954103481c 00000000.00000001 00003ddb3d79d74da3ccd4593419f4f2a55a68f8 00000000.79000000 00004020b6275ee5743080928fefe7fe90ef838c 00000000.00000001 0000435e719970dc7aa64245dc7e984f191c1c56 00000000.02000000 000046035080a1bdce64d087aca6d9017a0557a4 00000000.04000000 000048f2b372c547a768bf61f436f2394cc21787 00000000.00000001 00004ed54c20dd73ccba1e102992084b39b556f8 00000000.00000001 000051da44a22641488b8718034be843b795aa82 00000000.00000001 00005831c8aba83829c9aea53b885e752aed62f0 00000000.00000001 00005859982da7cc90ffccb6a11138293d6a7ed7 00000000.00000001 00005af355dd005383792ab27b03b2cd3663a49d 00000000.00000001 00005e2615c19b97a819558e8e8380d5eea3e098 00000000.01000000 00005fea533cbb8cd290f43e0aeea80891837ba2 00000000.00000001 000060df7b6b95c47f0b311f581ad8a471c027b8 00000000.00000001 000062c4f36e984e1c38d64ed3e83fac0b8875d2 00000000.00000001 00006a5f1c919936181de6397671dfdee5eb3f8e 00000001.00000000 00006b7527baa323ae799ae76fbc7755f5c8cb68 00000000.00000001 0000782ec52331217996d5ed7e8fac6d3db7e2c7 00000005.68000000 00007eea3c271357c4254b2f6dd58d6184828f0f 00000000.00000001 0000830a9b1f296aa3f1c468f63be4933422f249 00000008.55000000 00009b759340b8d90771ebf2da76312900d9663d 00000000.00000001 0000a281962dc5123c9d83c977b6e4fbeb5effdb 00000000.00000001 0000a2948d8d534848124a606e43724e37f4b815 00000000.00000001 0000a635cad79b5825dab5176a0bdc59124068b7 00000000.00000001 0000aba36b6f4e822a12885a26d9392101070d4c 00000000.00000001 0000adbae47afaa49642252bb3ad5764aaa91f75 00000000.00000001 0000b7d68d18879c2a2c1e07001398cecb755180 00000000.00000001 0000c32bc79b9e8c8a2afb72462636be440dcc5d 00000000.00000001 0000cce1bcb7f8d8e34548e277cb43620ac50c6e 00000000.00000001 0000cd341be1f51cef57ac0207d098212a4b000a 00000000.00000001 0000cfcee541e4815bb92f4e6b8f5d6d210d2ace 00000000.00000001 0000d10e7744f0885a4fbd20c8ec1a0b82ece4a3 00000000.00000001 0000e30fb7a987abc3c28ca6398c18dc17edd608 00000100.29000000 0000ebb22c6afe1fd46bf1ca17cae2a9496df9ac 00001137.00000000 0000f02e3d9d88a95a015219a8b69a5b9d6cfbcb 00000078.21000000 000105c698a07fabe70f165eb6dae2ee681c03b3 00000517.88000000 000146b7dbf1ca1d1df70500d7c8ca13f19fa15f 00000000.05000000 00014bdcadd62ce646cdbbd68776102e802b1556 00000031.81000000 0001aaf0074a13876565da1abb94fb0ee1607467 00000000.05148120 0001c2d11f347e1d47d05fea3ad5d86efceda60a 00000009.49152769 ... ffff0c753b76620e152890565a7285171ad528ce 00000000.01000000 ffff235734d335de7da59b46d4e2229f03569dc9 00000041.26800000 ffff5ea334aadbe15678ef8ef9046296ee2ccdfa 00000004.80000000 ffff78aece539fb0dca39fbc2200bfb3583d477d 00000921.98226031 ffff97c97e1ccab5bc88350310e8ec76b30f7380 00000013.81000000 ffff9d832765e995c0e3a0e147934043f15add6b 00000003.80000000 ffffd66277094fb1186572d2c5a03056d1a7569f 00000000.50000000 fffff69ea5a3bdc76955591088ddfe5ec555d6cc 00001475.47000000 fffff9fabcf4e7a9bd5f9a44078fdba199c69b38 00000000.00000013 ffffffffffffffffffffffffffffffffffffffff 00000000.01000000
Small perl (64-bit) script to dump entire transaction database : open F,'<blk0001.dat'; binmode F; local $/; $_=<F>; while(/(.{8})\x19\x76\xA9\x14(.{20})\x88\xAC/sg){ $c=unpack('Q',$1); $h=$2; $balance{$h}+=$c; } for(sort keys %balance){ $c=$balance{$_}; $s=sprintf('%016d',$c); substr($s,8,0)='.'; print unpack('H*',$_)." $s\n"; } 1 million addresses soon! (it counts only inputs, not generation or outputs)
|
|
|
|
Yeti
Member
Offline
Activity: 112
Merit: 10
Firstbits: 1yetiax
|
|
July 05, 2011, 10:44:05 AM |
|
Aw, man! Looks like somebody generated a lot of words to be used at firstbits.com. I wanted a nice firstbits vanity address that would be essentially my nick, but 1yeti is gone. I wasn't fast enough, now I'm 1yetiax. In case you want one of these, you are probably gonna have to pay him a premium. They're not interested in case-sensitivity (unlike me) which gives them the edge. This is why we can't have nice things!
|
|
|
|
Ryland R. Taylor-Almanza
Legendary
Offline
Activity: 882
Merit: 1001
|
|
July 05, 2011, 01:38:09 PM |
|
Anyway to generate a vanity address in windows with the current bitcoin client? My friend wants one.
someone posted a working patch for the latest bitcoin source, it compiled fine for me in linux. I verified it worked by having it "search" for a 1-byte vanity address 'a' and it gave me one. I let it run for a few minutes trying to find one with 'BitVapes' but I'm sure it would take over 9,000 years. I did notice it only tied to one cpu core so I kicked off multiple instances to max out my cpus before shutting it down for fear of melting my box on this basically futile but fun effort. Is that the one in the first post of this thread?
|
|
|
|
.BITSLER. | ▄███ ▄████▀ ▄████▀ ▄████▀ ▄██▄ ▄████▀ ▀████▄ ▄████▀ ▀████▄ ▄████▀ ▀████▄ ▄████▀ ▀████▄ ▄████▀ ▄████▄ ▄████▄ ▀████▄ █████ ██████ ██████ █████ ▀████▄ ▀████▀ ▀████▀ ▄████▀ ▀████▄ ▄████▀ ▀████▄ ▄████▀ ▀████▄ ▄████▀ ▀████▄ ▄████▀ ▀████▄▄████▀ ▀██████▀ ▀▀▀▀ | | ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄ ▄▄▄▄▀▀▀▀ ▄▄█▄▄ ▀▀▄ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄ █ ▀▄▄ ▀█▀▀ ▄ ▀████ ▀▀▄ █ █▄ ▀▄ ▀████ ▀▀ ▄██▄ ▀▀▄ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ █ ▀▀ ▀▄▄ ▀████ ▄▄▄▀▀▀ █ █ ▄ ▀▄ ▄▄▄▀▀▀ ▄▄ █ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ █ ▄▄ ███ ▀██ █ ▀▀ █ █ ███ ▀██ █ ▄▄ █ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▄ █ ▀▀ █ ▀▀▄ ███▄ █ ▄▄ █ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▄ █ ▀▀▄▄▄▀▀▀ ▄▄▄▄▄▄▄▄▄▄▄█▄▄▀▀▀▀ | | | | ▄▄▄██████▄▄▄ ▄▄████████████████▄▄ ▄██████▀▀▀▀▀▀▀▀▀▀██████▄ ▄ ▄█████▀ ▀█████▄ ██▄▄ █████▀ ▄ ▀█████ ████████ ▄██ █████ ████████▄ ███▀ ████▄ █████████▀▀ ▄███▀ █████ █▀▀▀ █████ █████ ▄▄▄ ████ █████ █████ ▀▀ ████▀ █████ █████ █████▄ ▄█████ ▀█████▄ ▄█████▀ ▀██████▄▄▄▄▄▄▄▄▄▄██████▀ ▀▀████████████████▀▀ ▀▀▀██████▀▀▀ | | | | ▄▄▄███████▄▄▄ ▄█▀▀▀ ▄▄▄▄▄▄▄ ▀▀▀█▄ █▀▀ ▄█████████████▄ ▀▀█ █▀▀ ███████████████████ ▀▀█ █▀ ███████████████████████ ▀█ █▀ ███████████████▀▀ ███████ ▀█ ▄█▀ ██████████████▀ ▀█████ ▀█▄ ███ ███████████▀▀ ▀▀██ ███ ███ ███████▀▀ ███ ███ ▀▀▀▀ ███ ▀██▄ ▄██▀ ▀█▄ ▀▀ █▄ █▄▄▄▄▄▄▄▄▄█ █▄ ▀█████████▀ ▀█▄ ▀▀▀▀▀▀▀ ▀▀█▄▄ ▄▄▄ ▀▀█████ | | | [ | | ] |
|
|
|
BitVapes
Full Member
Offline
Activity: 140
Merit: 100
BitVapes.com
|
|
July 05, 2011, 07:08:36 PM |
|
Anyway to generate a vanity address in windows with the current bitcoin client? My friend wants one.
someone posted a working patch for the latest bitcoin source, it compiled fine for me in linux. I verified it worked by having it "search" for a 1-byte vanity address 'a' and it gave me one. I let it run for a few minutes trying to find one with 'BitVapes' but I'm sure it would take over 9,000 years. I did notice it only tied to one cpu core so I kicked off multiple instances to max out my cpus before shutting it down for fear of melting my box on this basically futile but fun effort. Is that the one in the first post of this thread? no that one didn't work in the latest bitcoin sources, but here is the updated one
|
|
|
|
Ryland R. Taylor-Almanza
Legendary
Offline
Activity: 882
Merit: 1001
|
|
July 06, 2011, 09:01:26 PM |
|
I'm unable to find the option to attach files to posts, so I'm forced to copy paste this here: diff -urpN orig/bitcoin-0.3.23/src/main.h bitcoin-0.3.23/src/main.h --- orig/bitcoin-0.3.23/src/main.h 2011-06-12 01:17:13.000000000 +0200 +++ bitcoin-0.3.23/src/main.h 2011-06-26 00:16:53.531905670 +0200 @@ -84,6 +84,7 @@ FILE* OpenBlockFile(unsigned int nFile, FILE* AppendBlockFile(unsigned int& nFileRet); bool AddKey(const CKey& key); std::vector<unsigned char> GenerateNewKey(); +std::vector<unsigned char> GenerateNewKey(std::string vanity); bool AddToWallet(const CWalletTx& wtxIn); void WalletUpdateSpent(const COutPoint& prevout); int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false); diff -urpN orig/bitcoin-0.3.23/src/rpc.cpp bitcoin-0.3.23/src/rpc.cpp --- orig/bitcoin-0.3.23/src/rpc.cpp 2011-06-12 01:17:13.000000000 +0200 +++ bitcoin-0.3.23/src/rpc.cpp 2011-06-26 00:14:12.042318453 +0200 @@ -6,6 +6,7 @@ #include "cryptopp/sha.h" #undef printf #include <boost/asio.hpp> +#include <boost/xpressive/xpressive_dynamic.hpp> #include <boost/iostreams/concepts.hpp> #include <boost/iostreams/stream.hpp> #ifdef USE_SSL @@ -309,19 +310,61 @@ Value getinfo(const Array& params, bool } +vector<unsigned char> GenerateNewKey(string vanity) +{ + using namespace boost::xpressive; + sregex re = sregex::compile(vanity); + + RandAddSeedPerfmon(); + unsigned int tried = 0; + for (;;) + { + CKey key; + key.MakeNewKey(); + string strAddress = PubKeyToAddress(key.GetPubKey()); + ++tried; + if (tried%100000 == 0) printf("Vanity key tried %u\n", tried); + if (!regex_search(strAddress, re)) continue; + + if (!AddKey(key)) + throw runtime_error("GenerateNewKey() : AddKey failed"); + return key.GetPubKey(); + } +} + +void VanitySearchThread(void* parg) +{ + Array* a = (Array*)parg; + string vanity = (*a)[1].get_str(); + string strAddress = PubKeyToAddress(GenerateNewKey(vanity)); + string strLabel = (*a)[0].get_str(); + + SetAddressBookName(strAddress, strLabel); + + delete a; +} + Value getnewaddress(const Array& params, bool fHelp) { - if (fHelp || params.size() > 1) + if (fHelp || params.size() > 2) throw runtime_error( - "getnewaddress [account]\n" + "getnewaddress [account] [vanity]\n" "Returns a new bitcoin address for receiving payments. " "If [account] is specified (recommended), it is added to the address book " - "so payments received with the address will be credited to [account]."); + "so payments received with the address will be credited to [account]." + "If [vanity] is specified, is less than 10 characters, and is all valid" + "base58 characters, then an address containing that string is generated."); // Parse the account first so we don't generate a key if there's an error string strAccount; if (params.size() > 0) strAccount = AccountFromValue(params[0]); + if (params.size() > 1) + { + Array* a = new Array(params); + CreateThread(VanitySearchThread, (void*)a); + return "...searching..."; + } // Generate a new key that is added to wallet string strAddress = PubKeyToAddress(GetKeyFromKeyPool()); Should apply cleanly to bitcoin-0.3.23. Can a trusted user here provide a windows binary of the bitcoin client with this patch? I've been trying to help my friend make vanity addresses for a while, but my windows compiling skills are very limited.
|
|
|
|
.BITSLER. | ▄███ ▄████▀ ▄████▀ ▄████▀ ▄██▄ ▄████▀ ▀████▄ ▄████▀ ▀████▄ ▄████▀ ▀████▄ ▄████▀ ▀████▄ ▄████▀ ▄████▄ ▄████▄ ▀████▄ █████ ██████ ██████ █████ ▀████▄ ▀████▀ ▀████▀ ▄████▀ ▀████▄ ▄████▀ ▀████▄ ▄████▀ ▀████▄ ▄████▀ ▀████▄ ▄████▀ ▀████▄▄████▀ ▀██████▀ ▀▀▀▀ | | ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄ ▄▄▄▄▀▀▀▀ ▄▄█▄▄ ▀▀▄ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄ █ ▀▄▄ ▀█▀▀ ▄ ▀████ ▀▀▄ █ █▄ ▀▄ ▀████ ▀▀ ▄██▄ ▀▀▄ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ █ ▀▀ ▀▄▄ ▀████ ▄▄▄▀▀▀ █ █ ▄ ▀▄ ▄▄▄▀▀▀ ▄▄ █ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ █ ▄▄ ███ ▀██ █ ▀▀ █ █ ███ ▀██ █ ▄▄ █ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▄ █ ▀▀ █ ▀▀▄ ███▄ █ ▄▄ █ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▄ █ ▀▀▄▄▄▀▀▀ ▄▄▄▄▄▄▄▄▄▄▄█▄▄▀▀▀▀ | | | | ▄▄▄██████▄▄▄ ▄▄████████████████▄▄ ▄██████▀▀▀▀▀▀▀▀▀▀██████▄ ▄ ▄█████▀ ▀█████▄ ██▄▄ █████▀ ▄ ▀█████ ████████ ▄██ █████ ████████▄ ███▀ ████▄ █████████▀▀ ▄███▀ █████ █▀▀▀ █████ █████ ▄▄▄ ████ █████ █████ ▀▀ ████▀ █████ █████ █████▄ ▄█████ ▀█████▄ ▄█████▀ ▀██████▄▄▄▄▄▄▄▄▄▄██████▀ ▀▀████████████████▀▀ ▀▀▀██████▀▀▀ | | | | ▄▄▄███████▄▄▄ ▄█▀▀▀ ▄▄▄▄▄▄▄ ▀▀▀█▄ █▀▀ ▄█████████████▄ ▀▀█ █▀▀ ███████████████████ ▀▀█ █▀ ███████████████████████ ▀█ █▀ ███████████████▀▀ ███████ ▀█ ▄█▀ ██████████████▀ ▀█████ ▀█▄ ███ ███████████▀▀ ▀▀██ ███ ███ ███████▀▀ ███ ███ ▀▀▀▀ ███ ▀██▄ ▄██▀ ▀█▄ ▀▀ █▄ █▄▄▄▄▄▄▄▄▄█ █▄ ▀█████████▀ ▀█▄ ▀▀▀▀▀▀▀ ▀▀█▄▄ ▄▄▄ ▀▀█████ | | | [ | | ] |
|
|
|
nealmcb
Newbie
Offline
Activity: 26
Merit: 0
|
|
July 11, 2011, 01:26:50 AM |
|
I think vanity addresses are cool, e.g. for nonprofits that accept bitcoin donations, among a variety of similar scenarios.
So ByteCoin, I'd encourage you to go ahead with your service, if you really can convince folks that you wouldn't find out their private address.
|
|
|
|
Aresdos
Newbie
Offline
Activity: 34
Merit: 0
|
|
July 14, 2011, 07:40:16 AM |
|
If someone can make and PM me a link to a windows binary that'll help me create vanity addresses, I'd be extremely greatful and might even have a bit bitdecimals I can share in gratitude.. And I'm sure there's others that would be greatful too if you'd link it here...
|
|
|
|
|
dserrano5
Legendary
Offline
Activity: 1974
Merit: 1029
|
|
July 14, 2011, 08:51:42 AM |
|
I've successfully compiled the bitcoin client with the patch that implements the 'importprivkey' command. Would anyone trust me enough to try running it? It's for linux 64 bits (but I can compile it for 32 bits if requested).
|
|
|
|
miguelmorales85
|
|
September 07, 2017, 09:17:59 PM |
|
I'm unable to find the option to attach files to posts, so I'm forced to copy paste this here: diff -urpN orig/bitcoin-0.3.23/src/main.h bitcoin-0.3.23/src/main.h --- orig/bitcoin-0.3.23/src/main.h 2011-06-12 01:17:13.000000000 +0200 +++ bitcoin-0.3.23/src/main.h 2011-06-26 00:16:53.531905670 +0200 @@ -84,6 +84,7 @@ FILE* OpenBlockFile(unsigned int nFile, FILE* AppendBlockFile(unsigned int& nFileRet); bool AddKey(const CKey& key); std::vector<unsigned char> GenerateNewKey(); +std::vector<unsigned char> GenerateNewKey(std::string vanity); bool AddToWallet(const CWalletTx& wtxIn); void WalletUpdateSpent(const COutPoint& prevout); int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false); diff -urpN orig/bitcoin-0.3.23/src/rpc.cpp bitcoin-0.3.23/src/rpc.cpp --- orig/bitcoin-0.3.23/src/rpc.cpp 2011-06-12 01:17:13.000000000 +0200 +++ bitcoin-0.3.23/src/rpc.cpp 2011-06-26 00:14:12.042318453 +0200 @@ -6,6 +6,7 @@ #include "cryptopp/sha.h" #undef printf #include <boost/asio.hpp> +#include <boost/xpressive/xpressive_dynamic.hpp> #include <boost/iostreams/concepts.hpp> #include <boost/iostreams/stream.hpp> #ifdef USE_SSL @@ -309,19 +310,61 @@ Value getinfo(const Array& params, bool } +vector<unsigned char> GenerateNewKey(string vanity) +{ + using namespace boost::xpressive; + sregex re = sregex::compile(vanity); + + RandAddSeedPerfmon(); + unsigned int tried = 0; + for (;;) + { + CKey key; + key.MakeNewKey(); + string strAddress = PubKeyToAddress(key.GetPubKey()); + ++tried; + if (tried%100000 == 0) printf("Vanity key tried %u\n", tried); + if (!regex_search(strAddress, re)) continue; + + if (!AddKey(key)) + throw runtime_error("GenerateNewKey() : AddKey failed"); + return key.GetPubKey(); + } +} + +void VanitySearchThread(void* parg) +{ + Array* a = (Array*)parg; + string vanity = (*a)[1].get_str(); + string strAddress = PubKeyToAddress(GenerateNewKey(vanity)); + string strLabel = (*a)[0].get_str(); + + SetAddressBookName(strAddress, strLabel); + + delete a; +} + Value getnewaddress(const Array& params, bool fHelp) { - if (fHelp || params.size() > 1) + if (fHelp || params.size() > 2) throw runtime_error( - "getnewaddress [account]\n" + "getnewaddress [account] [vanity]\n" "Returns a new bitcoin address for receiving payments. " "If [account] is specified (recommended), it is added to the address book " - "so payments received with the address will be credited to [account]."); + "so payments received with the address will be credited to [account]." + "If [vanity] is specified, is less than 10 characters, and is all valid" + "base58 characters, then an address containing that string is generated."); // Parse the account first so we don't generate a key if there's an error string strAccount; if (params.size() > 0) strAccount = AccountFromValue(params[0]); + if (params.size() > 1) + { + Array* a = new Array(params); + CreateThread(VanitySearchThread, (void*)a); + return "...searching..."; + } // Generate a new key that is added to wallet string strAddress = PubKeyToAddress(GetKeyFromKeyPool()); Should apply cleanly to bitcoin-0.3.23. wow this is like looking into a really old history book. Glad we have other vanity software to create wallets
|
|
|
|
|