Exemple #1
0
    public void ProcessTransactionPool(string minerAddress)
    {
        //Creating block to be processed
        Block block = new Block(DateTime.Now, GetLastBlock().BlockHash, TransactionPool);

        //Calculating block generation time
        var startTimeCreate = DateTime.Now;

        AddBlock(block);

        var endTimeCreate = DateTime.Now;

        BlockchainExportImporter.InsertBlockIntoBlockchainFile(block);

        Debug.Log($"Duracao = {endTimeCreate - startTimeCreate}");

        //Reset transactionPool
        TransactionPool = new List <Transaction>();

        //Premiando o minerador
        CreateTransaction(new Transaction("blockChainInstance", minerAddress, Reward));
    }
Exemple #2
0
 public void AddGenesisBlock()
 {
     BlockchainExportImporter.InsertBlockIntoBlockchainFile(CreateGenesisBlock());
     Chain.Add(CreateGenesisBlock());
 }