Exemple #1
0
 public NodeModule(SyncFacade facade)
 {
     Get["/blockchain.json"] = _ =>
     {
         var chain      = facade.SyncLocal();
         var serializer = new JavaScriptSerializer();
         return(serializer.Serialize(chain.Blocks));
     };
 }
Exemple #2
0
        private static void MineBlock(string obj)
        {
            var sf = new SyncFacade();

            new Genesis().GenerateFirstBlockIfNotExist();
            var currentChain = sf.SyncLocal();
            var lastBlock    = currentChain.Last();
            var minedBlock   = MiningFacade.Mine(lastBlock);

            minedBlock.Save();
        }
Exemple #3
0
        private static void SyncOverAll(string obj)
        {
            var sf = new SyncFacade();

            sf.SyncOverall();
        }