Associating a bitcoin address with a user in a shared wallet

1

How can I associate a transaction with a unique user in a shared online wallet? It makes no sense to have one wallet account per user in the shared wallet as it would degrade performance (say I have 1M users).

Thus, I need to have bitcoind running in parallel with a database that hosts all the users and when a transaction comes in update the balance of the particular user.

My question is: how do I identify with which user this transaction is associated?

user11286

Posted 2014-01-02T09:00:38.217

Reputation: 95

Answers

1

You generate and store the receiving bitcoin addresses of each user in the database. Then you poll bitcoind for new transactions for the all the receiving address you have in your database. When the receiving bitcoin address has incoming transaction, then you follow the relation from the receiving bitcoin address to the user and then credit the transaction on the user's database balance.

Some of this is covered in my tutorial Accepting bitcoins in Django application.

Mikko Ohtamaa

Posted 2014-01-02T09:00:38.217

Reputation: 2 417

Can each user have their own private key or can I only use the private key(s) on the bitcoind pool for creating receiving addresses for each user?user11286 2014-01-02T09:20:47.193

The simplest way is to let bitcoind to create the addresses. Alternatively there is something called "deterministic wallets" where private and public keys can be derived from (the user specific) seed: https://github.com/richardkiss/pycoin

Mikko Ohtamaa 2014-01-02T10:03:28.653

0

create a table in the db named user_addresses if the user clicks on generate address first query the db if the user have any address stored with his ID if yes show that address to the user if not query the bitcoin daemon with RPC

public function GetDepositAddress($account)
    {
            return $this->Client->getaccountaddress($account);
    }

where $account has the username of the user generating this address this way you can use single daemon to host multiple addresses

Khan Shahrukh

Posted 2014-01-02T09:00:38.217

Reputation: 437