Bitcoin Forum
November 09, 2024, 03:55:02 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Best way to generate a lot of private keys/public key pairs on a server?  (Read 1352 times)
coinableS (OP)
Legendary
*
Offline Offline

Activity: 1442
Merit: 1186



View Profile WWW
January 15, 2015, 01:33:40 PM
 #1

I was using blockchain.info's API for this, but I've hit their API usage limits. Is there a PHP library or something that will allow me to generate a large amount of private key/public key pairs constantly through out the day where I don't have to worry about usage limits?

DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4831



View Profile
January 15, 2015, 01:37:03 PM
 #2

You could use vanitygen.

Or you could use the code from bitaddress.

Or you could run bitcoind.
coinableS (OP)
Legendary
*
Offline Offline

Activity: 1442
Merit: 1186



View Profile WWW
January 15, 2015, 01:51:06 PM
 #3

You could use vanitygen.

Or you could use the code from bitaddress.

Or you could run bitcoind.

That's a lot of options!  Things are looking good  Cool
Thank you I'll check out the vanitygen and bitaddress options. Is it possible to run bitcoind on a hosted webserver? I know how to run one locally, but no idea how I would get it on my host. Most people use a VPN like digital ocean for their bitcoind, correct?

coinableS (OP)
Legendary
*
Offline Offline

Activity: 1442
Merit: 1186



View Profile WWW
January 15, 2015, 01:59:00 PM
 #4

You could use vanitygen.

Or you could use the code from bitaddress.

Or you could run bitcoind.

Actually can you provide a little more guidance on vanitygen? When I looked it up it appears to be an application I run on my local machine? Maybe I'm not looking at the same thing you are talking about.  I'm looking for something I can use so I can write a script and run on my server, preferably as a cronjob every few minutes and log all the generated key pairs to my DB.

domob
Legendary
*
Offline Offline

Activity: 1135
Merit: 1170


View Profile WWW
January 15, 2015, 02:04:06 PM
 #5

You could use vanitygen.

Or you could use the code from bitaddress.

Or you could run bitcoind.

Actually can you provide a little more guidance on vanitygen? When I looked it up it appears to be an application I run on my local machine? Maybe I'm not looking at the same thing you are talking about.  I'm looking for something I can use so I can write a script and run on my server, preferably as a cronjob every few minutes and log all the generated key pairs to my DB.

You can compile and run vanitygen on the server just as you would on your local machine.  However, this requires, of course, something like a VPS where you have the ability to install custom programs / compile the code.  If you have just a webhost that allows you to run PHP, then it won't work.

Use your Namecoin identity as OpenID: https://nameid.org/
Donations: 1domobKsPZ5cWk2kXssD8p8ES1qffGUCm | NMC: NCdomobcmcmVdxC5yxMitojQ4tvAtv99pY
BM-GtQnWM3vcdorfqpKXsmfHQ4rVYPG5pKS | GPG 0xA7330737
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4831



View Profile
January 15, 2015, 02:08:11 PM
 #6

You can compile and run vanitygen on the server just as you would on your local machine.  However, this requires, of course, something like a VPS where you have the ability to install custom programs / compile the code.  If you have just a webhost that allows you to run PHP, then it won't work.

You can also run vanitygen on your own PC and generate a few million key/address pairs.  Then you can put together a small script that will import all the addresses into the database that you are running on the server.  That should result in your server having all the addresses it needs for a long time.

Then you can create an alert that lets you know when you have fewer than 200,000 addresses unused in your database.  In that case, you can re-run vanitygen on your local PC and re-import a new set of a few million addresses.
cr1776
Legendary
*
Offline Offline

Activity: 4214
Merit: 1313


View Profile
January 15, 2015, 02:09:29 PM
 #7

I was using blockchain.info's API for this, but I've hit their API usage limits. Is there a PHP library or something that will allow me to generate a large amount of private key/public key pairs constantly through out the day where I don't have to worry about usage limits?

You didn't specify the use case, but you should be careful storing private keys on the server too.  Just something to consider. 
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
January 15, 2015, 02:44:57 PM
 #8

Just so you know, importing addresses into a wallet is a very slow process, something like 2 keys per second on a standard HDD if you use importprivkey RPC.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
January 15, 2015, 05:10:24 PM
Last edit: January 15, 2015, 06:56:17 PM by DeathAndTaxes
 #9

I was using blockchain.info's API for this, but I've hit their API usage limits. Is there a PHP library or something that will allow me to generate a large amount of private key/public key pairs constantly through out the day where I don't have to worry about usage limits?

You didn't specify the use case, but you should be careful storing private keys on the server too.  Just something to consider.  


This.  Consider careful if you even need private keys on the server.   If you don't then creating keypairs offline (or on a hardened single purpose computer) and uploading only the public keys to the server would be more secure.   Using an HD wallet you could generate an unlimited number of deterministic pubkeys from a single extended pubkey.
newIndia
Legendary
*
Offline Offline

Activity: 2226
Merit: 1052


View Profile
January 15, 2015, 05:26:20 PM
 #10

I was using blockchain.info's API for this, but I've hit their API usage limits. Is there a PHP library or something that will allow me to generate a large amount of private key/public key pairs constantly through out the day where I don't have to worry about usage limits?

Blockchain.info allows 28800 addresses to be created per 8 hour. May I know what u r doing that u r hitting this limit ?

Moreover, what I understand, that u need the receive API of blockchain.info to be re-created. Only having private key/public key pair will not solve this problem. You need to forward the amount as well to your actual deposit address and inform your application by a callback that an amount has hit the address.

findftp
Legendary
*
Offline Offline

Activity: 1022
Merit: 1008

Delusional crypto obsessionist


View Profile
January 15, 2015, 07:21:35 PM
 #11

