Take the 2-minute tour ×
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It's 100% free, no registration required.

At MtGox (and presumably some other sites), you can withdraw money in the form of a redeemable code. These codes are also accepted for deposit at some Bitcoin exchanges.

How does this work? Specifically, is there protection against double-spending? Can I know that the code I got is still valid, and has not been given to others as well?

share|improve this question
1  
I'm not sure why you're specifically concerned about how you know the code is "still valid". Aren't you equally worried that it was never valid? –  David Schwartz Mar 13 '12 at 4:42
    
@David Schwartz: That would be a subset of my worries, yes. But I would not care particularly about the distinction if it was already spent, or not valid at all. –  Thilo Mar 13 '12 at 5:05
    
Mt. Gox has announced that it will stop issuing MTG USD and MTG CAD redeemable codes beginning April 10, 2013: bitcoinmoney.com/post/44860726799 –  Stephen Gornick Mar 11 '13 at 9:32

2 Answers 2

up vote 6 down vote accepted

The code is effectively just a long random string. When you create a redeemable code, a random string is selected, entered into the database at the exchange and associated with a currency and an amount. That string is your redeemable code. The string is long enough to make it very unlikely that anyone would be able to guess it in a reasonable length of time.

The first person to attempt to redeem the code gets the amount credited to their account on the exchange, which causes the database entry on the exchange for that code to be marked as having been redeemed.

The way to tell whether a code is valid is to try redeeming it. If it works, you're the first to try it. If not, you're either not the first to try using it, or it was never a valid code to start with.

The exchange should prevent "double-spending" by making sure that the "look up whether code is spent; credit account; make code as spent" sequence is an atomic operation. We don't want two users both running through that same sequence at the same time, where both pass the "look up whether code is spent" check, then both accounts get credited, etc.

share|improve this answer
    
So, if you accept a code as payment for anything, you should immediately redeem it before handing over the goods, right? (And if you pay with these codes, you have to accept that this is how it works. Or can you go back to MtGox to complain in case the seller did not deliver?) –  Thilo Mar 13 '12 at 5:06
    
I've seen cases where people use a trusted 3rd party for this, as follows: I send the goods to the 3rd party, you send me a Gox code, I try redeeming it and if it's good I tell the 3rd party to send the goods to you. You can think of redeemable codes as similar to Bitcoins themselves; whoever spends them first gets to spend them, and you're unlikely to be able to force anyone to reverse the transaction. I don't know how MtGox would be able to deal with complaints that the seller didn't deliver. They wouldn't know who to believe. –  Chris Moore Mar 13 '12 at 5:12
    
@Thilo: Mtgox aren't currently offering an escrow service. –  Meni Rosenfeld Mar 13 '12 at 10:48

They are bearer instruments. Whomever redeems the code first gets the funds associated with the code.

They are meant to allow USDs or bitcoins to be traded from one account to another. Third party intermediaries, such as BitInstant or other exchanges themselves may accept them.

There are risks to these. http://www.bitcoinmoney.com/post/18506669111

share|improve this answer
1  
+1 excellent link –  Thilo Mar 13 '12 at 12:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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