2

I've been searching for an open-source alternative to blockchain.info's Receive Payments API (https://blockchain.info/api/api_receive). I want to run bitcoind on my own server and have payments handled in my own database.

Is there any project in existence that is kept up-to-date with the current version of Bitcoin?

Searching here, github, and Google has returned me no results.

  • 1
    What is your programming language of choice? You can take a look at BitcoinLib which is up-to-date and fully compatible with both bitcoind and blockchain.info's RPC API. David's answer will give you an idea on how to get started. – George Kimionis Jan 9 '15 at 2:29
3

I don't think you need a third-party library if you have a reasonable level of programing experience. (If you don't, you probably shouldn't be handling money directly.)

Here are the steps from the Blockchain.info (BC.i) page recreated for Bitcoin Core.

Get A Receiving Address

Use the getnewaddress RPC. The JSON-RPC result will be a string with the address.

Get A Callback When An Address Receives A Payment

Use the -walletnotify bitcoind command line switch to run a program every time a wallet transaction is received, sent, or confirmed. Your program can use the following commands:

  • gettransaction to get details about the transaction, including everything BC.i would've sent you and more. (See link for an example.) When Bitcoin Core runs the walletnotify command, it can pass an argument with the TXID, so you would run gettransaction <txid>
  • Something like curl to send an HTTP GET to your callback URL with whatever details you need

That's it. As long as you can write a script that can parse JSON, you can do everything BC.i does with just a few lines of code. That's also probably why you don't see any code on GitHub: it's too simple to make a project out of.

Before you get started, I highly recommend reading the Bitcoin Wiki proper money handling page to learn how to handle high-precision bitcoin values. Also, if this is your first money-handling program, please remember the high stakes that come with holding on to money. Hackers love stealing bitcoins.

  • Libraries serve many purposes, and there are good reasons to use them instead of building everything from scratch. I'm looking for something that's been tried and tested for at least one year. I could build it myself, but I'd rather start my next project using code that is more than 0 days old and has been tested more than 0 times. If it's true that this doesn't exist and everyone uses third party services (blockchain.info/bitpay/coinbase) for merchant processing, then what's the point of even using Bitcoin in the first place? – bvpx Jan 23 '15 at 2:21
  • 1
    David Harding was not telling you to build everything from scratch, he was telling you how to integrate your app with bitcoind with a few lines of code. It sounds pretty reasonable to me, except you should use a heirarchical deterministic wallet so that you only need one backup ever. – David Grayson Feb 9 '15 at 16:42
0

The Mycelium Gear is probably the most practical way to go. While technically it's a 3rd party, the money is not routed through them, and thus no KYC/AML, no censorship, and no commission. Mycelium Gear simply notifies you about the incoming payments based on your HD wallet xpubkey.

Alternatively, you can setup their open source software yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.