1
0
The problem was that I tried to sign inputs and add outputs and other info into transaction. The last result hexRawTx :
01000000019843f83b2c42de1585cdc3b689a10a2960d016d5887f1ecd50bc8e040bbe94cc000000006b483045022100f9559234c189df36b99ffea94ecec650c1a483cdc02a976759d4bd7347a82ca9022009278f760db1dabf666ea0fcab55b8a1c6f20b27f8b442738b1d51165d91fd3e8121027e912293da7fecdffe57a49a726649d547a6b0fb2a5420047515d6373d251296ffffffff02102700000000000017a914e211863c0e582b5df44f6e1aa0eef0eb9ddcc9078760590100000000001976a914ad7252447111e2300c77aa406339b4e38d08cf4988ac00000000
Detect this tx, the fee is always zero, and input without address(https://live.blockcypher.com/btc/decodetx/)
transaction.addOutput(coin , Address.fromBase58(MainNetParams.get(),toAddress));
transaction.addOutput(coinInput,Address.fromBase58(MainNetParams.get(),fromAddress));
for(int k=0;k<unSpentNum;k++){
TransactionInput transactionInput=new TransactionInput(MainNetParams.get(),
transaction,newBigInteger(unSpent.get(k).getScript(),16).toByteArray(),
new TransactionOutPoint(MainNetParams.get(), 0, Sha256Hash.wrap(unSpent.get(k).getTx_hash())));
transaction.addInput(transactionInput);
}
String hexRawTx = SignTool.verifyAndSignTransaction(transaction, 0, ecKey, null, false,MainNetParams.get());
(unSpentNum) get from https://blockchain.info/unspent?active=3D2oetdNuZUqQHPJmcMDDHYoqkyNVsFk9r
Which output are you trying to spend? I can't find txid
cc94be0b048ebc50cd1e7f88d516d060290aa189b6c3cd8515de422c3bf84398on a block explorer – Mike D – 2018-09-21T12:05:49.023Thank you for your help,I am spending the second here. fromAddress:1Gp6rNgRjUVFuoC6dZvvpUaCidfzJEVbAW , toAddress: 3NJMdWarysk9woSUkzAV18AapbxsA4qd7p , Does the problem occur in the transaction.addInput() ? – blueberry082 – 2018-09-25T02:19:04.093
https://blockchain.info/unspent?active=1Gp6rNgRjUVFuoC6dZvvpUaCidfzJEVbAW – blueberry082 – 2018-09-25T02:48:04.243
The problem has been solved, the parameter problem – blueberry082 – 2018-09-25T07:15:52.910