How to set fee in raw bitcoin transaction using btcutil

0 votes

I have set the fee to 0.0000016 bitcoin/kilobyte and then did the following:-

  1. ListUnspent

  2. SetTxFee

  3. CreateRawTransaction

  4. SignRawTransaction

  5. SendRawTransaction

But while trying to send the transaction, this is what I get:

-26: 256: absurdly-high-fee

Is there any other way to set the fee using this library?

Debug.log

ThreadRPCServer method=listunspent 
ThreadRPCServer method=settxfee 
ThreadRPCServer method=createrawtransaction 
ThreadRPCServer method=signrawtransaction 
ThreadRPCServer method=sendrawtransaction

Amounts:

amounts := map[btcutil.Address]btcutil.Amount{ destAddress: destAmount, }

It seems like it tries to send the whole sum of the transaction, not the amount I want it to send. If the transaction into A is 1 BTC and I want to send 0.3 BTC to another address, how to achieve this when setting amounts?

Mar 14, 2022 in Blockchain by Soham
• 9,710 points
942 views

1 answer to this question.

0 votes

To answer your question, the settxfee is not used for the createrawtransaction command. However, if you have one input with 1 BTC and you send 0.9 BTC, the remaining amount is the transaction fee and if you don't want to set a transaction fee for 0.1 BTC you could send 0.09 to change address and leave that 0.01 and it's your transaction fee.

answered Mar 24, 2022 by Rahul
• 9,680 points

Related Questions In Blockchain

0 votes
1 answer

How to create raw transaction using web3swift?

var options = Web3Options.defaultOptions() options.gasLimit = BigUInt(21000) options.from = ...READ MORE

answered Sep 17, 2018 in Blockchain by slayer
• 29,370 points
925 views
0 votes
1 answer

How to set the hex-encoded data field in a Web3j Ethereum transaction?

You can use the "data" field of ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 69,220 points
3,016 views
0 votes
1 answer

How to make sure transactions take no fee in a private Ethereum blockchain?

In a private ethereum network you have ...READ MORE

answered Mar 26, 2018 in Blockchain by Christine
• 15,790 points

edited Mar 26, 2018 by Christine 1,590 views
0 votes
1 answer

How i can use nodejs to watch transactions in bitcoin network?

you can use  const Socket = require('blockchain.info/Socket'); const mySocket ...READ MORE

answered Jul 9, 2018 in Blockchain by digger
• 26,740 points
1,304 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,459 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,942 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,468 views
0 votes
1 answer

how Localbitcoins and other bitcoin wallet able to send/receive without network fee

Organizations that offer online wallets aren't obligated ...READ MORE

answered Mar 31, 2022 in Blockchain by Rahul
• 9,680 points
584 views
0 votes
1 answer

How to get historic Bitcoin Price Index using coinbase or any other open source API?

I would recommend you to use the ...READ MORE

answered Apr 7, 2022 in Blockchain by Rahul
• 9,680 points
1,371 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP