<p>The correct way to do this (beware: extremely technical) is to:</p>

<ol>
<li>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!).</li>
<li>Create an address for the auction's winning bid (the "auction address"). This can be a normal address, escrow address, or whatever.</li>
<li>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.</li>
<li>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.</li>
<li>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.</li>
</ol>

CC BY-SA 3.0
2013-11-24T10:13:03.590Z
+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
CC BY-SA 3.0
2013-11-27T06:13:48.163Z
Yes, 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 Dashjr
CC BY-SA 3.0
2013-11-24T06:05:33.020Z
2013-11-24T06:05:33.020Z
Luke Dashjr
<p>I am new to bitcoin programming, and want to build some apps to get more familiar with it. </p>

<p>What I am curious is, how could I implement a basic auction site. </p>

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

<ul>
<li><p>There would be a countdown for the bidding. Users can then send bitcoins to me (or say they will pay that amount?)</p></li>
<li><p>The person that has said they will pay the most at the end wins and everyone else gets their bitcoins back.</p></li>
</ul>

<p>Some things that worry me:</p>

<p>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.</p>

<p>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.</p>

<p>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?</p>

<p>Any help/thoughts would be awesome!</p>

<transactions><payment><website-integration>
How to make sure that bidders in an auction have sufficient Bitcoin without storing money for them?
Jonovono
# How to make sure that bidders in an auction have sufficient Bitcoin without storing money for them?

(Asked by: username_0 on 2013-11-24)

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!

**Tags:** transactions, payment, website-integration


---

## 1 answers

### Answer by username_1 on 2013-11-24. Score: 8

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.

> **Comments:**
> **username_2**: +1 Wow, that is really clever. However, wouldn't the bidders have to create a raw-transaction to add your coin to the inputs?  
> **username_1**: Yes, 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.)  

---

