---
title: "OP_CHECKSIG — definition | Nuri Glossary"
description: "The core operation verifying that a signature matches a public key."
lang: "en"
type: "glossary-term"
canonical: "https://nuri.com/glossary/op-checksig"
---

# OP_CHECKSIG

The core operation verifying that a signature matches a public key.

## Basically

OP_CHECKSIG checks that you are allowed to spend bitcoin. It does this without revealing your secret key.

## Key Takeaways

- OP_CHECKSIG (opcode 0xac) is the Bitcoin Script instruction that verifies a digital signature against a public key. It is the core mechanism that proves ownership of bitcoin and authorises spending.
- In legacy and SegWit transactions, OP_CHECKSIG verifies ECDSA signatures on the secp256k1 curve. In Taproot script-path spends, it verifies Schnorr signatures instead, enabling batch verification and simpler multisig constructions.
- Sighash flags appended to each signature control which parts of the transaction OP_CHECKSIG commits to. They enable advanced spending conditions like anyone-can-pay fundraising and single-output binding.

## What Is OP_CHECKSIG?

OP_CHECKSIG is the Bitcoin Script opcode responsible for verifying that a digital signature is valid for a given public key and transaction context. Every time you spend bitcoin, the network must confirm that you control the private key corresponding to the locking script. OP_CHECKSIG performs this check by popping a public key and a signature from the stack, computing a hash of the transaction data, and running cryptographic verification against that hash.
Without OP_CHECKSIG, Bitcoin would have no way to enforce ownership. It is present, either explicitly or implicitly, in virtually every standard transaction type: P2PKH, P2WPKH, and Taproot script-path spends all rely on it. Even SegWit v0 P2WPKH inputs use an implicit script containing OP_CHECKSIG under the hood.

## How It Works

OP_CHECKSIG operates differently depending on the transaction type: legacy, SegWit v0, or Tapscript. The core concept remains the same: hash the relevant parts of the transaction, then verify the signature against that hash using the provided public key.

## Legacy Transaction Verification

In legacy (pre-SegWit) transactions, OP_CHECKSIG follows a multi-step process. That process dates back to the original Bitcoin implementation.
A single verification is computationally straightforward. At scale, every node on the network must execute OP_CHECKSIG for every input of every transaction it validates.

## SegWit v0 Verification

Segregated Witness (BIP 143) introduced a new transaction digest algorithm that fixed quadratic hashing issues and eliminated the FindAndDelete step for witness scripts. The sighash computation precommits to the value being spent, preventing offline signing attacks. P2WPKH inputs use an implicit scriptCode equivalent to the P2PKH pattern.
The script is not written on-chain: consensus rules construct it internally when validating P2WPKH outputs. The signature and public key are provided in the witness data, separate from the scriptSig.

## Tapscript Verification (BIP 342)

Taproot introduced the most significant change to OP_CHECKSIG since Bitcoin's creation. Within Tapscript, the scripting rules for Taproot script-path spends, OP_CHECKSIG now verifies Schnorr signatures per BIP 340 instead of ECDSA.
Key-path spends, the most common Taproot spend, do not execute OP_CHECKSIG at all: the Taproot validation rules verify the Schnorr signature directly against the tweaked output key. OP_CHECKSIG only runs in script-path spends where the revealed script contains it. For a deeper look at how Taproot changed Bitcoin's signature model, see the Taproot and Schnorr signatures explainer.

## Sighash Flags

The sighash flag appended to each signature tells OP_CHECKSIG which parts of the transaction to include in the digest. It determines what the signer is committing to and what remains modifiable after signing.
SIGHASH_ALL is the default used by virtually all consumer wallets. The ANYONECANPAY modifier (0x80) allows additional inputs to be added after signing, enabling patterns like crowdfunding transactions where multiple parties contribute inputs towards fixed outputs.

## Common Script Patterns

OP_CHECKSIG appears in several standard Bitcoin Script patterns. These patterns show how the opcode fits into real transaction validation.

## P2PKH (Pay-to-Public-Key-Hash)

P2PKH (Pay-to-Public-Key-Hash) is the most widely used legacy transaction type. It first verifies that the public key hashes to the expected value, then checks the signature.

## P2PK (Pay-to-Public-Key)

P2PK (Pay-to-Public-Key) is the simplest pattern, used in early Bitcoin transactions including the genesis block. The public key is embedded directly in the locking script.
P2PK is considered obsolete because it exposes the public key on-chain before spending. Hash-based outputs offer more privacy.

## OP_CHECKSIGADD in Tapscript

BIP 342 introduced OP_CHECKSIGADD (opcode 0xba) as a replacement for OP_CHECKMULTISIG in Tapscript. OP_CHECKMULTISIG was disabled in Tapscript because its trial-and-skip approach to matching signatures with keys is incompatible with Schnorr batch verification.
OP_CHECKSIGADD pops a public key, a counter, and a signature. If the signature is valid, it increments the counter. A 2-of-3 multisig in Tapscript uses this pattern.
Each valid signature increments the counter by one, and the final OP_NUMEQUAL checks that exactly two signatures were valid. This pattern is compatible with batch verification and makes multisig spending policies straightforward in Taproot. For more on how Bitcoin handles multi-party signing, see the research on MuSig2 multisignatures.

## Sigops Budget and Script Cost

Each OP_CHECKSIG execution consumes "sigops", or signature operations. Bitcoin uses sigops to limit the computational cost of block validation.
The Tapscript budgeting model is more flexible. Larger witnesses, which pay higher fees due to weight, earn a larger sigops budget, aligning economic incentives with validation cost.

## Standard Payments

Every standard Bitcoin payment uses OP_CHECKSIG. When you send bitcoin from a wallet, the transaction includes a signature proving you control the private key for the UTXO being spent. The receiving node executes OP_CHECKSIG to verify this proof before accepting the transaction.

## Multisignature Wallets

Multisig wallets use multiple OP_CHECKSIG operations, or OP_CHECKSIGADD in Tapscript, to require signatures from more than one key. This is the foundation of threshold signature schemes used in institutional custody, joint accounts, and layer-2 protocols.

## Layer-2 Protocols

Lightning Network channels, Spark, and other layer-2 systems build on OP_CHECKSIG to enforce off-chain state transitions. HTLCs combine OP_CHECKSIG with timelocks and hash checks to create conditional payment paths. For an overview of how these layers scale Bitcoin, see the layer-2 scaling research.

## Covenant and Advanced Scripts

Proposed opcodes like OP_VAULT and OP_CAT would work alongside OP_CHECKSIG to enable covenants: spending conditions that restrict where bitcoin can be sent next. These proposals rely on OP_CHECKSIG as the base authorisation primitive. For more on Bitcoin's programmability, see the Bitcoin Script programmability research.

## Historical Bugs

OP_CHECKSIG's legacy implementation carries several consensus-locked quirks. They cannot be fixed without a hard fork.

## Nonce Reuse

ECDSA signature security depends on a unique random nonce for each signing operation. If the same nonce is reused for two different signatures with the same private key, the private key can be algebraically recovered. This is not a flaw in OP_CHECKSIG itself but a critical requirement for wallet implementations, and deterministic nonce generation (RFC 6979) mitigates this risk.

## Quantum Computing Threat

Both ECDSA and Schnorr signatures rely on the difficulty of the elliptic curve discrete logarithm problem. A sufficiently powerful quantum computer running Shor's algorithm could break these schemes. Hash-based output types (P2PKH, P2WPKH) offer partial protection because the public key is only revealed at spend time, but P2PK outputs, where the public key is already exposed, would be immediately vulnerable.
The glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.
Part of the [Nuri glossary](https://nuri.com/glossary), which defines 1876 Bitcoin, Lightning, wallet, stablecoin and payment terms.
