<p><code>getnewaddress</code> will generate a new Bitcoin address for your existing wallet, Yes you can get as many as you like.  </p>

<p>I would use <code>getreceivedbyaddress</code> which returns the total amount received by the specified address in transactions with the specified number of confirmations or <code>listunspent</code> to get all transactions for specific address with confirmations</p>

<p>AFAICT, You can't remove an address from your wallet using any RPC call, but by editing wallet.dat manually. </p>

CC BY-SA 3.0
2018-03-13T14:50:59.893Z
2018-03-13T14:50:59.893Z
Tailer
<p>I'm writing a web application that will require subscription fees from users. I'd like to automate this process without relying heavily on 3rd party services (web-based wallets, etc).</p>

<p>Currently, this is how it is designed:</p>

<ul>
<li>Web app connects to a websocket on the server using a JWT bearer token for authentication and requests an address.</li>
<li>The server calls the <code>getnewaddress</code> method to the RPC daemon and returns this address over the websocket</li>
<li>The wallet's pub (is priv necessary?) keys are stored in the webapp's database as well as the user that requested the address.</li>
<li>The websocket will provide periodic progress updates along with a refreshed JWT (tokens expire every 2 minutes) while waiting for the transaction. If the user disconnects, no harm done.</li>
</ul>

<p>Once the transaction is completed, a <code>curl</code> command is triggered by <code>walletnotify</code> and submits this TXID to the web server, which ensures "confirmations" are > 0, and the "receive" address is used as the database query to determine which user added time to his/her subscription.</p>

<p>Questions:</p>

<ul>
<li>Does <code>getnewaddress</code> generate a new wallet? Or am I free to receive as many as I'd like?</li>
<li>Running <code>getbalance &lt;account&gt;</code> shows the summation of all addresses listed in <code>listaddressgroupings</code>. Is this all usable from the same wallet?</li>
<li>How can I consolidate or remove addresses when they're no longer necessary? Do the BTC stay in the "account"?</li>
</ul>

CC BY-SA 3.0
2018-03-13T23:52:51.270Z
Quick comment: generally it is not advisable to remove a bitcoin address/keypair from the wallet entirely (unless perhaps it is a BIP32 wallet and you have the seed and derivation saved). Keypairs are not very data intensive to store, the benefits of keeping them probably outweigh the risks of having someone reuse an old address, and then have the funds be unrecoverable because a keypair was deleted.
chytrik
<address-generation><payment-processors>
Subscription-based payments
Goodies
# Subscription-based payments

(Asked by: username_0 on 2018-03-13)

I'm writing a web application that will require subscription fees from users. I'd like to automate this process without relying heavily on 3rd party services (web-based wallets, etc).

Currently, this is how it is designed:

* Web app connects to a websocket on the server using a JWT bearer token for authentication and requests an address.
* The server calls the `getnewaddress` method to the RPC daemon and returns this address over the websocket
* The wallet's pub (is priv necessary?) keys are stored in the webapp's database as well as the user that requested the address.
* The websocket will provide periodic progress updates along with a refreshed JWT (tokens expire every 2 minutes) while waiting for the transaction. If the user disconnects, no harm done.

Once the transaction is completed, a `curl` command is triggered by `walletnotify` and submits this TXID to the web server, which ensures "confirmations" are > 0, and the "receive" address is used as the database query to determine which user added time to his/her subscription.

Questions:

* Does `getnewaddress` generate a new wallet? Or am I free to receive as many as I'd like?
* Running `getbalance`  shows the summation of all addresses listed in `listaddressgroupings`. Is this all usable from the same wallet?
* How can I consolidate or remove addresses when they're no longer necessary? Do the BTC stay in the "account"?

**Tags:** address-generation, payment-processors

> **Comments:**
> **username_1**: Quick comment: generally it is not advisable to remove a bitcoin address/keypair from the wallet entirely (unless perhaps it is a BIP32 wallet and you have the seed and derivation saved). Keypairs are not very data intensive to store, the benefits of keeping them probably outweigh the risks of having someone reuse an old address, and then have the funds be unrecoverable because a keypair was deleted.  

---

## 1 answers

### Answer by username_2 on 2018-03-13. Score: 1

`getnewaddress` will generate a new Bitcoin address for your existing wallet, Yes you can get as many as you like.

I would use `getreceivedbyaddress` which returns the total amount received by the specified address in transactions with the specified number of confirmations or `listunspent` to get all transactions for specific address with confirmations

AFAICT, You can't remove an address from your wallet using any RPC call, but by editing wallet.dat manually.


---

