<blockquote>
  <p>So, I've started <code>bitcoind</code> and through <code>bitcoin-cli</code>, I've generated new address(<code>bitcoin-cli getnewaddress "USEREMAILID"</code>) and assigned it to the users.</p>
</blockquote>

<p>Please don't do this. You are using the accounts system in Bitcoin Core which is deprecated, slightly unreliable/has weird behavior, and will be removed in the future.</p>

<p>Maintain your own accounting system outside of Bitcoin Core. Just have a database with addresses and their associated user.</p>

<blockquote>
  <p>Now my question is, whenever user starts buying a product, he will execute command (<code>bitcoin-cli sendfrom</code>) and for doing that, </p>
</blockquote>

<p>Why? Why don't you just change their balance on the website and just leave the coins there? There is no need to make actual transactions that move the coins to you, just change it internally.</p>

<blockquote>
  <p>we need to first <code>unlock the wallet by walletpassphrase</code> and then do the transaction. so, there would be <code>only 1 password which is assigned to the wallet but not every address</code>.</p>
</blockquote>

<p>No, that is not how Bitcoin Core, addresses, or accounts work. Accounts are not wallets. All of the addresses for all of the accounts belong to the same wallet. Unless you are using Bitcoin Core 0.15+ and have enabled the use of multiwallet, you are only using one wallet in Bitcoin Core. So there is only one passphrase to be used with <code>walletpassphrase</code> and it unlocks the entire wallet which includes all of the addresses you have given out on your website.</p>

<blockquote>
  <p>Is this the correct way?</p>
</blockquote>

<p>No, it is not.</p>

<p>The correct way is to maintain a separate database with user accounts, associated addresses, and account balance. When you transfer coins internally (i.e. from one user to another or from one user to you), update the balances in that database instead of making a Bitcoin transaction. When you want to send coins externally (i.e. user withdraws) then you send from the Bitcoin Core wallet and update your own database. When you send, just use <code>sendtoaddress</code>. Do not use Bitcoin Core's accounts system and don't try to make it so that you are sending from certain addresses.</p>

<blockquote>
  <p>If user needs to enter his <code>custom password</code> and then process the transaction, would it be possible?</p>
</blockquote>

<p>No, as I explained above, that is not how this works.</p>

CC BY-SA 3.0
2017-09-29T17:44:07.167Z
2017-09-29T17:44:07.167Z
Ava Chow
<p>I need a system where I need to create <code>new address for every user</code>(personal account) where they will <code>transfer some bitcoins</code> to it and <code>buy some products</code> from my website.</p>

<p>So, I've started <code>bitcoind</code> and through <code>bitcoin-cli</code>, I've generated new address(<code>bitcoin-cli getnewaddress "USEREMAILID"</code>) and assigned it to the users.  </p>

<p>Now the users will buy some products on my website (i.e. transfer amount from their account to company's account) and then the transfer happens and based on the confirmations, the product will be purchased.  </p>

<p>Now my question is, whenever user starts buying a product, he will execute command (<code>bitcoin-cli sendfrom</code>) and for doing that, we need to first <code>unlock the wallet by walletpassphrase</code> and then do the transaction. so, there would be <code>only 1 password which is assigned to the wallet but not every address</code>.  </p>

<p>Is this the correct way?  </p>

<p>If user needs to enter his <code>custom password</code> and then process the transaction, would it be possible?</p>

<transactions><bitcoin-core><bitcoind><address><passphrase>
bitcoind password for every address
RealSteel
# bitcoind password for every address

(Asked by: username_0 on 2017-09-29)

I need a system where I need to create `new address for every user`(personal account) where they will `transfer some bitcoins` to it and `buy some products` from my website.

So, I've started `bitcoind` and through `bitcoin-cli`, I've generated new address(`bitcoin-cli getnewaddress "USEREMAILID"`) and assigned it to the users.

Now the users will buy some products on my website (i.e. transfer amount from their account to company's account) and then the transfer happens and based on the confirmations, the product will be purchased.

Now my question is, whenever user starts buying a product, he will execute command (`bitcoin-cli sendfrom`) and for doing that, we need to first `unlock the wallet by walletpassphrase` and then do the transaction. so, there would be `only 1 password which is assigned to the wallet but not every address`.

Is this the correct way?

If user needs to enter his `custom password` and then process the transaction, would it be possible?

**Tags:** transactions, bitcoin-core, bitcoind, address, passphrase


---

## 1 answers

### Answer by username_1 on 2017-09-29. Score: 1 | Accepted answer

> So, I've started `bitcoind` and through `bitcoin-cli`, I've generated new address(`bitcoin-cli getnewaddress "USEREMAILID"`) and assigned it to the users.

Please don't do this. You are using the accounts system in Bitcoin Core which is deprecated, slightly unreliable/has weird behavior, and will be removed in the future.

Maintain your own accounting system outside of Bitcoin Core. Just have a database with addresses and their associated user.

> Now my question is, whenever user starts buying a product, he will execute command (`bitcoin-cli sendfrom`) and for doing that,

Why? Why don't you just change their balance on the website and just leave the coins there? There is no need to make actual transactions that move the coins to you, just change it internally.

> we need to first `unlock the wallet by walletpassphrase` and then do the transaction. so, there would be `only 1 password which is assigned to the wallet but not every address`.

No, that is not how Bitcoin Core, addresses, or accounts work. Accounts are not wallets. All of the addresses for all of the accounts belong to the same wallet. Unless you are using Bitcoin Core 0.15+ and have enabled the use of multiwallet, you are only using one wallet in Bitcoin Core. So there is only one passphrase to be used with `walletpassphrase` and it unlocks the entire wallet which includes all of the addresses you have given out on your website.

> Is this the correct way?

No, it is not.

The correct way is to maintain a separate database with user accounts, associated addresses, and account balance. When you transfer coins internally (i.e. from one user to another or from one user to you), update the balances in that database instead of making a Bitcoin transaction. When you want to send coins externally (i.e. user withdraws) then you send from the Bitcoin Core wallet and update your own database. When you send, just use `sendtoaddress`. Do not use Bitcoin Core's accounts system and don't try to make it so that you are sending from certain addresses.

> If user needs to enter his `custom password` and then process the transaction, would it be possible?

No, as I explained above, that is not how this works.


---

