static void Main(string[] args) { Console.WriteLine(BlockcoreLogo.GetAsciiLogo("Genesis Block Generator v1.0")); if (args.Length == 0) { Console.WriteLine("You must supply one, and only one argument, which is the genesis coinbase text."); Console.WriteLine("Example: 'Blockcore.Generator The Times 03/Jan/2009 Chancellor on brink of second bailout for banks'"); Console.ReadLine(); return; } string coinbasetext = string.Join(' ', args); Console.WriteLine($"Generating new set of genesis blocks with text: \"{coinbasetext}\""); Console.WriteLine("This operation might take a while, the output file is saved when everything is completed."); Console.WriteLine(); List <GenesisBlock> networks = new List <GenesisBlock>(); Console.WriteLine("Generating Main Genesis Block..."); Block block = Network.MineGenesisBlock(new PosConsensusFactory(), coinbasetext, new Target(new uint256("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")), Money.Zero); networks.Add(new GenesisBlock("Main", block)); Console.WriteLine("Generating RegTest Genesis Block..."); block = Network.MineGenesisBlock(new PosConsensusFactory(), coinbasetext, new Target(new uint256("0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")), Money.Zero); networks.Add(new GenesisBlock("RegTest", block)); Console.WriteLine("Generating Test Genesis Block..."); block = Network.MineGenesisBlock(new PosConsensusFactory(), coinbasetext, new Target(new uint256("000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")), Money.Zero); networks.Add(new GenesisBlock("TestNet", block)); System.IO.File.WriteAllText("genesis.json", JsonSerializer.Serialize( new GeneratorOutput { CoinBaseText = coinbasetext, Networks = networks }, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, WriteIndented = true })); Console.WriteLine("Generation completed, output written to genesis.json"); Console.WriteLine("Press any key to exit."); Console.Read(); }
static void Main(string[] args) { Console.WriteLine(BlockcoreLogo.GetAsciiLogo("Genesis Block Generator v1.0")); if (args.Length != 1) { Console.WriteLine("You must supply one, and only one argument, which is the genesis coinbase text."); Console.ReadLine(); return; } string coinbasetext = args[0]; Console.WriteLine($"Generating new set of genesis blocks with text: \"{coinbasetext}\""); Console.WriteLine("This operation might take a while, the output file is saved when everything is completed."); Console.WriteLine(); List <string> contents = new List <string>(); Console.WriteLine("Generating Main Genesis Block..."); Block block = Network.MineGenesisBlock(new PosConsensusFactory(), coinbasetext, new Target(new uint256("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")), Money.Zero); contents.Add("Genesis Blocks Generated by Blockcore Genesis Block Generator v1.0."); contents.Add("https://www.blockcore.net"); contents.Add(""); contents.Add("CoinBase Text: " + coinbasetext); contents.Add("Generation Date: " + DateTime.Now); contents.Add(""); contents.Add("MAIN GENESIS BLOCK:"); contents.Add(" Time: " + block.Header.Time); contents.Add(" Nonce: " + block.Header.Nonce); contents.Add(" Bits: " + block.Header.Bits.ToCompact().ToString("X2")); contents.Add(" Version: " + block.Header.Version); contents.Add(" Hash: " + block.Header.ToString()); contents.Add(" Hash Merkle Root: " + block.Header.HashMerkleRoot); contents.Add(""); Console.WriteLine("Generating RegTest Genesis Block..."); block = Network.MineGenesisBlock(new PosConsensusFactory(), coinbasetext, new Target(new uint256("0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")), Money.Zero); contents.Add("REGTEST GENESIS BLOCK:"); contents.Add(" Time: " + block.Header.Time); contents.Add(" Nonce: " + block.Header.Nonce); contents.Add(" Bits: " + block.Header.Bits.ToCompact().ToString("X2")); contents.Add(" Version: " + block.Header.Version); contents.Add(" Hash: " + block.Header.ToString()); contents.Add(" Hash Merkle Root: " + block.Header.HashMerkleRoot); contents.Add(""); Console.WriteLine("Generating Test Genesis Block..."); block = Network.MineGenesisBlock(new PosConsensusFactory(), coinbasetext, new Target(new uint256("000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")), Money.Zero); contents.Add("TEST GENESIS BLOCK:"); contents.Add(" Time: " + block.Header.Time); contents.Add(" Nonce: " + block.Header.Nonce); contents.Add(" Bits: " + block.Header.Bits.ToCompact().ToString("X2")); contents.Add(" Version: " + block.Header.Version); contents.Add(" Hash: " + block.Header.ToString()); contents.Add(" Hash Merkle Root: " + block.Header.HashMerkleRoot); System.IO.File.AppendAllLines("genesis.txt", contents); Console.WriteLine("Generation completed, output written to genesis.txt"); Console.WriteLine("Press any key to exit."); Console.Read(); }