ECDSA and Schnorr Signatures: How Bitcoin Transactions Are Signed

ECDSA and Schnorr Signatures: How Bitcoin Transactions Are Signed

ECDSA and Schnorr signatures are the two digital signature schemes Bitcoin uses to authorize spending with a private key. A digital signature is data showing that the holder of a private key approved a message, which anyone with the public key can check. ECDSA (Elliptic Curve Digital Signature Algorithm) is the older scheme; Schnorr signatures were added with Taproot, a 2021 Bitcoin upgrade.

How Does a Digital Signature Work in Bitcoin?

A digital signature is data produced from a message and a private key. In Bitcoin, the message is a transaction’s data, and the signature is the proof that the holder of the private key for the BTC being spent approved that transaction.

A private key is a secret number that only its owner knows. The matching public key is a number derived from the private key that can be shared. A Bitcoin digital signature is designed to authorize a spend without revealing the private key.

The signer holds the private key and creates the signature. The verifier is a node. A node is a computer that connects to the Bitcoin network and checks transactions and blocks against the network’s rules. To check a signature, the node needs only the public key and the signed data.

A node checks a digital signature in four steps:

  1. The node collects the transaction data the signature covers, the public key, and the signature.
  2. The node computes a hash of that data, the same way the signer did. A hash is a fixed-size fingerprint of data.
  3. The node runs the scheme’s check, ECDSA or Schnorr, on the hash, the public key, and the signature.
  4. The check passes or fails, and the node never needs the private key to run it.

What Does a Bitcoin Signature Commit To?

Under the original Bitcoin signing process, a signature covers the entire transaction except the signature scripts, which are the fields that hold the signatures themselves. The signer can narrow that coverage by choosing a signature hash type, a flag that states which parts of the transaction the signature locks in.

Each hash type is illustrated with a made-up transaction that has two inputs and two outputs, labeled input 1, input 2, output 1, and output 2. Each example assumes the signature is made for input 1, and no real data is used.

Signature hash typeWhat the signature coversExample with the made-up transaction
ALL (the default in the original process)All inputs and all outputs.Input 1, input 2, output 1, and output 2 are locked in.
NONEAll inputs and no outputs.Both inputs are locked in, and neither output is covered.
SINGLEAll inputs and only the output with the same index as the input being signed.Both inputs and output 1 are locked in, and output 2 is not covered.
ANYONECANPAYA flag that combines with any of the types above and lets anyone add or remove other inputs.Combined with ALL, both outputs are covered, and other inputs can still be added or removed.

Each input in a transaction names one earlier transaction output that is still unspent, called a UTXO (unspent transaction output), and supplies the data that satisfies it. A signature is made for one input and unlocks that input’s output, and the hash type decides what else the signature commits to.

Taproot, the 2021 Bitcoin upgrade that added Schnorr signatures, has its own default hash type, SIGHASH_DEFAULT. It covers the whole transaction in the same way as ALL.

How Does ECDSA Sign a Transaction?

ECDSA, the Elliptic Curve Digital Signature Algorithm, is the elliptic-curve version of the Digital Signature Algorithm (DSA), a standard method for creating digital signatures. It is approved in FIPS 186, a standard of the U.S. National Institute of Standards and Technology (NIST), so it is a general-purpose standard and not a Bitcoin invention. Bitcoin used ECDSA with a curve named secp256k1 before Schnorr signatures were added with Taproot, so Bitcoin’s ECDSA signatures are secp256k1 signatures. The name secp256k1 refers to one specific elliptic curve, a mathematical curve, that works with 256-bit numbers.

An ECDSA signature is a pair of numbers, called r and s, computed from the message hash, the private key, and a fresh secret number. In Bitcoin the pair is written in DER (Distinguished Encoding Rules), a standard byte format for such numbers. A verifier checks the pair with the public key.

The fresh secret number is called a nonce, a number used once, and ECDSA needs a new random one for every signature. Bitcoin’s community documentation warns that reusing a nonce can let an attacker recover the private key.

