Closed iamgamelover closed 3 years ago
I don't see any code "setting a fee."
So how can I possibly help you?
Do you understand what the 1000000
that you pass to txb.sign means?
You are telling TransactionBuilder "the input I am signing is worth 0.01 tBTC"...
But looking at the blockchain, your input is only worth 0.0002 tBTC...
So it thinks you are paying 0.00998 tBTC fee and not a 0.00002 tBTC fee.
I used Transaction.fromHex (txhex)
to create txb object and the "setting a fee." thing is in the txhex.
Code is here:
---------------
Step 1
---------------
./omnicore-cli listunspent 0 99999 '["2N1DFjaE4yCcECdFwgLQcLmNrLV5zetgQtE"]'
{
"txid": "9aeb41e33094347db7f8af81645ec972769030c8669d8197cf7551f1d051888e",
"vout": 0,
"address": "2N1DFjaE4yCcECdFwgLQcLmNrLV5zetgQtE",
"label": "",
"scriptPubKey": "a9145761a1d45b8a6e7caa10a4bcecca97630c67af4687",
"amount": 0.00020000,
"confirmations": 1,
"spendable": false,
"solvable": false,
"safe": true
}
---------------
Step 2
---------------
// miner fee: 0.00002
./omnicore-cli createrawtransaction '[{"txid":"9aeb41e33094347db7f8af81645ec972769030c8669d8197cf7551f1d051888e","vout":0}]' '{"2N1DFjaE4yCcECdFwgLQcLmNrLV5zetgQtE":0.00018}'
---------------
Step 3
---------------
// miner fee: 0.00002
./omnicore-cli "omni_createrawtx_change" "02000000018e8851d0f15175cf97819d66c830907672c95e6481aff8b77d349430e341eb9a0000000000ffffffff03504600000000000017a9145761a1d45b8a6e7caa10a4bcecca97630c67af46870000000000000000166a146f6d6e6900000000000000790000000005f5e10022020000000000001976a9144ff2611bf373454410ba5fe61d258544aab681f088ac00000000" '[{"txid":"9aeb41e33094347db7f8af81645ec972769030c8669d8197cf7551f1d051888e","vout":0,"scriptPubKey":"a9145761a1d45b8a6e7caa10a4bcecca97630c67af4687","value":0.00020000}]' "2N1DFjaE4yCcECdFwgLQcLmNrLV5zetgQtE" 0.00002
Thank you for fast reply :)
@junderw Excuse me, because previous issue is closed and I opened a new issue, thank you!
previous issue: https://github.com/bitcoinjs/bitcoinjs-lib/issues/1637
I changed correct wifs and got a new error:
I set fee is 0.00002 test btc.
New code is here:
I'm looking forward to your reply. Thanks!