예제 #1
0
        public IActionResult Index()
        {
            var prevBlock = _myChain.PrivousBlock();
            var proff     = _myChain.ProffOfWork(prevBlock.Proff);
            var prevHash  = _myChain.HashBlock(prevBlock);
            var block     = _myChain.CreateBlock(prevHash, proff);

            if (block != null)
            {
                return(Accepted(new
                {
                    message = "Winner, Winner Chick Dinner!",
                    index = block.Index,
                    Transaction = block.TransactionList,
                    timeStamp = block.TimeSpame,
                    proff = block.Proff,
                    prevHash = block.PreviousHash
                }));
            }

            return(BadRequest());
        }