TeachMeBitcoin

What is a Bare Script

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

What is a Bare Script?

A bare script (sometimes called a "bare output") is a locking script that directly expresses its spending conditions without the P2SH wrapper. Before P2SH was introduced in 2012, bare scripts were the only option. Today, they are mostly legacy constructs.

Bare P2PK — The Original Bitcoin Output

The very first Bitcoin transaction ever (the genesis block coinbase) used a bare P2PK output:

// Genesis block output script:
04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIG

This script locks coins to a full (uncompressed) public key directly. To spend it, you provide a signature:

// Unlocking script:
<signature>

// Validation:
<signature> <pubkey> OP_CHECKSIG → [TRUE]

Bare Multisig — M-of-N Without P2SH

Before P2SH, multisig outputs had to use bare multisig scripts. The locking script contained all the public keys:

// 2-of-3 bare multisig:
OP_2 <pubKey1> <pubKey2> <pubKey3> OP_3 OP_CHECKMULTISIG

// Unlocking:
OP_0 <sig1> <sig2>

The problem: the sender had to know all the public keys and include them in the locking script. This made the transaction large and expensive, and it required the sender to know details they shouldn't need to know. P2SH solved this by moving the keys into the redeem script.

Why Bare Scripts Fell Out of Use

Bare scripts have several disadvantages compared to their P2SH or SegWit equivalents:

  1. Size: Bare multisig locking scripts are large. A 2-of-3 bare multisig locking script is ~105 bytes. The P2SH equivalent is just 23 bytes.

  2. Privacy: Anyone can see the spending conditions before the coins are spent.

  3. Wallet compatibility: Older wallets expected P2PKH addresses. Bare scripts don't produce standard addresses.

  4. Relay limits: Bitcoin Core only relays bare multisig up to 3-of-3. Anything larger is non-standard.

Bare Scripts Still Used Today

Despite their disadvantages, bare scripts do still appear:

// OP_RETURN is a bare script (data carrier):
OP_RETURN <arbitrary data up to 80 bytes>

// This is provably unspendable — no valid unlocking script exists
// But it is still technically a "bare" locking script
☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!