<p>The coin selection algorithms all use an estimated weight. It is not a metric but rather the estimated weight that the resulting input will have.</p>
<p>The estimate is based on the type of the output script. For some script types, it will be accurate, for others, it is an upper bound. Bitcoin Core can only make these weight estimates for script types that it knows, it cannot do this for arbitrary scripts.</p>

CC BY-SA 4.0
2024-11-23T20:52:50.830Z
2024-11-23T20:52:50.830Z
Ava Chow
<p>The Bitcoin core wallet selection algorithms, particularly coin-grinder use a weight metric for each output.  My understanding is that an output's weight is composed of the base_weight which is a constant amount plus a satisfaction_weight which is variable depending on the type of output and script/arguments needed to unlock it.  My question is, how does bitcoin core know the weight during coin-selection before it's actually spent?  Is this weight an estimate based on the type or is it accurately computed?</p>

<bitcoin-core><wallet><transaction-weight><coin-selection><utxo-management>
How does Bitcoin Core Wallet calculate the weight of each input before it's spent?
yancy
# How does Bitcoin Core Wallet calculate the weight of each input before it's spent?

(Asked by: username_0 on 2024-11-19)

The Bitcoin core wallet selection algorithms, particularly coin-grinder use a weight metric for each output. My understanding is that an output's weight is composed of the base\_weight which is a constant amount plus a satisfaction\_weight which is variable depending on the type of output and script/arguments needed to unlock it. My question is, how does bitcoin core know the weight during coin-selection before it's actually spent? Is this weight an estimate based on the type or is it accurately computed?

**Tags:** bitcoin-core, wallet, transaction-weight, coin-selection, utxo-management


---

## 1 answers

### Answer by username_1 on 2024-11-23. Score: 5 | Accepted answer

The coin selection algorithms all use an estimated weight. It is not a metric but rather the estimated weight that the resulting input will have.

The estimate is based on the type of the output script. For some script types, it will be accurate, for others, it is an upper bound. Bitcoin Core can only make these weight estimates for script types that it knows, it cannot do this for arbitrary scripts.


---

