I'm trying to build out a wallet service and need to figure out how to use the monero rpc commands to update a users balance. In my database, I have a bunch of user's private keys. How do I update each user's balance using only the rpc? Do I pass in the private key into the rpc command and it spits back out the balance for me?
First, I'd suggest thinking harder about your design choice of holding users private keys. If you're going to have full custody of users wallets, it begs the question why have per-user wallets in the first place. It's your wallet if you hold the keys, so you could just just assign accounts/subaddress to customers for example.
Second, if you're going to ignore my first point... You cannot use the
monerod RPC as it's the node daemon, it doesn't offer wallet level functionality. You also cannot use the
monero-wallet-rpc with raw private keys - it operates on a wallet file. Therefore, you would need to restore each wallet file from the supplied keys using
monero-wallet-cli, then you can use the
monero-wallet-rpc on each wallet file - either use multiple processes, so you have each wallet permanently opened/running, or use one process and the open/close methods to open/close each wallet file as needed.