Serialization and deserialization of the getdata, tx and block messages