public TrackedTransaction[] GetTransactions(BitcoinExtPubKey pubkey) { var tableName = $"T-{Hashes.Hash160(pubkey.ToBytes()).ToString()}"; var result = new List <TrackedTransaction>(); using (var tx = _Engine.GetTransaction()) { foreach (var row in tx.SelectForward <string, byte[]>(tableName)) { if (row == null || !row.Exists) { continue; } var transaction = new Transaction(row.Value); transaction.CacheHashes(); var blockHash = row.Key.Split(':')[1]; var tracked = new TrackedTransaction(); if (blockHash.Length != 0) { tracked.BlockHash = new uint256(blockHash); } tracked.Transaction = transaction; result.Add(tracked); } } return(result.ToArray()); }
private void btnCalculate_Click(object sender, RoutedEventArgs e) { BitcoinExtPubKey bitcoinExtPubKey; ExtPubKey extPubKey; switch (cboCoin.SelectedValue) { case "BTC - Bitcoin (BIP-44)": bitcoinExtPubKey = new BitcoinExtPubKey(txtInput.Text, Network.Main); extPubKey = new ExtPubKey(bitcoinExtPubKey.ToBytes()); txtAddress.Text = extPubKey.Derive(Convert.ToUInt32(cboIndex.SelectedValue)).PubKey.ToString(Network.Main); break; case "BTC - Bitcoin (BIP-49)": bitcoinExtPubKey = new BitcoinExtPubKey(txtInput.Text, Network.Main); extPubKey = new ExtPubKey(bitcoinExtPubKey.ToBytes()); txtAddress.Text = extPubKey.Derive(Convert.ToUInt32(cboIndex.SelectedValue)).PubKey.WitHash.GetAddress(Network.Main).GetScriptAddress().ToString(); break; } }