Step-by-step: How to build a block counter