How to make sure that bidders in an auction have sufficient Bitcoin without storing money for them?



I am new to bitcoin programming, and want to build some apps to get more familiar with it.

What I am curious is, how could I implement a basic auction site.

I want to make it as automated as possible. So, the basic process would be:

  • There would be a countdown for the bidding. Users can then send bitcoins to me (or say they will pay that amount?)

  • The person that has said they will pay the most at the end wins and everyone else gets their bitcoins back.

Some things that worry me:

I want it to be secure. Ideally, to bid I don't have to store all of your bitcoins on my server while the auction is on, but I still want to make sure you have the amount needed to bid. Is that possible? One way, like many seem to do, is to have users load up an account with bitcoins and then bid, but ideally, I'd like to not have to store the users bitcoins just in case they do not want to trust me.

Whatever happens, I want it to be automated. So at the end all the users get their coins back that lost, the winner automatically gets their bid taken from them.

Any thoughts on this? It looks like something like this could be implemented with Bitcoin Scripts but those are not quite implemented fully yet, correct?

Any help/thoughts would be awesome!


Posted 2013-11-24T00:12:17.987

Reputation: 181

Consider using escrow (multi-signature) transactions, such that bidders demonstratably commit their bid, but the seller cannot receive the bid until someone else (auctioner? or maybe the bidder himself after verifying everyone else's bid has been released for return?) approves it. – pyramids – 2013-11-24T04:25:54.763



The correct way to do this (beware: extremely technical) is to:

  1. Reserve a coin of your own for each auction (the "auction coin"). This shouldn't be too big (you will lose it until the auction is over), but try not to make a dedicated one just for the sake of the auction (use a small one you already have!).
  2. Create an address for the auction's winning bid (the "auction address"). This can be a normal address, escrow address, or whatever.
  3. Bidders should create a raw transaction consuming this coin as an input, and paying to the auction address. They should sign the transaction for all their own coins (added to the auction coin), and send this to you immediately to place their bid.
  4. When the auction is over, you then sign the highest bid's transaction for the input consuming the auction coin, and broadcast it to the network. Note that this will invalidate all the other bid transactions you were sent.
  5. As soon as this winning bid confirms, you deliver the auctioned product. If it is double-spent, you then pick the next highest bid and repeat step 4.


Posted 2013-11-24T00:12:17.987

Reputation: 1 082

1+1 Wow, that is really clever. However, wouldn't the bidders have to create a raw-transaction to add your coin to the inputs? – Murch – 2013-11-24T10:13:03.590

1Yes, hopefully future wallets will support this directly, but for now you'd probably need to distribute software that uses the RPC interface to do it for people - or patches. (Obviously you'd need to make this part open source so trusted third parties could review it.) – Luke-Jr – 2013-11-27T06:13:48.163