/** * Create genesis block **/ public static Block GenesisBlock(IList <Transaction> transactions) { var startTimer = DateTime.UtcNow; var ts = Utils.GetTime(); //21 june 2017 // for genesis bloc we set creatoris first of Genesis Account var validator = Genesis.GetAll().FirstOrDefault(); var block = new Block { Height = 1, TimeStamp = ts, PrevHash = "-", Transactions = transactions, Validator = validator.Address }; block.Build(); //block size var str = JsonSerializer.Serialize(block); block.Size = str.Length; // get build time var endTimer = DateTime.UtcNow; var buildTime = endTimer - startTimer; block.BuildTime = buildTime.Milliseconds; // end of return(block); }
/** * create transaction for each ico account **/ public static void CreateGenesisTransction() { var timeStamp = Utils.GetTime(); foreach (var acc in Genesis.GetAll()) { var newTrx = new Transaction() { TimeStamp = timeStamp, Sender = "Genesis", Recipient = acc.Address, Amount = acc.Balance, Fee = 0.0f, Height = 1 }; newTrx.Build(); AddToPool(newTrx); } }