Raw transactions - SubtractFeeFromAmount flag

1

I'm currently working on a project (I'm a beginner in the world of cryptocurrencies) where we are using Raw Transactions, I want to know if in raw transactions there's a flag similar to subtractFeeFromAmount flag that exists in the sendToAddress method.

Gerardo GutiƩrrez

Posted 2018-07-23T21:18:42.610

Reputation: 13

Answers

5

When you create a raw transaction, you must specify all inputs and outputs, and any leftover will go towards the fee (to the miner). The raw transaction does not do any fee calculation.

Example Transaction:

input1: .1BTC
input2: .2BTC

output1: .299BTC

The resulting fee would be:

fee: .001BTC

This amount gets added to the coinbase transaction (by the miner) of the block which includes this transaction.

JBaczuk

Posted 2018-07-23T21:18:42.610

Reputation: 6 172