If you want to programmatically create transactions for accounts where you have the private key, you can call the web3.eth.accounts.signTransaction
function to create a transaction using web3.js:
web3.eth.accounts.signTransaction(tx, privateKey [, callback]);
This will return a rawTransaction
string which can be directly sent to the network using web3.eth.sendSignedTransaction
:
web3.eth.sendSignedTransaction(signedTransactionData [, callback])
Getting the balance of the account should be even simpler. Just call web3.eth.getBalance
for the public address you have for that account:
web3.eth.getBalance(address [, defaultBlock] [, callback])
I hope this helps!