Beispiel #1
0
        //-----Functions
        public void CreateGenesisBlock()
        {
            BlockHeader genesisBlockHeader = new BlockHeader(0, BlockchainFunctions.Timestamp(), "0000000000000000000000000000000000000000000000000000000000000000");
            Block       genesisBlock       = new Block(genesisBlockHeader, pendingTransactions.ToArray());

            genesisBlock.MineBlock(difficulty);
            chain.Add(genesisBlock);
        }
Beispiel #2
0
        public void MineSelectedTransactions(string minerAddress)
        {
            BlockHeader newBlockHeader = new BlockHeader(chain.ToArray().Length, BlockchainFunctions.Timestamp(), GetLatestBlock().hash);
            Block       newBlock       = new Block(newBlockHeader, SelectPendingTransactions(blockSize));

            newBlock.MineBlock(difficulty);
            chain.Add(newBlock);
        }