Mcoroklo (OP)
Jr. Member
Offline
Activity: 77
Merit: 1
|
|
January 14, 2013, 06:46:00 PM |
|
I am currently developing several applications for bitcoins, but I have problems with the most vital part: Receiving payments!
I need the following two API calls: - Generating a bitcoin address, providing a callback, which is called with my custom parameters, when the payment is made - Sending money to a bitcoin address
I've investigated the following:
Blockchain: They seem to have the perfect API, but after more than a week of silence in a support case, the API simply doesn't seem to work (the callback part). Therefore, I am not comfortable with these guys.
Coinbase: Has a minimum transaction of 0.01BTC and no callback function when sending money.
MtGox: As I see it, it doesn't look to provide what I need, but different things.
Bitcoin RPC: If I can avoid having a local server it would be great, plus I've no idea how to program against this API ;-)
I would love ANY ideas!
|
|
|
|
grau
|
|
January 14, 2013, 06:56:06 PM |
|
I am currently developing several applications for bitcoins, but I have problems with the most vital part: Receiving payments!
I need the following two API calls: - Generating a bitcoin address, providing a callback, which is called with my custom parameters, when the payment is made - Sending money to a bitcoin address
The first is a nice idea, I think about adding this to the bitsofproof API, the second should be trivial with bitcoind RPC or bitcoinj functions.
|
|
|
|
Realpra
|
|
January 14, 2013, 08:32:34 PM |
|
As far as I know the Electrum client is open source, since this is a lightweight client you can run it without killing your server easily.
Either it will have an API OR you can modify the code to write out the events you need etc..
|
|
|
|
Mcoroklo (OP)
Jr. Member
Offline
Activity: 77
Merit: 1
|
|
January 15, 2013, 10:11:36 AM |
|
Grau: If you implement it fast, you have a customer, and maybe, with quite a lot of volume ;-)
Realpra: Only issue, seems like I need to learn Python first.. ;-)
Thanks for the answers! I would love to hear other thoughts too.
|
|
|
|
BitcoinHoarder
|
|
January 15, 2013, 12:41:44 PM |
|
If you are developing several applications for bitcoin I highly recommend you learn the bitcoind API. It does a lot and works really well. Why would you want to avoid having a local server? If you post here you will get help very fast. I will even get you started with this script that sends money in Python: from jsonrpc import ServiceProxy
amount = 0.5050 sendToAddress = "1putanaddressheretosendto"
access = ServiceProxy("http://username:password@127.0.0.1:8332") balance = access.getinfo()["balance"] print "BALANCE: " + str(balance) transaction_id = access.sendtoaddress(sendToAddress, amount) print "TRANSACTION ID: " + transaction_id
How easy is that? Super easy!
|
|
|
|
|
Mcoroklo (OP)
Jr. Member
Offline
Activity: 77
Merit: 1
|
|
January 15, 2013, 05:46:36 PM |
|
BitcoinHoarder: Ok, that code is really simple. Even without understanding python, that's so readable. I will look into it. Carlos L: Blockchain never make a callback, even though my code should work, and their support doesn't answer. Thanks a lot for answers so far
|
|
|
|
grau
|
|
January 15, 2013, 06:34:02 PM Last edit: January 15, 2013, 07:29:58 PM by grau |
|
Grau: If you implement it fast, you have a customer, and maybe, with quite a lot of volume ;-)
It is done. The bitsofproof node offers a message bus where it sends validated transactions and block chain events to authenticated extensions. It accepts transactions for routing towards the net through the same bus. The API for extensions includes a call to register a callback as simple as: public void registerAccountListener (List<String> addresses, TransactionListener listener);
You will receive validated transactions as properly parsed java objects with all information available on the wire. You will receive transactions receiving OR spending involving that set of addresses. The caveat with bitsofproof is, that although it works stable it needs to pass yet more tests to call it production quality. If your decision criteria is fastest production deployment, go for something else for now. In case you build an enterprise, I guess you will come back See the wiki for more: https://github.com/bitsofproof/supernode/wiki
|
|
|
|
ingrownpocket
Legendary
Offline
Activity: 952
Merit: 1000
|
|
January 15, 2013, 08:25:37 PM |
|
Carlos L: Blockchain never make a callback, even though my code should work, and their support doesn't answer.
You're doing something wrong then. I have 3 services using that payment method and all 3 callbacks work fine.
|
|
|
|
Mcoroklo (OP)
Jr. Member
Offline
Activity: 77
Merit: 1
|
|
January 15, 2013, 10:11:36 PM |
|
|
|
|
|
ingrownpocket
Legendary
Offline
Activity: 952
Merit: 1000
|
|
January 16, 2013, 09:36:51 AM |
|
Error no protocol: url.com/callbackhandler.ashx -> This pretty much says everything. blockchain.info/api/receive?method=create&address=1Ccypfi3rnXosUgY6p1sQVXFyddFvwLFEJ&anonymous=false&callback= http://url.com/callbackhandler.ashx&myid=a0613be5-1c05-47ff-a455-a9f597d61ea5&participant=A
|
|
|
|
Mcoroklo (OP)
Jr. Member
Offline
Activity: 77
Merit: 1
|
|
January 16, 2013, 10:35:20 AM |
|
The url.com was just a replacement URL. I have full http://www. on my domain, and the callback tool on their API page works perfectly. It is when the money is payed to that address, the callback is never called. I log any visit (before checking IP), and the url is never called.
|
|
|
|
Mike Hearn
Legendary
Offline
Activity: 1526
Merit: 1134
|
|
January 16, 2013, 10:38:34 AM |
|
bitcoinj apps receive callbacks when money is received. Take a look at the PingService example in the examples directory to see how it's done, or for a "real" app look at the code to MultiBit or the Android Bitcoin Wallet. There are docs on the website explaining how to do it : http://code.google.com/p/bitcoinj
|
|
|
|
ingrownpocket
Legendary
Offline
Activity: 952
Merit: 1000
|
|
January 16, 2013, 12:32:16 PM |
|
The url.com was just a replacement URL. I have full http://www. on my domain, and the callback tool on their API page works perfectly. It is when the money is payed to that address, the callback is never called. I log any visit (before checking IP), and the url is never called. Well, I don't know what's happening then. I can take a look at your script for a fee.
|
|
|
|
Mcoroklo (OP)
Jr. Member
Offline
Activity: 77
Merit: 1
|
|
January 16, 2013, 01:13:12 PM |
|
Carlos: I just tried running the code on my website, and now it worked. It seems they made a fix, as I didn't change my code at all. Interesting! :-)
Thanks a lot for your help though.
|
|
|
|
danystatic
|
|
September 30, 2013, 06:36:40 PM |
|
I am having the same issue, I had fixed it before, but something is wrong, the callback works great from the Callback Test from blockchain.info but not when I am actually sending Bitcoins $callback_url = Config::get('btcconfig.mysite_root') . "callback?invoice_id=" . $invoice_id; file_get_contents(" https://blockchain.info/api/receive?method=create&address=16qiTWRUr6dbTdAbH3nzP5nqGcmEdaPwGq&shared=false&callback=" . urlencode($callback_url)); Results : string(195) "{"input_address":"1MrYVkkkXMEQjcwHtp8V2miXsR6aC1o9xf","callback_url":"http:\/\/guiseppelidonnici.com\/callback?invoice_id=9001","fee_percent":0,"destination":"16qiTWRUr6dbTdAbH3nzP5nqGcmEdaPwGq"}" I have to fix this today, please give advice
|
|
|
|
BitcoinLeader
|
|
September 30, 2013, 07:22:08 PM |
|
I just released the open-source MtGox PHP API V2 which does exactly what you need. You would be needing the following method: /** * Generates a new bitcoin address for depositing. * * @require API Rights: Deposit * @param string $description Optional description to display in the account history * @param string $ipn Optional IPN URL which will be called with details when bitcoins are received * @return mixed */ function getDepositAddress($description = null, $ipn = null) { $result = $this->query( $this->pair . '/money/bitcoin/address', array( 'description' => $description, 'ipn' => $ipn ));
return $result; }
1. The method returns an deposit addres 2. The IPN parameter is the callback URL you are looking for to get notified when bitcoins are deposited on the address If you pass an transaction ID to the IPN URL and associate the transaction ID with the deposit address, you can trace it back when the IPN callback is triggered.
|
|
|
|
Sukrim
Legendary
Offline
Activity: 2618
Merit: 1007
|
|
October 08, 2013, 08:21:50 AM |
|
Ideally I'd like a piece of code that just interfaces with bitcoind's RPC interface and generates the callbacks on its own, if necessary even just by simply polling every 2 seconds or so.
Has anyone written something like this already? It doesn't seem too difficult to do on my own, but it would be nice if it already exists. I do explicitly not want to extend bitcoinj or Electrum etc., as I would like to use this approach on altcoin clients too, which are (too) often based on bitcoind and expose the same or a very similar RPC interface, so I'd love to keep it generic.
|
|
|
|
johba
|
|
October 08, 2013, 03:34:21 PM |
|
check out this in java for bitcoind: https://github.com/johannbarbie/BitcoindClient4Jyou can register block or wallet listeners: new BlockListener(client).addObserver(new Observer() { @Override public void update(Observable o, Object arg) { Block block = (Block)arg; } });
|
|
|
|
Sukrim
Legendary
Offline
Activity: 2618
Merit: 1007
|
|
October 09, 2013, 12:50:40 PM |
|
One of the problems is the generation of new addresses that can lead to very large wallet files over time. With blockchain.info you offload this stuff to them, if you do it yourself, you might want to look into rate limiting or something like that to avoid someone spamming your server with 1 million requests that would fill your wallet files and also maybe even DoS you with key generation.
|
|
|
|
|