## Definition

A smart contract is a set of spending rules enforced by blockchain software instead of a company, bank, or court. On Bitcoin, this usually means conditions written with [Bitcoin Script](https://developer.bitcoin.org/devguide/transactions.html#standard-transactions), such as requiring a valid digital signature, multiple signatures, a hash preimage, or a timelock before coins can move. Bitcoin smart contracts are intentionally limited compared with general-purpose platforms, but they are not optional extras. Every Bitcoin transaction depends on script rules that define who may spend each output.

## How It Works

When a Bitcoin user spends coins, the new transaction must satisfy the locking conditions attached to the previous transaction output. A simple payment effectively says that only the owner of a specific public key can spend the coins. More advanced scripts can require two-of-three signatures, delay spending until a certain block height, or support payment channels such as the [Lightning Network](/glossary/lightning-network).

Miners do not run arbitrary application code while mining. Their main job is to assemble valid transactions, build a candidate block, and perform proof-of-work hashing until the block header is below the current target. Before a pool mines on a block template, its node checks that each input is unspent, that scripts evaluate successfully, and that [consensus rules](https://developer.bitcoin.org/reference/transactions.html) are not broken. If an invalid smart-contract spend is included, other nodes reject the block, making the miner's work and expected reward useless.

## Why It Matters

Smart contracts matter to Bitcoin mining because miners are paid only when the network accepts their blocks. Hash rate helps a miner find a valid block header, but validation determines whether that block is worth anything. A block can have valid [Proof of Work](/glossary/proof-of-work) and still be rejected if it contains a transaction that fails its script checks or spends coins before a [timelock](https://en.bitcoin.it/wiki/Timelock) expires.

For users and miners, Bitcoin's constrained contract model is a tradeoff. It avoids many risks of complex on-chain programs while still enabling custody controls, escrow-like arrangements, vault designs, payment channels, and pool payout transactions. Mining pools may use off-chain accounting rules to track shares and calculate rewards, but Bitcoin itself enforces only the final on-chain transactions that appear in accepted blocks.

## Related Terms

Smart contracts connect transaction rules with mining incentives. Related ideas include transaction validation, block templates, timelocks, multisignature wallets, and transaction fees. To place the term in the broader mining workflow, review [What is Bitcoin Mining?](/glossary/what-is-bitcoin-mining), which covers block construction, rewards, and competition between miners. It also helps to understand wallets, private keys, and digital signatures, because most Bitcoin scripts ultimately prove that the spender has authority to move specific coins.
