for detecting offline hosts what you'd do is you'd check off each host as you integrate it's heartbeat. If the heartbeat is invalid, you don't check off the host.

At the beginning, you'll have a map of all hosts (copied from your list of which hosts are in your blockchain).

At the end, you'll have a map of only hosts that didn't have a valid heartbeat.

There could be better ways to do this.