Пример #1
0
        private void btnFromBitcoind_Click(object sender, EventArgs e)
        {
            if (!getRpc())
            {
                return;
            }

            try
            {
                object[] obj = rpc.doRequest <object[]>("listunspent", new object[0]);

                for (int i = 0; i < obj.Length; i++)
                {
                    Dictionary <string, object> p = rpc.jss.ConvertToType <Dictionary <string, object> >(obj[i]);

                    string txid         = (string)p["txid"];
                    int    vout         = (int)p["vout"];
                    ulong  amount       = (ulong)(((decimal)p["amount"]) * 100000000m);
                    string scriptPubKey = (string)p["scriptPubKey"];

                    UTXO.Add(new TxOutId(HexString.ToByteArrayReversed(txid), (uint)vout), new TxOut(amount, HexString.ToByteArray(scriptPubKey)));
                }

                updateUTXOList();
            }
            catch (Exception)
            {
                MessageBox.Show("Error downloading unspent outputs.");
                return;
            }
        }
Пример #2
0
        private void dgvInputs_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (disableUpdate)
            {
                return;
            }

            disableUpdate = true;
            selectedUTXO.Clear();
            for (int i = 0; i < dgvInputs.Rows.Count; i++)
            {
                if ((bool)dgvInputs["inSelected", i].Value == true)
                {
                    TxOutId uth = new TxOutId(HexString.ToByteArrayReversed((string)dgvInputs["inTxId", i].Value), (UInt32)dgvInputs["invOut", i].Value);
                    selectedUTXO.Add(uth, UTXO[uth]);
                }
            }
            updateTx();
            disableUpdate = false;
        }