What is Nostr?
Kostas Karasavvas [ARCHIVE] /
npub1tqa…3e9m
2023-06-07 18:18:23
in reply to nevent1q…vxed

Kostas Karasavvas [ARCHIVE] on Nostr: 📅 Original date posted:2019-05-27 📝 Original message:On Sun, May 26, 2019 at ...

📅 Original date posted:2019-05-27
📝 Original message:On Sun, May 26, 2019 at 5:07 PM Aymeric Vitte via bitcoin-dev <
bitcoin-dev at lists.linuxfoundation.org> wrote:

> I realized recently that my segwit implementation was not correct,
> basically some time ago, wrongly reading the specs (and misleaded by
> what follows), I thought that scriptsig would go into witness data as it
> was, but that's not the case, op_pushdata is replaced by varlen
>
> Now reading correctly the specs, they seem to be not totally correct,
> then the first question is: why OP_0 is 00 in witness data and not 0100?
> Does this apply to other op_codes? This does not look logical at all
>
>
op_pushdata allows for unsigned integers and thus it uses the extra byte to
specify that.

A varint (varlen) is unsigned. 0 and anything <= 252 is one byte length,
so 00.


> The second question is: why for non segwit inputs there is a 00 length
> in segwit data, what is the rational for that? It should just be nothing
> since you don't need this to reconciliate things
>
>
Because you don't have the number of witnesses as you have for
inputs/outputs. The witness data length is assumed to be the same as the
inputs length. And then for non-segwit inputs you need the 00 to specify
that it is empty.

Hope that helps.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20190527/b1ee6569/attachment.html>;
Author Public Key
npub1tqac06nxg94veg9atxfktrfdwpl2a4snw2xdrt52ek5893jnnkkqey3e9m