consensus lib work: split stream classes out of serialize.h

serialization now has no dependencies.