public static BlockChain ToBlockChain(this string json) { json.Verify(nameof(json)).IsNotEmpty(); var blockChainModel = JsonConvert.DeserializeObject <BlockChainModel>(json); blockChainModel.Blocks.Verify(nameof(blockChainModel.Blocks)).IsNotNull(); var list = new List <BlockNode>(); foreach (var node in blockChainModel.Blocks !) { BlockNode blockNode = node.ConvertTo(); list.Add(blockNode); } return(new BlockChain(list)); }
public BlockNode(BlockNode blockNode) : this(blockNode.BlockData, blockNode.Index, blockNode.PreviousHash !) { }