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

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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