private void button1_Click(object sender, EventArgs e)
        {
            string input = InputBox.Show("SignatureContext", "SignatureContext");

            if (string.IsNullOrEmpty(input))
            {
                return;
            }
            try
            {
                context = SignatureContext.Parse(input);
            }
            catch (FormatException ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            listBox1.Items.Clear();
            listBox2.Items.Clear();
            textBox1.Clear();
            textBox2.Clear();
            listBox1.Items.AddRange(context.ScriptHashes.Select(p => Wallet.ToAddress(p)).ToArray());
            button2.Enabled = true;
            button4.Visible = context.Completed;
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("必须输入一段含有待签名数据的JSON对象。");
                return;
            }
            SignatureContext context = SignatureContext.Parse(textBox1.Text);

            if (!Program.CurrentWallet.Sign(context))
            {
                MessageBox.Show("没有足够的私钥对数据进行签名。");
                return;
            }
            if (context.Completed)
            {
                context.Signable.Scripts = context.GetScripts();
                textBox2.Text            = context.Signable.ToArray().ToHexString();
                MessageBox.Show("签名完成,该对象的签名信息已经完整,可以广播。");
            }
            else
            {
                textBox2.Text = context.ToString();
                MessageBox.Show("签名完成,但该对象的签名信息还不完整。");
            }
        }
Ejemplo n.º 3
0
        private void button7_Click(object sender, EventArgs e)
        {
            SignatureContext context = SignatureContext.Parse(textBox8.Text);

            context.Signable.Scripts = context.GetScripts();
            InformationBox.Show(context.Signable.ToArray().ToHexString(), "原始数据:");
        }
Ejemplo n.º 4
0
        private async void button8_Click(object sender, EventArgs e)
        {
            SignatureContext context = SignatureContext.Parse(textBox8.Text);

            context.Signable.Scripts = context.GetScripts();
            Inventory inventory = (Inventory)context.Signable;
            await Program.LocalNode.RelayAsync(inventory);

            InformationBox.Show(inventory.Hash.ToString(), "数据广播成功,这是广播数据的散列值:", "广播成功");
        }
Ejemplo n.º 5
0
        private void button2_Click(object sender, EventArgs e)
        {
            SignatureContext context = SignatureContext.Parse(textBox1.Text);

            context.Signable.Scripts = context.GetScripts();
            IInventory inventory = (IInventory)context.Signable;

            Program.LocalNode.Relay(inventory);
            InformationBox.Show(inventory.Hash.ToString(), Strings.RelaySuccessText, Strings.RelaySuccessTitle);
        }
Ejemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show(Strings.SigningFailedNoDataMessage);
                return;
            }
            SignatureContext context = SignatureContext.Parse(textBox1.Text);

            if (!Program.CurrentWallet.Sign(context))
            {
                MessageBox.Show(Strings.SigningFailedKeyNotFoundMessage);
                return;
            }
            textBox2.Text = context.ToString();
        }
Ejemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("必须输入一段含有待签名数据的JSON对象。");
                return;
            }
            SignatureContext context = SignatureContext.Parse(textBox1.Text);

            if (!Program.CurrentWallet.Sign(context))
            {
                MessageBox.Show("没有足够的私钥对数据进行签名。");
                return;
            }
            textBox2.Text = context.ToString();
        }