This expenditure of energy is done through the computation …
This expenditure of energy is done through the computation of a cryptographic hash; a one-way process that turns a signal into noise that is unique to that signal, like a fingerprint. The higher the difficulty, the more hashes must be computed.