示例#1
0
        async private void btnEstFee_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                txtFeeAmt.Text = "" + await Task.Run(() => TxUtil.EstimateFee());

                UpdateStatus("Estimated Fee = " + txtFeeAmt.Text);
            }
            catch (Exception ex)
            {
                UpdateStatus("Error: " + ex.Message);
            }
        }
示例#2
0
        async private void btnBalance_Click(object sender, RoutedEventArgs e)         //get address balances from ElectrumX
        {
            try
            {
                string txt = txtExtPubKey.Text;
                long   bal = await Task.Run(() => TxUtil.GetExtendedBalance(txt, 0, 25, 10, IsTestNet));

                UpdateStatus("Ext Balance = " + bal + " satoshi (" + bal / 100000000d + " btc)");
            }
            catch (Exception ex)
            {
                UpdateStatus("Error: " + ex.Message);
            }
        }
示例#3
0
        async private void btnBroadcastTx_Click(object sender, RoutedEventArgs e)         //broadcast tx to blockchain
        {
            try
            {
                string txt  = txtTxSignedHex.Text;
                string hash = await Task.Run(() => TxUtil.BroadcastTx(txt, IsTestNet));

                UpdateStatus("Tx Hash = " + hash);
                txtTxHash.Text = hash;
            }
            catch (Exception ex)
            {
                UpdateStatus("Error: " + ex.Message);
            }
        }
示例#4
0
        async private void btnSignTx_Click(object sender, RoutedEventArgs e)         //create & sign tx from json
        {
            try
            {
                string txt    = txtTxJSON.Text;
                string pvtKey = txtExtPvtKey.Text;
                string hex    = await Task.Run(() => TxUtil.SignTx(txt, pvtKey, IsTestNet));

                UpdateStatus("Tx Signed Hex = " + hex);
                txtTxSignedHex.Text = hex;
            }
            catch (Exception ex)
            {
                UpdateStatus("Error: " + ex.Message);
            }
        }
示例#5
0
        async private void btnCreateTx_Click(object sender, RoutedEventArgs e)         //create unsigned tx json
        {
            try
            {
                btnCreateTx.IsEnabled = false;
                UpdateStatus("Creating Transaction...");
                string extPubKey = txtExtPubKey.Text;
                string recAddr   = txtRecAddr.Text;
                string chgAddr   = txtChgAddr.Text;
                long   sendAmt   = long.Parse(txtSendAmt.Text);
                long   feeAmt    = long.Parse(txtFeeAmt.Text);
                string jsn       = await Task.Run(() => TxUtil.CreateTxJSON(extPubKey, recAddr, chgAddr, 0, sendAmt, feeAmt, IsTestNet));

                UpdateStatus("Transaction:\n" + jsn);
                txtTxJSON.Text = jsn;
            }
            catch (Exception ex)
            {
                UpdateStatus("Error: " + ex.Message);
            }
            btnCreateTx.IsEnabled = true;
        }
示例#6
0
 private void btnAllKeys_Click(object sender, RoutedEventArgs e)
 {
     UpdateStatus(TxUtil.GetDerivedKeysAll(txtExtPvtKey.Text, 5, IsTestNet));             //derive addresses from ext private key
 }