# OP\_CODESEPARATOR: Selective Script Signing

<figure><img src="/files/NrKSAsLMyOqh5RSuzR95" alt=""><figcaption></figcaption></figure>

OP\_CODESEPARATOR controls **which portions of a script** are included when creating and verifying signatures.

| Opcode            | Input   | Output  | Description                                                                                                                            |
| ----------------- | ------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| OP\_CODESEPARATOR | Nothing | Nothing | Marks a boundary in the script. Signature verification operations only consider script content after the most recent OP\_CODESEPARATOR |

#### OP\_CODESEPARATOR Example: Witnessed Contract

**scriptSig:**

```
<witness_signature> <witness_public_key> <witness_name> <signatory_signature>
```

**scriptPubKey:**

```
OP_CODESEPARATOR
<contract_hash> OP_DROP
<signatory_public_key> OP_CHECKSIGVERIFY
OP_CODESEPARATOR
<witness_statement> OP_2DROP
OP_CHECKSIG
```

This pattern allows the witness to attest to the signing party's identity **without seeing the full contract content**. The witness signs only the witness statement, not the contract hash.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hub.bsvblockchain.org/higher-learning/bsv-academy/bsv-opcodes/cryptographic-functions/op_codeseparator-selective-script-signing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
