Не могу совершать транзакции с биткойнами

Здравствуйте, у меня возникли проблемы с отправкой некоторого биткойна в тестовую сеть. Я попытался использовать код в цепочке блоков программирования, но по какой-то причине я не вижу, чтобы транзакция работала

И я использую библиотеку NBitcoin

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NBitcoin;
namespace UsingBitcoin
{
    class Program
    {
        static void Main(string[] args)
        {
            //Key privateKey = new Key();//Create private key
            //PubKey publicKey = privateKey.PubKey;
            //var publicKeyHash = publicKey.Hash;
            var testNetAddress = Network.TestNet.CreateBitcoinAddress("mvEHkJNwRaFXnQWCGbGpJxpZYckBe4WJae");
            BitcoinSecret testNetPrivateKey = Network.TestNet.CreateBitcoinSecret("cQV1vVFKp2PaAkGMxsRZrphFCTQvcimG1qv7UQwtEMDi2VwHDw4m");
            //Console.WriteLine("Public Key: "+ publicKey);
            //Console.WriteLine("TestNet Address: "+ publicKey.GetAddress(Network.TestNet));
            Console.WriteLine("TestNet2 Addr:" + testNetAddress);
            Console.WriteLine("Bitcoin Secret:"+ testNetPrivateKey);
            Console.WriteLine("\nPlease Enter your transaction Id:");
            //String inputTx = Console.ReadLine();
            Transaction transaction = new Transaction();
            TxIn input = new TxIn();
            input.PrevOut = new OutPoint(new uint256("1f0f9664ab313aecf75a3f856514879f1852b50af99c3cf6466dbe28e1f53c07"), 1);
            input.ScriptSig = testNetPrivateKey.PubKey.ScriptPubKey;
            transaction.AddInput(input);
            TxOut txOutout = new TxOut();
            BitcoinAddress destination = BitcoinAddress.Create("mnjbEQtvEhH5HD4EZnc94V5fvmXkk1Td1Z");
            Money fee = Money.Satoshis(400000);
            txOutout.Value = Money.Coins(11m) - fee;
            txOutout.ScriptPubKey = destination.ScriptPubKey;
            transaction.AddOutput(txOutout);
            transaction.Sign(testNetPrivateKey,false);
        }
    }
}

0 ответов

Другие вопросы по тегам