The calculations are done on all nodes that run the blockchain. This includes witness nodes, seed nodes, and API nodes.