Pages:
Author

Topic: Bitcoin API with callback function? (Read 9045 times)

hero member
Activity: 711
Merit: 500
April 15, 2016, 07:57:18 PM
#32
I think blockchain-info callback works well.
there have no other problem.
full member
Activity: 224
Merit: 101
April 15, 2016, 01:26:17 AM
#31
blockchain-info callback works now,
they have problem this it and fix now
full member
Activity: 224
Merit: 101
April 15, 2016, 01:23:59 AM
#30

You can use GoUrl PHP Payment Bitcoin API -

https://gourl.io/


It is support callbacks.

nice service..
but how use it?
need vps and node?
please tell me details
full member
Activity: 224
Merit: 101
April 13, 2016, 10:25:42 AM
#29
Why callback blockchain.info don't work now?
full member
Activity: 221
Merit: 100
November 11, 2014, 08:39:28 AM
#28

You can use GoUrl PHP Payment Bitcoin API -

https://gourl.io/


It is support callbacks.
sr. member
Activity: 840
Merit: 276
July 11, 2014, 09:57:49 AM
#27
btcipn.com does the job pretty much well and it is easy to integrate if you are familiar with paypal ipn

- no 3rd party wallet (use your own wallet)
- no registration required
- your website will be listed on their home page

i have tested it and it works just great
full member
Activity: 235
Merit: 100
October 09, 2013, 10:52:53 PM
#26
yes, sessions work for this, just hope the 'user' does not pays and close the web-explorer(chrome,firefox,etc..) before the session expires =)
I know it's a small time-frame, but possible
also
what about two clients asking for   getnewaddress(),  (php)

is it possible two clients get same address because they clicked almost at the same time?
I think is not possible but someone said it was, but I test it and still it is not working like that, but I don't know on a heavier load...
member
Activity: 68
Merit: 10
October 09, 2013, 10:45:36 PM
#25
Then you'd end up with potentially presenting the same address to several users, as there will always be some lag time between presenting the user an address and the user sending something there.

The only thing to prevent this is to create some accounts on your service (which is something I want to avoid) or doing ugly things such as using IP addresses to distinguish between current users...

I'd say you have sessions for your users at least, to do basic things like shopping carts or even sticky load balancing. so map those to accounts and you will only ever need as much accounts/unused addresses as concurrent sessions. IMHO, bitcoind gives you some great tools at hand if you want to get things up and and running quickly.

If you want to build things neatly, build on bitcoinj/BOP with deterministic wallets, optimise wallet performance once needed, and then contribute your changes back instead of sitting on them.

blockchain.info is also not perfect, as you will have archive addresses to keep wallet performance up: http://blockchain.info/api/blockchain_wallet_api
legendary
Activity: 1890
Merit: 1000
Landscaping Bitcoin for India!
October 09, 2013, 10:31:42 PM
#24
Check my github in my signature. It has fully working code for Blockchain and Coinbase.

Both have been successfully implemented with callbacks, etc for 2 games as well.

https://github.com/bensonsamuel
full member
Activity: 235
Merit: 100
October 09, 2013, 07:19:58 PM
#23
a REAL callback function, it could be possible with a cron job / script + walletnotify or other way I wish someone says the proper way :s

----------------------------
I did modifiy blockchain's php payment demo  and also  :   payment_button_v2.js
also
used bitcoin rpc  
----
why are you so opposed to learning the rpc, is easy, i could be a guide
It is 1 day thing.
legendary
Activity: 2618
Merit: 1007
October 09, 2013, 02:46:21 PM
#22
Then you'd end up with potentially presenting the same address to several users, as there will always be some lag time between presenting the user an address and the user sending something there.

The only thing to prevent this is to create some accounts on your service (which is something I want to avoid) or doing ugly things such as using IP addresses to distinguish between current users...

It might be possible to re-use addresses (if you re-implement the blockchain API, one could save all addresses that were not used for 1 week and then use these again) to migitate this somehow, still wallet bloat is an issue, as long as keys are 100% independent of each other and not BIP31. Even if Bitcoind (finally!) implements BIP31 deterministic keys, there is still the issue with Altcoins that are poorly maintained and that would take even longer to pull the necessary code.

Maybe creating a relatively large pool of addresses (e.g. 100k or so) that are rotated would work too, but that's actually backend stuff. Still, the "generating new address" part is what worries me most, the rest could be also simply polled with getreceivedbyaddress as already said.
member
Activity: 68
Merit: 10
October 09, 2013, 09:40:53 AM
#21
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.

I think that's easy to avoid using the getaccountaddress call with the bitcoind json rpc. It will only give you a new address once the previous one has been used in a transaction.
legendary
Activity: 2618
Merit: 1007
October 09, 2013, 07:50:40 AM
#20
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.
member
Activity: 68
Merit: 10
October 08, 2013, 10:34:21 AM
#19

check out this in java for bitcoind: https://github.com/johannbarbie/BitcoindClient4J

you can register block or wallet listeners:

new BlockListener(client).addObserver(new Observer() {
    @Override
    public void update(Observable o, Object arg) {
      Block block = (Block)arg;
    }
  });
legendary
Activity: 2618
Merit: 1007
October 08, 2013, 03:21:50 AM
#18
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.
member
Activity: 84
Merit: 10
September 30, 2013, 02:22:08 PM
#17
I just released the open-source MtGox PHP API V2 which does exactly what you need.


You would be needing the following method:

Quote
/**
* 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.
full member
Activity: 235
Merit: 100
September 30, 2013, 01:36:40 PM
#16
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
jr. member
Activity: 77
Merit: 1
January 16, 2013, 08:13:12 AM
#15
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.
legendary
Activity: 952
Merit: 1000
January 16, 2013, 07:32:16 AM
#14
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.
legendary
Activity: 1526
Merit: 1134
January 16, 2013, 05:38:34 AM
#13
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
Pages:
Jump to: