Because the title says I am attempting to extract bc1 addresses by utilizing opcodes I’ve discovered from studying about bitcoin on-line. Nonetheless, I can’t truly discover the opcodes related to bc1. The segwit outputs right here are described as, from what I collect, not having OP codes. How can this be? Absolutely I am misunderstanding one thing. Can anybody elaborate?

Native segwit scriptPubKeys are of the shape OP_n + <knowledge>, so first a single quantity opcode adopted by a push of some knowledge (known as the witness program). Particularly:

  • For P2WPKH (pay to witness pubkey hash, BIP141), OP_0 adopted by a push of 20 bytes. These 20 bytes are the Hash160 of a public key. Their corresponding handle format is outlined by BIP173.
  • For P2WSH (pay to witness script hash, BIP141), OP_0 adopted by a push of 32 bytes. These 32 bytes are the SHA256 of a script. Their corresponding handle format is outlined by BIP173 as nicely.
  • For P2TR (pay to taproot, BIP341), OP_1 adopted by a push of 32 bytes. These 32 bytes are a tweaked x-only public key. Their corresponding handle format is outlined by BIP350.
  • For future witness variations, any OP_1 by way of OP_16 adopted by a push of one thing between 2 and 40 bytes (besides OP_1 adopted by 32 bytes, which is P2TR). These too have addresses related to them in BIP350, however no semantics (but).

Usually, native segwit outputs don’t include any “energetic” opcodes like OP_CHECKSIG or OP_HASH160 or something like that, they’re simply stubs that push some knowledge. The segwit (and taproot) consensus guidelines know the right way to interpret them.

7

I feel you might be misunderstanding how an handle is constructed and the place scripting opcodes match into that. The bc1 signifies the usage of the bech32 handle format for SegWit variations as outlined in BIP 173 and in addition damaged down right here. The hash of the witness script (SegWit model 0) or the tweaked inside key (SegWit model 1) is included inside that handle. The opcodes used within the witness script or the tweak of the inner key are solely revealed on spending from the handle. So to view and analyze the opcodes you might want to have a look at the transactions spending from a selected handle quite than the transactions sending to a selected handle.

2