Ejemplo n.º 1
0
 private void MineANewBlock(bool holdForBlockTime = true)
 {
     if (holdForBlockTime)
     {
         HoldForBlockTime();
     }
     Log("Start mining a new Block");
     NodeApiClient.MineBlock();
 }
Ejemplo n.º 2
0
        private void editBtn_Click(object sender, EventArgs e)
        {
            _transaction.Sender    = senderTXT.Text;
            _transaction.Recipient = receiverTxt.Text;
            _transaction.Amount    = (int)amountTxt.Value;
            var message = NodeApiClient.EditTransaction(_transaction);

            MessageBox.Show(message);
        }
Ejemplo n.º 3
0
        private void sendBtn_Click(object sender, EventArgs e)
        {
            var result = NodeApiClient.SendTransaction(new Transaction()
            {
                Amount    = (int)amountTxt.Value,
                Sender    = senderTxt.Text,
                Recipient = receiverTxt.Text
            });

            Log(result, Severity.Success);
        }
Ejemplo n.º 4
0
        private void loadMemPool_Click(object sender, EventArgs e)
        {
            var data = NodeApiClient.LoadTransactionsMemPool();

            memPoolGrd.DataSource = null;
            memPoolGrd.DataSource = data;

            //set autosize mode
            //memPoolGrd.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            //memPoolGrd.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            //memPoolGrd.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
        }
Ejemplo n.º 5
0
        private void validateBtn_Click(object sender, EventArgs e)
        {
            var      message  = NodeApiClient.ValidateConsensus();
            Severity severity = Severity.Info;

            if (message.Contains("authoritive"))
            {
                severity = Severity.Success;
            }
            else
            {
                severity = Severity.Warning;
            }
            Log(message, severity);
        }
Ejemplo n.º 6
0
        private void loadChainBtn_Click(object sender, EventArgs e)
        {
            _data = NodeApiClient.LoadBlockChain();

            blocksGrid.DataSource = null;
            blocksGrid.DataSource = _data.chain;

            //set autosize mode
            blocksGrid.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            blocksGrid.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            blocksGrid.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            blocksGrid.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
            blocksGrid.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            blocksGrid.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
        }
Ejemplo n.º 7
0
        private void ChainOnConsensusValidateRequest(object sender, EventArgs eventArgs)
        {
            Log("A consensus update is request has been received");
            var      validateResult = NodeApiClient.ValidateConsensus();
            Severity severity       = Severity.Info;

            if (validateResult.Contains("authoritive"))
            {
                severity = Severity.Success;
            }
            else
            {
                severity = Severity.Warning;
            }
            Log(validateResult, severity);
        }
Ejemplo n.º 8
0
        private void loadPeersBtn_Click(object sender, EventArgs e)
        {
            var peersFile = new StreamReader(Application.StartupPath + "\\peers.txt");
            var peersTxt  = peersFile.ReadToEnd();
            var peers     = peersTxt.Split(new[] { '\r' });

            foreach (var peer in peers)
            {
                try
                {
                    NodeApiClient.AddPeer(peer.Trim());
                    Log($"peer {peer} added to peer list", Severity.Success);
                }
                catch (Exception exception)
                {
                    Log(exception.Message, Severity.Error);
                }

                peersLst.Items.Add(peer);
            }
        }
Ejemplo n.º 9
0
        private void queryBalanceBtn_Click(object sender, EventArgs e)
        {
            var balance = NodeApiClient.QueryBalance();

            balanceTxt.Text = balance;
        }