Difference between revisions of "Lazy API"

From Bitcoin Wiki
Jump to: navigation, search
(More reasons why this would be a bad idea.)
Line 21: Line 21:
 
'''Bad idea:'''
 
'''Bad idea:'''
  
Selling bars of gold this way (owner of blockexplorer.com could rip you off)
+
* Selling bars of gold this way (owner of blockexplorer.com could rip you off)
 +
* Selling anything as part of a serious business
  
 
'''Good(?) idea:'''
 
'''Good(?) idea:'''
  
 
Selling naked pictures of your grandma this way (owner of blockexplorer.com won't bother)
 
Selling naked pictures of your grandma this way (owner of blockexplorer.com won't bother)
 +
 +
'''Why this should not be used in a serious setup:'''
 +
 +
First of all 1 confirmation is too little. The block-chain can branch off and does often. This is what caused MyBitcoin.com to temporarily close as bitcoins were constantly leaking out.
 +
Secondly you will become dependent of the proper functioning of MtGox and BlockExplorer. If either is compromised/corrupted/stops you will end up losing money and/or having to reprogram your system.
  
 
'''Shameless begging:'''
 
'''Shameless begging:'''

Revision as of 12:44, 19 August 2011

For the incredibly lazy and/or incompetent web developer, I present the lazy man's bitcoin API (copied from a forum post):

Problem:

Lazy web designer (me) wants to use bitcoins without dealing with installing bitcoin on a server, installing a shopping cart interface, or using ugly merchant services with callbacks.

Solution for sending bitcoins:

Use the MtGox API

Solution for receiving bitcoins:

  1. Input a list of bitcoin receiving addresses to your database
  2. Give a bitcoin address to a potential customer
  3. Have the customer tell you when they have sent the coins and have at least 1 confirmation (you can choose a number higher than 1 if you are worried about double-spending)
  4. Check blockexplorer to see if they sent the right amount (i.e. http://blockexplorer.com/q/getreceivedbyaddress/19hMEAaRMbEhfSkeU4GT8mgSuyR4t4M6TH/1) - the /1 is the number of confirmations you require
  5. Give them what they paid for
  6. After a reasonable amount of time has passed, you can re-use the address for another customer

You could avoid having a list of addresses and reusing them if one of the wallet services someday lets you get a new address via API call, but this will work for now.

Bad idea:

  • Selling bars of gold this way (owner of blockexplorer.com could rip you off)
  • Selling anything as part of a serious business

Good(?) idea:

Selling naked pictures of your grandma this way (owner of blockexplorer.com won't bother)

Why this should not be used in a serious setup:

First of all 1 confirmation is too little. The block-chain can branch off and does often. This is what caused MyBitcoin.com to temporarily close as bitcoins were constantly leaking out. Secondly you will become dependent of the proper functioning of MtGox and BlockExplorer. If either is compromised/corrupted/stops you will end up losing money and/or having to reprogram your system.

Shameless begging:

If this info is useful to you, please consider a donation: 19hMEAaRMbEhfSkeU4GT8mgSuyR4t4M6TH

Thanks to theymos for making changes to blockexplorer.com to make it even easier to do this. You can support blockexplorer.com by donating to 1Cvvr8AsCfbbVQ2xoWiFD1Gb2VRbGsEf28