Braydon Fuller @Braydon Fuller - 11d
I implemented this once in bitcoind, once with nodejs and another time in bcoin. The architecture in bcoin with plugins I think was the best and could run in a seperate asynchronous task (not part of consensus code), it could also be extended to index (or count) anything, types of scripts used, fees and other info.
We also used plugins for blockfilters, if I remember correctly.