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 <account>
shows the summation of all addresses listed inlistaddressgroupings
. 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"?