class TxSerializer(Serializer): """The transaction serializer.""" model_class = Tx version = fields.UInt32LEField() tx_in = fields.ListField(TxInSerializer) tx_out = fields.ListField(TxOutSerializer) lock_time = fields.UInt32LEField()
class BlockSerializer(Serializer): """The deserializer for the blocks.""" model_class = Block version = fields.UInt32LEField() prev_block = fields.Hash() merkle_root = fields.Hash() timestamp = fields.UInt32LEField() bits = fields.UInt32LEField() nonce = fields.UInt32LEField() txns = fields.ListField(TxSerializer)
class HeaderVectorSerializer(Serializer): """Serializer for the block header vector.""" model_class = HeaderVector headers = fields.ListField(BlockHeaderSerializer)
class NotFoundSerializer(Serializer): """Serializer for the NotFound message.""" model_class = NotFound inventory = fields.ListField(InventorySerializer)
class GetDataSerializer(Serializer): """Serializer for the GetData command.""" model_class = GetData inventory = fields.ListField(InventorySerializer)
class AddressVectorSerializer(Serializer): """Serializer for the addresses vector.""" model_class = AddressVector addresses = fields.ListField(IPv4AddressTimestampSerializer)
class InventoryVectorSerializer(Serializer): """The serializer for the vector of inventories.""" model_class = InventoryVector inventory = fields.ListField(InventorySerializer)