0

Can we compare Bitcoin script and Ethereum smart contract ?

And if yes,

What are differences/similarities of Bitcoin script and Ethereum smart contract in sense of functionality, architecture and how to interact with blockchain?

Does Bitcoin script run on-chain (similar to Ethereum smart contracts) or they run off-chain?

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.