Differences/similarities of "Bitcoin script" and "Ethereum smart contract"?

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?

Questioner

Posted 2018-08-29T08:47:09.957

Reputation: 906

Answers

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.

JBaczuk

Posted 2018-08-29T08:47:09.957

Reputation: 6 172