How to fetch the latest unspent transaction by an address using bitcoind?
Bitcoind does not index transactions for non-wallet addresses. If you wish to build this yourself, you will need to:


Enable txindex=1 in your bitcoin.conf
Rescan the chain
Set up blocknotify and then parse the chain block by block, building an index of which outputs have been spent, and which haven't, and which addresses are involved in each transaction


Then, when working with a specific address, you first query your database for all unspent outputs, and then can use getrawtransaction to get the unspent tx information (although, you could store enough information in your index to not need to make the getrawtransaction call).

Alternatively, you can run something such as ElectrumX or insight, which will do all of the above for you.