0
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
getnewaddressmethod 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
getnewaddressgenerate 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"?
2Quick 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 – 2018-03-13T23:52:51.270