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 in Blockchain by Soham
• 8,730 points
26 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 by Rahul
• 8,980 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,310 points
324 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,190 points
1,719 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 894 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,720 points
519 views
0 votes
1 answer

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

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,440 points
598 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
918 views
0 votes
1 answer
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 in Blockchain by Rahul
• 8,980 points
17 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP