<p>The first number does not include the prevout, sequence number, or the length byte for the scriptSig. It also uses 65 bytes for the public key (which is correct if it is uncompressed, but compressed keys of 33 bytes are more common now). Correcting it gives 139 + 36 + 4 + 1 + (33 - 65) = 148.</p>
<p>The developer in the third case forgot to include the sequence number, making the result 147 or 148.</p>
<p>The guys at Princeton clearly know best.</p>
<p>So to summarize:</p>
<pre><code>PREVOUT: hash (32 bytes)
         index (4 bytes)
SCRIPTSIG: length (1 byte)
           CONTENTS: push opcode (1 byte)
                     signature (71 or 72 bytes)
                     push opcode (1 byte)
                     pubkey (33 bytes for compressed, 65 for uncompressed)
sequence (4 bytes)
</code></pre>

CC BY-SA 3.0
2016-08-26T21:00:37.023Z
2022-07-19T01:08:49.987Z
2022-07-19T01:08:49.987Z
Pieter Wuille
<p>How many bytes does a P2PKH input have? I'm finding a few different numbers:</p>

<ul>
<li><a href="https://bitcoin.stackexchange.com/a/32642/5406">Why does the default miner implementation use pay-to-pubkey?</a> states:

<blockquote>
  <p>push + sig + push + key = 1 + 72 + 1 + 61 = 139</p>
</blockquote></li>
<li>Princeton Bitcoin Book states [p.123]: 

<blockquote>
  <p>The approximate size of a transaction is 148 bytes for each input[…]</p>
</blockquote></li>
<li>A knowledgeable Bitcoin developer calculated from the top of the mind for me over coffee:  

<blockquote>
  <p>PREVOUT + SCRIPTSIG = 36 + (1 + 1 + 33 + 1 + (71 or 72)) = 143 or 144</p>
</blockquote></li>
</ul>

<p>I couldn't find further information in the <a href="https://bitcoin.org/en/glossary/p2pkh-address" rel="nofollow noreferrer">Bitcoin Developer Guide</a> or the wiki.</p>

<p>Bonus-question: How come there are different numbers? Did the size change over time?</p>

<transaction-input><p2pkh><transaction-weight>
How big is the input of a P2PKH transaction?
Murch
# How big is the input of a P2PKH transaction?

(Asked by: username_0 on 2016-08-26)

How many bytes does a P2PKH input have? I'm finding a few different numbers:

* [Why does the default miner implementation use pay-to-pubkey?](https://bitcoin.stackexchange.com/a/32642/5406) states:
  > push + sig + push + key = 1 + 72 + 1 + 61 = 139
* Princeton Bitcoin Book states [p.123]:
  > The approximate size of a transaction is 148 bytes for each input[…]
* A knowledgeable Bitcoin developer calculated from the top of the mind for me over coffee:
  > PREVOUT + SCRIPTSIG = 36 + (1 + 1 + 33 + 1 + (71 or 72)) = 143 or 144

I couldn't find further information in the [Bitcoin Developer Guide](https://bitcoin.org/en/glossary/p2pkh-address) or the wiki.

Bonus-question: How come there are different numbers? Did the size change over time?

**Tags:** transaction-input, p2pkh, transaction-weight


---

## 1 answers

### Answer by username_1 on 2016-08-26. Score: 11 | Accepted answer

The first number does not include the prevout, sequence number, or the length byte for the scriptSig. It also uses 65 bytes for the public key (which is correct if it is uncompressed, but compressed keys of 33 bytes are more common now). Correcting it gives 139 + 36 + 4 + 1 + (33 - 65) = 148.

The developer in the third case forgot to include the sequence number, making the result 147 or 148.

The guys at Princeton clearly know best.

So to summarize:

```
PREVOUT: hash (32 bytes)
         index (4 bytes)
SCRIPTSIG: length (1 byte)
           CONTENTS: push opcode (1 byte)
                     signature (71 or 72 bytes)
                     push opcode (1 byte)
                     pubkey (33 bytes for compressed, 65 for uncompressed)
sequence (4 bytes)

```


---