I was using blockchain.info's API for this, but I've hit their API usage limits. Is there a PHP library or something that will allow me to generate a large amount of private key/public key pairs constantly through out the day where I don't have to worry about usage limits?

You sure you need the private key as well?
If you want the addresses to use with customers, why not generate key pairs with bitaddress.org (for example) and then only upload the public key and keep the private key very secret somewhere offline?
coinableS (OP)
Legendary
*
Offline Offline

Activity: 1442
Merit: 1186



View Profile WWW
January 15, 2015, 09:58:44 PM
 #12

My project is a bit unconventional.  A freak-show novelty website if you will. There will be no sending or receiving, only generation of key pairs. Private and public keys will be visible to all. It is an experiment on both bitcoin address generation and the hidden variable theory, as Einstein and others called it. True randomness does not actually exist, but our ignorance to hidden variables only makes it appear random to us. Basically, I'm looking for a collision. Yes, I know the odds of a collision, but I'm not going against the collision odds, I'm going against the randomness.


Kazimir
Legendary
*
Offline Offline

Activity: 1176
Merit: 1011



View Profile
January 15, 2015, 10:37:22 PM
 #13

My project is a bit unconventional.  A freak-show novelty website if you will. There will be no sending or receiving, only generation of key pairs. Private and public keys will be visible to all. It is an experiment on both bitcoin address generation and the hidden variable theory, as Einstein and others called it. True randomness does not actually exist, but our ignorance to hidden variables only makes it appear random to us. Basically, I'm looking for a collision. Yes, I know the odds of a collision, but I'm not going against the collision odds, I'm going against the randomness.
In that case, you're better off just generating (pseudo)random 256-bit values. Essentially, a private key is just 256 'random' bits. If you use a poor PRNG, the actual entropy will be much less than 256 bits. Is that the point you're trying to prove?

Either way, I think calculating the corresponding address with every private key, or even importing the whole lot in an actual Bitcoin wallet, is completely unnecessary in your case and will only make the process a fuckton slower.

In theory, there's no difference between theory and practice. In practice, there is.
Insert coin(s): 1KazimirL9MNcnFnoosGrEkmMsbYLxPPob
coinableS (OP)
Legendary
*
Offline Offline

Activity: 1442
Merit: 1186



View Profile WWW
January 16, 2015, 12:17:53 AM
 #14

Not trying to prove a point. Just experimenting. There are plenty of useless novelty websites out there like isbitcoindead.com  I thought this would be a little more interesting than a "no" written inside an h1 tag. Questions regarding collisions are frequent among many new comers. Thought it could be helpful to send someone to a website that shows the live stats of generating a couple hundred addresses every second for the last 2 years and still hasn't had a collision.

cr1776
Legendary
*
Offline Offline

Activity: 4214
Merit: 1313


View Profile
January 16, 2015, 01:51:39 AM
 #15

Not trying to prove a point. Just experimenting. There are plenty of useless novelty websites out there like isbitcoindead.com  I thought this would be a little more interesting than a "no" written inside an h1 tag. Questions regarding collisions are frequent among many new comers. Thought it could be helpful to send someone to a website that shows the live stats of generating a couple hundred addresses every second for the last 2 years and still hasn't had a collision.

There are libraries that will do this, you asked about php, take a look at these:

https://github.com/Bit-Wasp/bitcoin-lib-php
https://github.com/mdanter/phpecc


This should be a good start, but I don't know about "a couple hundred" per second.
doof
Hero Member
*****
Offline Offline

Activity: 765
Merit: 503


View Profile WWW
January 16, 2015, 03:19:34 AM
 #16

Not trying to prove a point. Just experimenting. There are plenty of useless novelty websites out there like isbitcoindead.com  I thought this would be a little more interesting than a "no" written inside an h1 tag. Questions regarding collisions are frequent among many new comers. Thought it could be helpful to send someone to a website that shows the live stats of generating a couple hundred addresses every second for the last 2 years and still hasn't had a collision.

There are libraries that will do this, you asked about php, take a look at these:

https://github.com/Bit-Wasp/bitcoin-lib-php
https://github.com/mdanter/phpecc


This should be a good start, but I don't know about "a couple hundred" per second.

If you're not persisting them in a db, 100:second is achievable.
doof
Hero Member
*****
Offline Offline

Activity: 765
Merit: 503


View Profile WWW
January 16, 2015, 03:20:57 AM
 #17

Not trying to prove a point. Just experimenting. There are plenty of useless novelty websites out there like isbitcoindead.com  I thought this would be a little more interesting than a "no" written inside an h1 tag. Questions regarding collisions are frequent among many new comers. Thought it could be helpful to send someone to a website that shows the live stats of generating a couple hundred addresses every second for the last 2 years and still hasn't had a collision.
Ok, you will need to store in a DB.  Its a very wasy project.  Probably about 100 lines of c# or use NBitcoin from nuget.
The entity framework to persist in a db.
cr1776
Legendary
*
Offline Offline

Activity: 4214
Merit: 1313


View Profile
January 16, 2015, 10:16:48 AM
 #18

Not trying to prove a point. Just experimenting. There are plenty of useless novelty websites out there like isbitcoindead.com  I thought this would be a little more interesting than a "no" written inside an h1 tag. Questions regarding collisions are frequent among many new comers. Thought it could be helpful to send someone to a website that shows the live stats of generating a couple hundred addresses every second for the last 2 years and still hasn't had a collision.

There are libraries that will do this, you asked about php, take a look at these:

https://github.com/Bit-Wasp/bitcoin-lib-php
https://github.com/mdanter/phpecc


This should be a good start, but I don't know about "a couple hundred" per second.

If you're not persisting them in a db, 100:second is achievable.

Yeah, running it with php and storing it in a database - 100/sec might be a bit much.

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!