Modularizing Counterblockd functionality & plugin interface for third-party modules

Cleaner version of https://github.com/CounterpartyXCP/counterblockd/pull/79. Also started on some tests using MongoDB collection hashes.