1

I read this extremely informative QA:

My raw transaction destroyed 0.0284377 BTC. What did I do wrong?

For those of us new to the BTC universe, there can be confusion between BTC, exchanges, wallet service providers, BTC-related SAAS providers, and so on.

My question:

  1. Notice that the OP in the question has some sort of business which both takes in and sends out BTC.

I mean to say, those operations are done automatically, by the www-based business in question.

  1. Thus the business in question, has "some sort of software on a server", which, can both receive, and indeed send, BTC. So far so good.

What I am confused about:

it would seem to me that for such a common need, nobody would bother writing their own software to provide those two needs, because I assume, there are any number of large well-known services now which provide exactly that service?

(Obviously you might do it experimentally, or as the OP mentioned in the interesting question, it was done some years ago in the early days; or of course the largest enterprises might do it "from scratch". But surely normally there's just a service which does this via simple APIs?)

Thus, say I want to start a business called BitBall, which is a consignment warehouse for buying and selling baseball cards. BitBall users ("type A") send in their baseball cards. Other BitBall users ("type B") buy the baseball cards and they are shipped from the warehouse.

Obviously, "type B" users must spend BTC to BitBall, and "type A" users will have BTC paid to them from BitBall.

My question, it seems incredible that the BitBall programming team would have to program, from scratch, the BTC related software to enable type A receiving and type B spending ??

To repeat, my question is about an online operation which has to both send as well as receive BTC programmatically.

At first I just assumed the major services I had heard about (eg "coinbase") did this sort of thing but I was wrong. (I think!)

Again in short, surely there are (a number of? well-know?) let us say "merchant services companies" for the BTC universe, which handle both spending and receiving BTC? For businesses (example - "BitBall") which both spend and receive?

Or really, do you just have to plain program it yourself from scratch? Is there no such thing (yet?) as an in-and-out merchant services API service for BTC handling??

  • Any Bitcoin client can receive and send BTC just fine. Of course everyone will need to do work to integrate it into their own infrastructure (like website integration). The question refers to is about someone who (I think, inadvisably) wrote the sending code themselves. – Pieter Wuille Dec 4 '17 at 18:41
  • hi @PieterWuille. Thanks - I don't actually know what you mean by: "Any Bitcoin client." What is that specifically?? Thanks! – Fattie Dec 5 '17 at 13:31
  • There are dozens of pieces of software that interact with the Bitcoin network and can receive and send funds. See here for example: bitcoin.org/en/choose-your-wallet – Pieter Wuille Dec 5 '17 at 17:25
  • hi @PieterWuille ! I fully appreciate what you're saying: when you're a "newbie" (no matter my familiarity with traditional payment processing), the BTC "ecosphere" is ..... really confusing! Note that your answer is "well that's obvious - there are many ...." :) I will investigate that helpful link, thanks, and surely be back with more QA on this great SO site. – Fattie Dec 5 '17 at 21:53
  • I'm just baffled by the situation the referenced question asker was in: somehow deciding that learning the full protocol details and implementing transaction signing logic himself, and in that process never encountering any existing software that could do ot for him. Certainly not all information is trivial to find, but this person clearly spent a lot of time researching things or he wouldn't have been able to implement signing. – Pieter Wuille Dec 5 '17 at 23:40
2

I was the OP of that last question that you referenced.

Tracking the 'receives' is actually very easy. There are plenty of free APIs (e.g. BlockExplorer, BitPay/Insight) that'll let you check the status of your inbound BTC transactions with a single API call. It's really a no-brainer.

Sends, on the other hand, are harder to deal with. As opposed to a receive, whose status can be polled with a couple lines of code, a send requires signing using private keys and for obvious reasons, you don't want to broadcast your private keys through a public API. This is what led me down the path of building my own transactions programmatically.

Since the time I wrote that code, quite a few APIs have been made available. BlockCypher, for example, can assist you in building a binary transaction without requiring you to expose your private keys. Building binary transactions isn't exactly straight-forward though, even with an API. Could a person use one of these APIs to build a transaction without having some knowledge of crypto and the native transaction format? Yeah, perhaps, but still not a particularly pleasant process.

Remember, if all you're trying to do is accept Bitcoins for an online store or as payment for services rendered, there's absolutely no need to mess around with any of that low-level stuff that I referenced in my question. Just use a third party service like BitPay. They'll handle all the grunt work including invoicing, transaction building for customer refunds, etc. When I pay for my servers, domains, certs, etc. with BTC I don't think I've ever seen a vendor roll their own Bitcoin billing interface. It always goes through BitPay or a similar service.

My needs and business model are so unusual and specific that a standard package like Bitpay wouldn't work for me. For most use cases though, standard merchant services are the way to go.

  • hi Festus, "Sends, on the other hand, are harder to deal with." - right, that's exactly what I'm wondering. It seems surprising to me that there is not (yet?) a common service which enables site that have to both receive and spend BTC. (As my BitBall example business would.) But maybe I just drastically misunderstand something. :O – Fattie Dec 5 '17 at 13:28
  • @Festus I still don't understand why you say sending is harder. You could use almost any Bitcoin wallet software out there, and it would support any address type. – Pieter Wuille Dec 5 '17 at 17:48
  • @PieterWuille I meant sends are harder to pull off programmatically in code (versus polling for receives) due to the signing component, dealing with the binary format, endianess, etc. From the perspective of a wallet user, these types of operations are point-and-click simple. That's why, if at all possible, I recommend to just use a wallet or for a commerce website, BitPay. It's only a tiny fraction of users like me that will have to worry about hand-crafting transactions in code. Most users can thankfully avoid it like the plague :) – Festus Martingale Dec 5 '17 at 19:30
  • But why would you implement any of the signing logic or parsing binary transaction formats yourself? Wallet software will do all of that for you. And I don't mean BitPay (which is a centralized service). I mean software like Bitcoin Core, Electrum, Armory, ... – Pieter Wuille Dec 5 '17 at 19:31
  • Maybe that's the case now, but at the time (quite a few years back) there wasn't an easy way to hook into Electrum, for example, via an API accessible via .NET, let's say. If that's the new state of affairs, that's awesome! I'll check out your wallet link. – Festus Martingale Dec 5 '17 at 19:33

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.