创建比特币原始交易时,输入已连接

时间:2020-03-16 11:54:20

标签: java implementation bitcoin cryptocurrency bitcoinj

我想创建一个比特币原始交易并在testnet上对其进行测试,但是在添加了输出和输入后,如下所示:

 Transaction tx = new Transaction(params);
 Address target = Address.fromString(params,targetAd);
 Address source = Address.fromString(params,sourceADDRESS);
 tx.addOutput(Coin.valueOf(10000),target);
 long index = 1;
 String txid = "d2340514953262fdf5ce11f5e6c95c4d3cc5b614f0446d697f7471ae7b5e4a96";
 Script script = ScriptBuilder.createOutputScript(source);
 Sha256Hash txhash = Sha256Hash.wrap(txid);
 TransactionOutPoint outPoint = new TransactionOutPoint(params,index,txhash);
 tx.addSignedInput(outPoint,script, key, Transaction.SigHash.ALL, true);

它表明输入未连接,也没有显示UTXO的余额,我不知道它是否可以广播到测试网。

purpose: USER_PAYMENT
   in   PUSHDATA(72)[3045022100f7a04c20ccb0cc185eac1b90662d7550859a14353ca953e83f274dcf0777bbbd022035a9e7d9a5252a317caf18d984a30f67cfbc30ccd6166811a4ef0f287d28592481] PUSHDATA(33)[036a7b58593d6dfdbb593099d53bde78f85e8de58bd1a35d598e6f17a65575e494]
        unconnected  outpoint:d2340514953262fdf5ce11f5e6c95c4d3cc5b614f0446d697f7471ae7b5e4a96:1
   out  HASH160 PUSHDATA(20)[bb860864c0fb8341d5d4f6a78119b4898d53ffc8] EQUAL  0.0001 BTC
        P2SH addr:2NALkuvAxuwf56s6t3mYjk6XamHzm1FdDg1

0 个答案:

没有答案