public NodeModule(SyncFacade facade) { Get["/blockchain.json"] = _ => { var chain = facade.SyncLocal(); var serializer = new JavaScriptSerializer(); return(serializer.Serialize(chain.Blocks)); }; }
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(); }
private static void SyncOverAll(string obj) { var sf = new SyncFacade(); sf.SyncOverall(); }