<blockquote>
<p>this formatting doesn't appear to be defined anywhere in this document?</p>
</blockquote>
<p>The formatting follows the standard Bitcoin script. The main difference between the witness stack and traditional Bitcoin script is that instead of pushing things to the stack via a script, the stack is just provided. So all of the encodings are just as if it were a Bitcoin script.</p>
<blockquote>
<p>what is the entire second piece &quot;21025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee6357&quot;</p>
</blockquote>
<p>That is the public key, prepended with it's length.</p>
<blockquote>
<p>the first part is the signature but what are the extra bytes on the front and end specifically 0x47 and 0x01</p>
</blockquote>
<p><code>0x47</code> is the length of the signature, including the extra byte on the end</p>
<p><code>0x01</code> is a Bitcoin specific byte called the sighash type. This as an enum that indicates what data needs to be included in the message that is hashed for the signature, aka the sighash.</p>
<blockquote>
<p>Most importantly the signature is too long?! it is 70 bytes instead of 64.</p>
</blockquote>
<p>No, this signature is <a href="https://en.wikipedia.org/wiki/X.690#DER_encoding" rel="nofollow noreferrer">DER encoded</a>, so there ends up being extra bytes to indicate type and length.</p>

CC BY-SA 4.0
2021-06-17T02:30:53.667Z
You a scholar and saint sir! Thank you again!
noone392
CC BY-SA 4.0
2021-06-17T02:21:56.760Z
2021-06-17T02:21:56.760Z
Ava Chow
<p>in bip143 thet define a witness signature. In the first example there is a witness broken down</p>
<pre><code>witness    00
               02 47304402203609e17b84f6a7d30c80bfa610b5b4542f32a8a0d5447a12fb1366d7f01cc44a0220573a954c4518331561406f90300e8f3358f51928d43c212a8caed02de67eebee01 21025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee6357
</code></pre>
<p>this formatting doesn't appear to be defined anywhere in this document? my question is specifically</p>
<ol>
<li>what is the entire second piece &quot;21025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee6357&quot;</li>
<li>the first part is the signature but what are the extra bytes on the front and end specifically 0x47 and 0x01</li>
<li>Most importantly the signature is too long?! it is 70 bytes instead of 64. &quot;304402203609e17b84f6a7d30c80bfa610b5b4542f32a8a0d5447a12fb1366d7f01cc44a0220573a954c4518331561406f90300e8f3358f51928d43c212a8caed02de67eebee&quot;  I was able to take the example private key, public key, and sighash and sign and verify so I know they are good, unless they aren't using SECP256k1 but that doesn't appear to be specified anywhere?</li>
</ol>
<p>Thank you a lot in advance!!</p>

<segregated-witness><signature><bip143>
bip143 witness formatting
noone392
# bip143 witness formatting

(Asked by: username_0 on 2021-06-17)

in bip143 thet define a witness signature. In the first example there is a witness broken down

```
witness    00
               02 47304402203609e17b84f6a7d30c80bfa610b5b4542f32a8a0d5447a12fb1366d7f01cc44a0220573a954c4518331561406f90300e8f3358f51928d43c212a8caed02de67eebee01 21025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee6357

```

this formatting doesn't appear to be defined anywhere in this document? my question is specifically

1. what is the entire second piece "21025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee6357"
2. the first part is the signature but what are the extra bytes on the front and end specifically 0x47 and 0x01
3. Most importantly the signature is too long?! it is 70 bytes instead of 64. "304402203609e17b84f6a7d30c80bfa610b5b4542f32a8a0d5447a12fb1366d7f01cc44a0220573a954c4518331561406f90300e8f3358f51928d43c212a8caed02de67eebee" I was able to take the example private key, public key, and sighash and sign and verify so I know they are good, unless they aren't using SECP256k1 but that doesn't appear to be specified anywhere?

Thank you a lot in advance!!

**Tags:** segregated-witness, signature, bip143


---

## 1 answers

### Answer by username_1 on 2021-06-17. Score: 1 | Accepted answer

> this formatting doesn't appear to be defined anywhere in this document?

The formatting follows the standard Bitcoin script. The main difference between the witness stack and traditional Bitcoin script is that instead of pushing things to the stack via a script, the stack is just provided. So all of the encodings are just as if it were a Bitcoin script.

> what is the entire second piece "21025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee6357"

That is the public key, prepended with it's length.

> the first part is the signature but what are the extra bytes on the front and end specifically 0x47 and 0x01

`0x47` is the length of the signature, including the extra byte on the end

`0x01` is a Bitcoin specific byte called the sighash type. This as an enum that indicates what data needs to be included in the message that is hashed for the signature, aka the sighash.

> Most importantly the signature is too long?! it is 70 bytes instead of 64.

No, this signature is [DER encoded](https://en.wikipedia.org/wiki/X.690#DER_encoding), so there ends up being extra bytes to indicate type and length.

> **Comments:**
> **username_0**: You a scholar and saint sir! Thank you again!  

---

