<p>The fee rate is not related to the confirmation status of the transaction.</p>
<p>As far as the bitcoin protocol is concerned, fee rate is simply <code>transaction fee (in sats)/transaction size (in bytes)</code>. So for a 100 byte transaction, paying 10000 satoshis as a fee, the fee rate is <code>10000/1000</code>, or 10 sats/byte.</p>
<p>Currently, you have two possible fee rates: Segwit and non-segwit.</p>
<p>The Fee Rate/weight unit, instead of fee rate/byte, measure is intended to provide a consistent view of fee rates, regardless of whether a transaction has segwit inputs or not.</p>
<p>The calculation remains the same - <code>weight units/total fee</code> gives you the fee rate per weight unit, with a non-segwit byte counting as 4 weight units, and a segwit byte counting as 1 (this is a simplification, full details are outside the scope of fee rates).</p>
<p>To calculate this using Bitcoin Core, simply get the transaction details via RPC. A decoded response contains a <code>weight</code> field, which you then divide by the total fees paid to determine the fee rate per weight unit.</p>
<p>If a transaction has multiple inputs from distinct wallets, the fee is still paid at a transaction level - to determine how much of a fee was &quot;paid&quot; by a particular input, you'd need to determine who received the outputs, and where the change went. Once you know the output break up, you can attempt to distribute the total fee among the participants.</p>

CC BY-SA 4.0
2020-09-15T12:16:52.893Z
2020-09-15T12:16:52.893Z
Raghav Sood
<p>On block explorers such as blockchain.com, each unconfirmed transaction has a desired feerate set by the wallet such as 58.000 sat/B. This is not to be confused with the actual final fee calculation.</p>
<p>My question is how do they obtain/calculate the feerate desired by the users wallet that submitted the transaction?</p>
<p>Is this possible via the bitcoin JSON RPC api?</p>
<p>From what I understand, getrawtransaction() does not provide any details of the feerate set by the sender. Moreover, you can also get the feerate set by a user by getting their wallet details. If so, how is the wallet feerate set calculated if there are two inputs to the transaction?</p>

<wallet><transaction-fees><json-rpc>
How to get a wallet feerate (sat/byte) of an unconfirmed transaction?
steincode
# How to get a wallet feerate (sat/byte) of an unconfirmed transaction?

(Asked by: username_0 on 2020-09-15)

On block explorers such as blockchain.com, each unconfirmed transaction has a desired feerate set by the wallet such as 58.000 sat/B. This is not to be confused with the actual final fee calculation.

My question is how do they obtain/calculate the feerate desired by the users wallet that submitted the transaction?

Is this possible via the bitcoin JSON RPC api?

From what I understand, getrawtransaction() does not provide any details of the feerate set by the sender. Moreover, you can also get the feerate set by a user by getting their wallet details. If so, how is the wallet feerate set calculated if there are two inputs to the transaction?

**Tags:** wallet, transaction-fees, json-rpc


---

## 1 answers

### Answer by username_1 on 2020-09-15. Score: 1 | Accepted answer

The fee rate is not related to the confirmation status of the transaction.

As far as the bitcoin protocol is concerned, fee rate is simply `transaction fee (in sats)/transaction size (in bytes)`. So for a 100 byte transaction, paying 10000 satoshis as a fee, the fee rate is `10000/1000`, or 10 sats/byte.

Currently, you have two possible fee rates: Segwit and non-segwit.

The Fee Rate/weight unit, instead of fee rate/byte, measure is intended to provide a consistent view of fee rates, regardless of whether a transaction has segwit inputs or not.

The calculation remains the same - `weight units/total fee` gives you the fee rate per weight unit, with a non-segwit byte counting as 4 weight units, and a segwit byte counting as 1 (this is a simplification, full details are outside the scope of fee rates).

To calculate this using Bitcoin Core, simply get the transaction details via RPC. A decoded response contains a `weight` field, which you then divide by the total fees paid to determine the fee rate per weight unit.

If a transaction has multiple inputs from distinct wallets, the fee is still paid at a transaction level - to determine how much of a fee was "paid" by a particular input, you'd need to determine who received the outputs, and where the change went. Once you know the output break up, you can attempt to distribute the total fee among the participants.


---

