As they say, Ethereum is Turing complete, Bitcoin script is intentionally not Turing complete.
Ethereum has a virtual machine with a set of opcodes. Bitcoin script is defined by different opcodes, defined in src/script/script.h
. There are good descriptions of the opcodes at https://en.bitcoin.it/wiki/Script.
Differences include:
- Ethereum charges for each operation: https://github.com/djrtwo/evm-opcode-gas-costs to account for differences in computation difficulty.
- Bitcoin scripts are limited to a certain complexity (e.g. num of sigops) to prevent DoS attacks.
Similarities include:
- Contracts live on the blockchain. In an Ethereum-specific binary format (EVM bytecode), and in Bitcoin as Bitcoin Script.
Does Bitcoin script run on-chain (similar to Ethereum smart contracts)
or they run off-chain?
Yes. Script can be stored in 3 places in a transaction: witness
, scriptSig
and scriptPubkey
. These transactions are stored in blocks on the blockchain, and are run by nodes validating them.