private async void Transaction_sign_Click(object sender, RoutedEventArgs e) { Additional.Transaction transaction = new Additional.Transaction(); transaction.input.put = Transaction_Add_input.SelectedValue.ToString(); string input = Transaction_Add_input.SelectedValue.ToString(); string output = Transaction_Add_output.Text; string information = transaction_Add_information.Text; string name; bool trigger = false; if ((input.Length == 64) && (output.Length == 64) && (information.Length <= 128)) { trigger = false; foreach (Additional.Transaction new_coin in coins) { if (new_coin.name == input) { trigger = true; } } if (trigger) { transaction.version = 1; transaction.input.put = input; transaction.input.value = 1; transaction.output.put = output; transaction.output.value = 1; transaction.information = Encoding.UTF8.GetBytes(information); transaction.public_key = public_key; name = await main.transactions.MakeNewTransaction(transaction, private_key); Transaction_Add_Result.Text = name; Transaction_Add_info.Content = "Транзакция успешно создана."; } } else { WriteLine(input + " " + input.Length); WriteLine(output + " " + output.Length); WriteLine(information + " " + information.Length); Transaction_Add_Warning.Content = "Проверьте, пожалуйста, вводимые значения."; } coins = await main.transactions.GetTransactionsListToPublicKey(main.cryptography.HashToString(main.cryptography.GetSHA256Hash(Encoding.UTF8.GetBytes(public_key)))); }
private async void Button_admin_money_Click(object sender, RoutedEventArgs e) { Additional.Transaction transaction = new Additional.Transaction(); transaction.version = 1; transaction.input.put = main.cryptography.HashToString(main.cryptography.GetSHA256Hash(Encoding.UTF8.GetBytes("admin"))); transaction.input.value = 1; transaction.output.put = main.cryptography.GetHashString(public_key); transaction.output.value = 1; transaction.public_key = Information.admin_public_key; transaction.information = Encoding.UTF8.GetBytes("Подарок на день рождения~!!!!!!"); string name = await main.transactions.MakeNewTransaction(transaction, root_private); WriteLine("[admin]: added 1 beecoin (" + name + ") to this account: " + main.cryptography.GetHashString(public_key)); }
private async void Transaction_search_Click(object sender, RoutedEventArgs e) { if (Transaction_Get_Search.Text.Length == 64) { Additional.Transaction transaction = new Additional.Transaction(); string name = Transaction_Get_Search.Text; transaction = await main.transactions.Search(name); if (transaction.signature != null) { Transaction_Get_input.Text = transaction.input.put; Transaction_Get_output.Text = transaction.output.put; Transaction_Get_publickey.Text = transaction.public_key; Transaction_Get_information.Text = Encoding.UTF8.GetString(transaction.information); if (transaction.status) { Transaction_Get_info.Content = "Транзакция подтверждена"; } else { Transaction_Get_info.Content = "Транзакция не подтверждена"; } Transaction_Get_Warning.Content = "Информация о транзакции " + name; } else { Transaction_Get_Warning.Content = "Транзакция не найдена"; } } else { Transaction_Get_Warning.Content = "Проверьте форму ввода"; } }