class BlockHeaderSerializer(Serializer): """The serializer for the block header.""" model_class = BlockHeader version = fields.UInt32LEField() prev_block = fields.Hash() merkle_root = fields.Hash() timestamp = fields.UInt32LEField() bits = fields.UInt32LEField() nonce = fields.UInt32LEField() txns_count = fields.VariableIntegerField()
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) blocksig = fields.VariableIntegerField()
class RejectSerializer(Serializer): model_class = Reject message = fields.VariableStringField() ccode = fields.FixedStringField(1) reason = fields.VariableStringField() data = fields.Hash()
class GetBlocksSerializer(Serializer): model_class = GetBlocks version = fields.UInt32LEField() hash_count = fields.VariableIntegerField() block_hashes = fields.BlockLocator() hash_stop = fields.Hash()
class OutPointSerializer(Serializer): """The OutPoint representation serializer.""" model_class = OutPoint out_hash = fields.Hash() index = fields.UInt32LEField()
class InventorySerializer(Serializer): """The serializer for the Inventory.""" model_class = Inventory inv_type = fields.UInt32LEField() inv_hash = fields.Hash()