karask / python-bitcoin-utils

Library to interact with the Bitcoin network. Ideal for low-level learning and experimenting.
MIT License
271 stars 102 forks source link

TODO: added `op_checksigadd` to `op_codes` #95

Closed AdvaitPote closed 4 months ago

AdvaitPote commented 5 months ago

As per the newly added TODO, I have added OP_CHECKSIGADD to op_codes.

karask commented 5 months ago

Hi @AdvaitPote,

Unfortunately this is not that simple. That opcode is only valid for taproot. There are other differences as well. They all need to be group appropriately and checked only for tapscripts.

AdvaitPote commented 5 months ago

Yes, you did mention in the TODO that some other tapscript changes would need to be made. So would these opcodes need to be added elsewhere along with some tapscript functionalities? Unfortunately, in all of the courses we took and our assignment, Taproot was out of scope so I am not much aware of the same. I was thinking we would add these opcodes to script.py and then add those same tapscript reading features in the Script class itself.

karask commented 5 months ago

I believe it would be cleaner if completely new dicitionaries should be used for tapscript (if the changes are many it could be a new file tapscript.py, otherwise it could go into script). Then if the specific tx's output is segwit v1 consult the new dictionary for the opcodes, otherwise use the current dictionaries.

AdvaitPote commented 5 months ago

Makes sense! Making a new Tapscript class or a tapscript.py would be helpful too because as more updates will be made, managing them in a separate file would be more convenient.

karask commented 4 months ago

I am closing this for. Re-open if you want to work on it.