Bitcoin Forum

Other => Beginners & Help => Topic started by: Greed on December 16, 2011, 04:20:06 AM



Title: Bitcoin API?
Post by: Greed on December 16, 2011, 04:20:06 AM
Is there some sort of API or bitcoin management suite for linux? I've been planning a bitcoin-based site for quite some time but I hit a speedbump when I realized I'm probably going to have to find a way to generate addresses on demand and then verify them etc. etc. from the same server.

Am I going to have to write a daemon, or do API's/services exist for this kind of thing?

Really, I'm just looking for something that can:

  • Check if balance requested is paid in full
  • Generate unique addresses
  • Send to addresses


Title: Re: Bitcoin API?
Post by: MORA on December 16, 2011, 06:28:18 PM
You dont absolutely need bitcoind on the server.
You can pre-generate a large amount of addresses, ie. 100 or 10.000, then save the public (and only the public) address in a database.

When a customer selects to pay with bitcoin, you select and remove a address from the table and ask them to pay to that address.

Then you need a service that will monitor the bitcoin network, seeing that the transactions are public, you just give the service the same list of addresses.
When a payment to one of the addresses is detected, the service will call your server with some params, untill recently there was a service that did just that - bitcoinotify.com - but not sure if it will reappear.

You could also make your own solution, I am trying to do just that with bitcoind, abe and a MySQL database, this still does not need to be on the same server as your website, and by using pre-generated addresses, you dont need to flood your bitcoin wallet with addresses that wont be used, when the customer backs out after getting an address.
You simply wait untill a payment is made to an address, and then adds that address, or uses one of the javascript based ewallets to send the payment to your regular account (since standard bitcoin client cannot import custom addresses, unless you use pywallet and have not encrypted the wallet).

Not sure how to get 0-confirmation to work with abe, it would be neat since that comes within a few seconds of the payment, so you could show a nice graphic while waiting for the initial broadcast of unconfirmed payment, and then show a thank you page.
-but waiting for 2-6confirmations before actually accepting the payment as good in the background.


Title: Re: Bitcoin API?
Post by: Greed on December 17, 2011, 04:57:13 AM
Thanks for the advice, I suppose I could just generate a veritable shit ton of addresses, but I was looking for some way to make it automated such that I could walk away for a month and have it still be functional etc etc. I guess at this point bitcoind, SQL, and Python are the best way to go about this.


Title: Re: Bitcoin API?
Post by: MORA on December 17, 2011, 08:39:32 AM
If you only expect 1 payment per order, you could reuse the addresses.
The original bitcoin notify suggested this, so after a period of maybe 1week from a purchase you reenter the address in the pool.

Or you could make a webservice of some kind where a different crontab can upload public addresses, ie. once a day check if there is less than 100 addresses left, and then upload 100more, still keeping the private keys off the webserver, so if it gets hacked, they cant use the coins.

But with vanity gen you could make 100.000 addresses, that should last a while :)


Title: Re: Bitcoin API?
Post by: payb.tc on December 17, 2011, 08:47:18 AM
Thanks for the advice, I suppose I could just generate a veritable shit ton of addresses, but I was looking for some way to make it automated such that I could walk away for a month and have it still be functional etc etc. I guess at this point bitcoind, SQL, and Python are the best way to go about this.

if you want to go away for a month, relying on bitcoind not to freeze up is the last thing you should do.

generating a 'shit ton' of addresses and pulling them from a database would be a MUCH more reliable method if you're going to be away.