Beispiel #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBox2.Text))
            {
                richTextBox1.Text += "\n[ERR] Missing public key\n";            // Report error
                return;
            }
            else if (!(radioButton1.Checked ||
                       radioButton2.Checked ||
                       radioButton3.Checked ||
                       radioButton4.Checked))
            {
                richTextBox1.Text += "\n[ERR] Missing mining choice";
                return;
            }

            var t = Task.Run(() =>
            {
                if (radioButton1.Checked)
                {
                    // Generate new block button function

                    blockchain.AddBlock(textBox2.Text, 1);         // Add block to blockchain from pending transactions, takes public key for reward
                }
                else if (radioButton2.Checked)
                {
                    blockchain.AddBlock(textBox2.Text, 2);
                }
                else if (radioButton3.Checked)
                {
                    blockchain.AddBlock(textBox2.Text, 3);
                }
                else if (radioButton4.Checked)
                {
                    blockchain.AddBlock(textBox2.Text, 4);
                }
            });
        }