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 GetBlocksSerializer(Serializer): model_class = GetBlocks version = fields.UInt32LEField() hash_count = fields.VariableIntegerField() block_hashes = fields.BlockLocator() hash_stop = fields.Hash()