ECDSA signs legacy outputs, such as pay-to-public-key-hash (P2PKH) outputs, and the version 0 outputs of SegWit. SegWit (Segregated Witness) is the upgrade defined in Bitcoin Improvement Proposal (BIP) 141, a numbered design document. It moved signatures and scripts into a separate witness structure and gave outputs a version number, and its version 0 outputs are pay-to-witness-public-key-hash (P2WPKH) and pay-to-witness-script-hash (P2WSH).

For SegWit version 0, the signed hash is a double SHA-256 hash, which means SHA-256 applied twice, of the transaction fields that BIP 143 lists, including the value of the input being spent. The public key that goes with an ECDSA signature is 33 bytes in its compressed form. A compressed public key is written as a one-byte prefix followed by the 32-byte X coordinate, which makes 33 bytes in total.

What Did Schnorr Signatures Add to Bitcoin?

A Schnorr signature is a digital signature scheme that BIP 340 specifies for Bitcoin, on the same secp256k1 curve as ECDSA. BIP 340 is the proposal that defines the scheme, and in Bitcoin the term Schnorr signature refers to that scheme.

BIP 340 signatures have a fixed format of 64 bytes, and their public keys are 32 bytes. A public key is a point on the curve, described by an X coordinate and a Y coordinate. An x-only key is written as its X coordinate alone, and BIP 340 fixes the Y coordinate by rule to be even, so it does not need to be written. The 64-byte signature is made of two 32-byte parts.

BIP 340 lists what the scheme supports. Batch verification means checking many signatures together instead of one by one, and BIP 340 says this allows significant speedups. Linearity means that collaborating signers can produce one signature that is valid for the sum of their public keys, which is how keys can be combined. BIP 340 says that constructions which combine keys this way can improve efficiency and privacy. That statement is about key-combining constructions, not about every Schnorr signature.

Like ECDSA, a Schnorr signature uses a fresh secret number for each signature. BIP 340 specifies how the signer derives that number from the private key, the public key, the message, and extra random data added at signing time.

Which Scheme Signs Which Output, and Where Does Taproot Fit?

Taproot is a soft fork, an upgrade that tightens Bitcoin’s rules so that older software keeps working unchanged. It added SegWit version 1 outputs, and spending one of them through its key path takes a Schnorr signature. Taproot activated at block height 709,632 in November 2021.

Taproot signatures on the key path are Schnorr signatures as BIP 340 defines them. The key path is the spending route that uses a single signature, and that signature is 64 bytes with the default hash type. It is 65 bytes when a sighash byte, which names the signature hash type, is appended.

Taproot did not remove ECDSA. Schnorr signatures were added for version 1 outputs, while legacy and SegWit version 0 outputs are still signed with ECDSA, so both schemes are in use at once. The main difference is that ECDSA signs legacy and SegWit version 0 outputs with variable-size DER signatures, while Schnorr signs Taproot outputs with a fixed 64-byte format and 32-byte x-only public keys.

FeatureECDSASchnorr (BIP 340)
In Bitcoin sinceBefore TaprootTaproot activation (block 709,632, November 2021)
Output typesLegacy and SegWit version 0 (P2WPKH, P2WSH)Taproot (SegWit version 1)
Curvesecp256k1secp256k1
Public key size (bytes)33 (compressed)32 (x-only)
Signature size (bytes)Variable, up to 72 (DER-encoded)64 with the default hash type, 65 with a sighash byte
SpecificationFIPS 186 (algorithm), BIP 66 (encoding), and BIP 143 (SegWit digest)BIP 340

The two signature sizes are a rough comparison, not an exact one. Documents count the sighash byte of an ECDSA signature differently, so their ceilings are 72 bytes in one and 73 bytes in another, while the Schnorr figures are given both with and without that byte.

What Can a Signature Not Tell You?

A valid digital signature shows that someone holding the private key authorized the spend. It does not show who that person is. Anyone who has copied the private key can produce an equally valid signature.

A digital signature does not hide the payment. A Bitcoin transaction is recorded on the public blockchain, and the signature is part of that transaction’s data, so anyone can look at it.

Forging an ECDSA or Schnorr signature without the private key is designed to be infeasible. That phrase describes how the schemes are designed, not a promise that no one will ever find a way.

November 18, 2026

GoMining News

You might be interested in: