Beispiel #1
0
    def deserialize(cls, chain: list):
        """
        Create a new Blockchain instance from the provided serialized chain.

        :param list chain: serialized chain of blocks.
        :return Blockchain: blockchain created from provided stringified chain.
        """
        chain = list(map(lambda block: Block.deserialize(block), chain))
        return cls(chain)
Beispiel #2
0
 def test_block_deserialization(self):
     block = self.first_block.serialize()
     self.assertIsInstance(Block.deserialize(block), Block)