A general framework for blockchain analytics