<p>In the past, I've implemented this just by asking the standard Bitcoin client to generate a few thousand addresses and then just have the web site give them out one by one. It's a bit slow generating the addresses, but if you let it run overnight, you'll have a virtually unlimited supply.</p>

<p>Don't forget to backup the wallet immediately after doing this!</p>

CC BY-SA 3.0
2011-09-09T13:25:23.270Z
Also there's a [Lazy API](https://en.bitcoin.it/wiki/Lazy_API) which seems like an easy way to get going.
Ian Purton
CC BY-SA 3.0
2011-09-09T00:26:54.343Z
2011-09-09T00:26:54.343Z
David Schwartz
<p>This is an excellent service for precisely what you're seeking:  <a href="http://www.bitcoinpayflow.com/" rel="nofollow">http://www.bitcoinpayflow.com/</a></p>

CC BY-SA 3.0
2011-09-10T17:59:55.993Z
2011-09-10T17:59:55.993Z
Erik Voorhees
<p>You will need bitcoin-python:
<a href="https://github.com/toomanysecrets0/bitcoin-python" rel="nofollow">https://github.com/toomanysecrets0/bitcoin-python</a></p>

<p>You will also need MySQLdb</p>

<p>Here's something that should work on a LAMP(ython) server  I would sanitize the inputs before putting this in production use though:</p>

<pre><code>#!/usr/bin/env python    

import MySQLdb
import bitcoin
import cgi

DbHost   = "localhost"
DbDatabase = "database name"
DbUser   = "database user"
DbPassword = "database password"

def getAddress(idnumber):

    db = MySQLdb.connect(host=DbHost, user=DbUser, passwd=DbPassword ,db=DbDatabase)

    c=db.cursor()

    c.execute("SELECT * FROM `address` WHERE idnumber=" + "'" + str(idnumber) + "'")

    address = c.fetchone()

    if  address != None:
        returnaddress = address[1]

    else:
        c.execute("SELECT username,idnumber FROM `address` where idnumber=" + "'" + str(idnumber) + "'")
        user = c.fetchone()    
        if  user != None:
            userid = user[0]
            #Generate a new bitcoin address
            newaddress = generateAddress(userid)
            returnaddress = newaddress


            c.execute("INSERT INTO address(idnumber,receiving_address,username) VALUES(" + str(idnumber) + "," + "'" + str(newaddress) + "'" + "," + str(userid) + ")")
    else:
        return "Invalid userid"

return returnaddress
</code></pre>

CC BY-SA 3.0
2011-09-11T19:59:07.250Z
2011-09-11T20:06:27.097Z
2011-09-11T20:06:27.097Z
Justin Weeks
<p>Combine the suggestion from @David of pregenerating lots of address with <a href="https://bitcoinnotify.com/" rel="nofollow">Bitcoin Notify</a> and you can build a system that knows when someone has sent you bitcoins (as part of a checkout process, etc).</p>

CC BY-SA 3.0
2011-09-10T14:40:33.500Z
2011-09-10T14:40:33.500Z
Erv Walter
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="https://bitcoin.stackexchange.com/questions/126/how-can-i-accept-bitcoins-on-my-website">How can I accept bitcoins on my website?</a>  </p>
</blockquote>



<p>I have a few websites I am working on, but is there an open source code I can use that will allow people to deposit bitcoins on my site to where each user would have a unique deposit address?</p>

CC BY-SA 3.0
2011-09-08T23:14:21.217Z
Are you trying to figure out if there's open source code to setup something like mybitcoin?  I'm guessing you want to have just one wallet, but have people be able to deposit/withdraw just their bitcoins?  

Some clarification on your question would help.
tysat
<transactions><client>
Is there an open source (free) client or code for bitcoin transactions
midixiewreck
# Is there an open source (free) client or code for bitcoin transactions

(Asked by: username_0 on 2011-09-08)

> **Possible Duplicate:**  
> [How can I accept bitcoins on my website?](https://bitcoin.stackexchange.com/questions/126/how-can-i-accept-bitcoins-on-my-website)

I have a few websites I am working on, but is there an open source code I can use that will allow people to deposit bitcoins on my site to where each user would have a unique deposit address?

**Tags:** transactions, client

> **Comments:**
> **username_1**: Are you trying to figure out if there's open source code to setup something like mybitcoin?  I'm guessing you want to have just one wallet, but have people be able to deposit/withdraw just their bitcoins?    Some clarification on your question would help.  

---

## 4 answers

### Answer by username_2 on 2011-09-09. Score: 0

In the past, I've implemented this just by asking the standard Bitcoin client to generate a few thousand addresses and then just have the web site give them out one by one. It's a bit slow generating the addresses, but if you let it run overnight, you'll have a virtually unlimited supply.

Don't forget to backup the wallet immediately after doing this!

> **Comments:**
> **username_3**: Also there's a [Lazy API](https://en.bitcoin.it/wiki/Lazy_API) which seems like an easy way to get going.  

---

### Answer by username_4 on 2011-09-10. Score: 0

This is an excellent service for precisely what you're seeking: <http://www.bitcoinpayflow.com/>


---

### Answer by username_5 on 2011-09-11. Score: 0

You will need bitcoin-python:
<https://github.com/toomanysecrets0/bitcoin-python>

You will also need MySQLdb

Here's something that should work on a LAMP(ython) server I would sanitize the inputs before putting this in production use though:

```
#!/usr/bin/env python    

import MySQLdb
import bitcoin
import cgi

DbHost   = "localhost"
DbDatabase = "database name"
DbUser   = "database user"
DbPassword = "database password"

def getAddress(idnumber):

    db = MySQLdb.connect(host=DbHost, user=DbUser, passwd=DbPassword ,db=DbDatabase)

    c=db.cursor()

    c.execute("SELECT * FROM `address` WHERE idnumber=" + "'" + str(idnumber) + "'")

    address = c.fetchone()

    if  address != None:
        returnaddress = address[1]

    else:
        c.execute("SELECT username,idnumber FROM `address` where idnumber=" + "'" + str(idnumber) + "'")
        user = c.fetchone()    
        if  user != None:
            userid = user[0]
            #Generate a new bitcoin address
            newaddress = generateAddress(userid)
            returnaddress = newaddress

            c.execute("INSERT INTO address(idnumber,receiving_address,username) VALUES(" + str(idnumber) + "," + "'" + str(newaddress) + "'" + "," + str(userid) + ")")
    else:
        return "Invalid userid"

return returnaddress

```


---

### Answer by username_6 on 2011-09-10. Score: 0

Combine the suggestion from @username_2 of pregenerating lots of address with [Bitcoin Notify](https://bitcoinnotify.com/) and you can build a system that knows when someone has sent you bitcoins (as part of a checkout process, etc).


---

