Create Proof(OfWork) class

Continues #4377
The goal of this PR is to make easier to experiment on alternative proofs and at the same time improve bitcoind's modularity.  IT is very possible that this will never make it into master, and that's fine, but ideally it would be very easy to maintain the branch by continuously rebasing on top of bitcoin/master.
I open this as a PR to get some feedback on what's acceptable for master and what is not, and maybe also to improve the code (specially the ugly hack for the serialization, which apparently doesn't work anyway).
It should also help understand #4377 better. 
@jaromil is going to work on an alternative using function pointers.