Differences/similarities of “Bitcoin script” and “Ethereum smart contract”?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite
1












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?










share|improve this question

















  • 2




    As far as I've understood, the biggest difference is that Ethereum's engine is Turing-complete while Bitcoin's is not. Someone else will hopefully elaborate further.
    – Lauri Peltonen
    Aug 29 at 8:54














up vote
4
down vote

favorite
1












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?










share|improve this question

















  • 2




    As far as I've understood, the biggest difference is that Ethereum's engine is Turing-complete while Bitcoin's is not. Someone else will hopefully elaborate further.
    – Lauri Peltonen
    Aug 29 at 8:54












up vote
4
down vote

favorite
1









up vote
4
down vote

favorite
1






1





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?










share|improve this question













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?







bitcoin terminology






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 29 at 8:52









sas

592210




592210







  • 2




    As far as I've understood, the biggest difference is that Ethereum's engine is Turing-complete while Bitcoin's is not. Someone else will hopefully elaborate further.
    – Lauri Peltonen
    Aug 29 at 8:54












  • 2




    As far as I've understood, the biggest difference is that Ethereum's engine is Turing-complete while Bitcoin's is not. Someone else will hopefully elaborate further.
    – Lauri Peltonen
    Aug 29 at 8:54







2




2




As far as I've understood, the biggest difference is that Ethereum's engine is Turing-complete while Bitcoin's is not. Someone else will hopefully elaborate further.
– Lauri Peltonen
Aug 29 at 8:54




As far as I've understood, the biggest difference is that Ethereum's engine is Turing-complete while Bitcoin's is not. Someone else will hopefully elaborate further.
– Lauri Peltonen
Aug 29 at 8:54










1 Answer
1






active

oldest

votes

















up vote
5
down vote













There are a couple of differences between Bitcoin scripts and Ethereum smart contracts.



USE



BITCOIN



In bitcoin the transaction have a different format from Ethereum:




A transaction typically references previous transaction outputs as new transaction inputs and dedicates all input Bitcoin values to new outputs.




So a transaction is formed by one or more transaction input (i.e., the output of previous transactions) and one or more transaction output.



The transaction outputs specify a locking script (e.g. "only the user with the private key corresponding to address 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2 can unlock this script") that defines the condition to spend the output. Whenever the transaction output is used as input in a new transaction, it must contain an unlocking script that "solves" the locking script. Those script are specified with the bitcoin script.



So, the scripts are used in Bitcoin to validate the transaction, therefore they should be run on chain, i.e. by each full node in the network.



ETHEREUM



The transactions do not reference previous transactions, because Ethereum stores directly the world-state (In bitcoin the state corresponds to the list of unspent transaction outputs (UTXO)).



In Ethreum a transaction may trigger the execution of a smart-contract if the receiver of the message call is a contract account or it may create a contract that persists on the world state.



In Ethereum the smart-contracts can be used to write applications on top of Ethereum.



Similarity/Differences



Both the execution environments of Ethereum smart contracts and Bitcoin scripts are stack-based and deterministic.



The main difference between bitcoin scripts and Ethereum smart contracts is the Turing completeness: bitcoin scripts do not have loops and neither recursion and have a language that is less expressive than a DFA (Deterministic Finite Automaton), as reported here, while the Ethereum Virtual Machine (EVM) is Turing complete (if we associate a gas price equals to 0).



Another major difference is the fact that the Bitcoin Script does not have a notion of state (as reported here) and all the information needed is contained in the locking and unlocking scripts. Whereas Ethereum smart contracts have contract storage that can influence the behavior of the program.



Moreover, bitcoin programs are part of the respective transactions, so, when with pruning some transactions are forgotten, also the corresponding scripts are forgotten. In Ethereum the smart contract code are persistent on the state and can be canceled only if the SELFDESTRUCT opcode is explicitly called during the execution of the smart contract.






share|improve this answer






















  • And bitcoin script is run on-chain (like smart contract) ? Or they run similar to something like Javascript in web3.js? Thanks
    – sas
    Aug 29 at 11:19






  • 1




    Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly
    – Henk
    Aug 29 at 11:30










  • Hi, please see my edit, I added a premise about bitcoin's and ethereum's transaction format. Let me know if the edited version is better than the previous one, otherwise I will revert the changes.
    – Briomkez
    Aug 29 at 15:22










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "642"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f57660%2fdifferences-similarities-of-bitcoin-script-and-ethereum-smart-contract%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
5
down vote













There are a couple of differences between Bitcoin scripts and Ethereum smart contracts.



USE



BITCOIN



In bitcoin the transaction have a different format from Ethereum:




A transaction typically references previous transaction outputs as new transaction inputs and dedicates all input Bitcoin values to new outputs.




So a transaction is formed by one or more transaction input (i.e., the output of previous transactions) and one or more transaction output.



The transaction outputs specify a locking script (e.g. "only the user with the private key corresponding to address 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2 can unlock this script") that defines the condition to spend the output. Whenever the transaction output is used as input in a new transaction, it must contain an unlocking script that "solves" the locking script. Those script are specified with the bitcoin script.



So, the scripts are used in Bitcoin to validate the transaction, therefore they should be run on chain, i.e. by each full node in the network.



ETHEREUM



The transactions do not reference previous transactions, because Ethereum stores directly the world-state (In bitcoin the state corresponds to the list of unspent transaction outputs (UTXO)).



In Ethreum a transaction may trigger the execution of a smart-contract if the receiver of the message call is a contract account or it may create a contract that persists on the world state.



In Ethereum the smart-contracts can be used to write applications on top of Ethereum.



Similarity/Differences



Both the execution environments of Ethereum smart contracts and Bitcoin scripts are stack-based and deterministic.



The main difference between bitcoin scripts and Ethereum smart contracts is the Turing completeness: bitcoin scripts do not have loops and neither recursion and have a language that is less expressive than a DFA (Deterministic Finite Automaton), as reported here, while the Ethereum Virtual Machine (EVM) is Turing complete (if we associate a gas price equals to 0).



Another major difference is the fact that the Bitcoin Script does not have a notion of state (as reported here) and all the information needed is contained in the locking and unlocking scripts. Whereas Ethereum smart contracts have contract storage that can influence the behavior of the program.



Moreover, bitcoin programs are part of the respective transactions, so, when with pruning some transactions are forgotten, also the corresponding scripts are forgotten. In Ethereum the smart contract code are persistent on the state and can be canceled only if the SELFDESTRUCT opcode is explicitly called during the execution of the smart contract.






share|improve this answer






















  • And bitcoin script is run on-chain (like smart contract) ? Or they run similar to something like Javascript in web3.js? Thanks
    – sas
    Aug 29 at 11:19






  • 1




    Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly
    – Henk
    Aug 29 at 11:30










  • Hi, please see my edit, I added a premise about bitcoin's and ethereum's transaction format. Let me know if the edited version is better than the previous one, otherwise I will revert the changes.
    – Briomkez
    Aug 29 at 15:22














up vote
5
down vote













There are a couple of differences between Bitcoin scripts and Ethereum smart contracts.



USE



BITCOIN



In bitcoin the transaction have a different format from Ethereum:




A transaction typically references previous transaction outputs as new transaction inputs and dedicates all input Bitcoin values to new outputs.




So a transaction is formed by one or more transaction input (i.e., the output of previous transactions) and one or more transaction output.



The transaction outputs specify a locking script (e.g. "only the user with the private key corresponding to address 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2 can unlock this script") that defines the condition to spend the output. Whenever the transaction output is used as input in a new transaction, it must contain an unlocking script that "solves" the locking script. Those script are specified with the bitcoin script.



So, the scripts are used in Bitcoin to validate the transaction, therefore they should be run on chain, i.e. by each full node in the network.



ETHEREUM



The transactions do not reference previous transactions, because Ethereum stores directly the world-state (In bitcoin the state corresponds to the list of unspent transaction outputs (UTXO)).



In Ethreum a transaction may trigger the execution of a smart-contract if the receiver of the message call is a contract account or it may create a contract that persists on the world state.



In Ethereum the smart-contracts can be used to write applications on top of Ethereum.



Similarity/Differences



Both the execution environments of Ethereum smart contracts and Bitcoin scripts are stack-based and deterministic.



The main difference between bitcoin scripts and Ethereum smart contracts is the Turing completeness: bitcoin scripts do not have loops and neither recursion and have a language that is less expressive than a DFA (Deterministic Finite Automaton), as reported here, while the Ethereum Virtual Machine (EVM) is Turing complete (if we associate a gas price equals to 0).



Another major difference is the fact that the Bitcoin Script does not have a notion of state (as reported here) and all the information needed is contained in the locking and unlocking scripts. Whereas Ethereum smart contracts have contract storage that can influence the behavior of the program.



Moreover, bitcoin programs are part of the respective transactions, so, when with pruning some transactions are forgotten, also the corresponding scripts are forgotten. In Ethereum the smart contract code are persistent on the state and can be canceled only if the SELFDESTRUCT opcode is explicitly called during the execution of the smart contract.






share|improve this answer






















  • And bitcoin script is run on-chain (like smart contract) ? Or they run similar to something like Javascript in web3.js? Thanks
    – sas
    Aug 29 at 11:19






  • 1




    Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly
    – Henk
    Aug 29 at 11:30










  • Hi, please see my edit, I added a premise about bitcoin's and ethereum's transaction format. Let me know if the edited version is better than the previous one, otherwise I will revert the changes.
    – Briomkez
    Aug 29 at 15:22












up vote
5
down vote










up vote
5
down vote









There are a couple of differences between Bitcoin scripts and Ethereum smart contracts.



USE



BITCOIN



In bitcoin the transaction have a different format from Ethereum:




A transaction typically references previous transaction outputs as new transaction inputs and dedicates all input Bitcoin values to new outputs.




So a transaction is formed by one or more transaction input (i.e., the output of previous transactions) and one or more transaction output.



The transaction outputs specify a locking script (e.g. "only the user with the private key corresponding to address 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2 can unlock this script") that defines the condition to spend the output. Whenever the transaction output is used as input in a new transaction, it must contain an unlocking script that "solves" the locking script. Those script are specified with the bitcoin script.



So, the scripts are used in Bitcoin to validate the transaction, therefore they should be run on chain, i.e. by each full node in the network.



ETHEREUM



The transactions do not reference previous transactions, because Ethereum stores directly the world-state (In bitcoin the state corresponds to the list of unspent transaction outputs (UTXO)).



In Ethreum a transaction may trigger the execution of a smart-contract if the receiver of the message call is a contract account or it may create a contract that persists on the world state.



In Ethereum the smart-contracts can be used to write applications on top of Ethereum.



Similarity/Differences



Both the execution environments of Ethereum smart contracts and Bitcoin scripts are stack-based and deterministic.



The main difference between bitcoin scripts and Ethereum smart contracts is the Turing completeness: bitcoin scripts do not have loops and neither recursion and have a language that is less expressive than a DFA (Deterministic Finite Automaton), as reported here, while the Ethereum Virtual Machine (EVM) is Turing complete (if we associate a gas price equals to 0).



Another major difference is the fact that the Bitcoin Script does not have a notion of state (as reported here) and all the information needed is contained in the locking and unlocking scripts. Whereas Ethereum smart contracts have contract storage that can influence the behavior of the program.



Moreover, bitcoin programs are part of the respective transactions, so, when with pruning some transactions are forgotten, also the corresponding scripts are forgotten. In Ethereum the smart contract code are persistent on the state and can be canceled only if the SELFDESTRUCT opcode is explicitly called during the execution of the smart contract.






share|improve this answer














There are a couple of differences between Bitcoin scripts and Ethereum smart contracts.



USE



BITCOIN



In bitcoin the transaction have a different format from Ethereum:




A transaction typically references previous transaction outputs as new transaction inputs and dedicates all input Bitcoin values to new outputs.




So a transaction is formed by one or more transaction input (i.e., the output of previous transactions) and one or more transaction output.



The transaction outputs specify a locking script (e.g. "only the user with the private key corresponding to address 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2 can unlock this script") that defines the condition to spend the output. Whenever the transaction output is used as input in a new transaction, it must contain an unlocking script that "solves" the locking script. Those script are specified with the bitcoin script.



So, the scripts are used in Bitcoin to validate the transaction, therefore they should be run on chain, i.e. by each full node in the network.



ETHEREUM



The transactions do not reference previous transactions, because Ethereum stores directly the world-state (In bitcoin the state corresponds to the list of unspent transaction outputs (UTXO)).



In Ethreum a transaction may trigger the execution of a smart-contract if the receiver of the message call is a contract account or it may create a contract that persists on the world state.



In Ethereum the smart-contracts can be used to write applications on top of Ethereum.



Similarity/Differences



Both the execution environments of Ethereum smart contracts and Bitcoin scripts are stack-based and deterministic.



The main difference between bitcoin scripts and Ethereum smart contracts is the Turing completeness: bitcoin scripts do not have loops and neither recursion and have a language that is less expressive than a DFA (Deterministic Finite Automaton), as reported here, while the Ethereum Virtual Machine (EVM) is Turing complete (if we associate a gas price equals to 0).



Another major difference is the fact that the Bitcoin Script does not have a notion of state (as reported here) and all the information needed is contained in the locking and unlocking scripts. Whereas Ethereum smart contracts have contract storage that can influence the behavior of the program.



Moreover, bitcoin programs are part of the respective transactions, so, when with pruning some transactions are forgotten, also the corresponding scripts are forgotten. In Ethereum the smart contract code are persistent on the state and can be canceled only if the SELFDESTRUCT opcode is explicitly called during the execution of the smart contract.







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 30 at 11:23

























answered Aug 29 at 10:25









Briomkez

516122




516122











  • And bitcoin script is run on-chain (like smart contract) ? Or they run similar to something like Javascript in web3.js? Thanks
    – sas
    Aug 29 at 11:19






  • 1




    Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly
    – Henk
    Aug 29 at 11:30










  • Hi, please see my edit, I added a premise about bitcoin's and ethereum's transaction format. Let me know if the edited version is better than the previous one, otherwise I will revert the changes.
    – Briomkez
    Aug 29 at 15:22
















  • And bitcoin script is run on-chain (like smart contract) ? Or they run similar to something like Javascript in web3.js? Thanks
    – sas
    Aug 29 at 11:19






  • 1




    Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly
    – Henk
    Aug 29 at 11:30










  • Hi, please see my edit, I added a premise about bitcoin's and ethereum's transaction format. Let me know if the edited version is better than the previous one, otherwise I will revert the changes.
    – Briomkez
    Aug 29 at 15:22















And bitcoin script is run on-chain (like smart contract) ? Or they run similar to something like Javascript in web3.js? Thanks
– sas
Aug 29 at 11:19




And bitcoin script is run on-chain (like smart contract) ? Or they run similar to something like Javascript in web3.js? Thanks
– sas
Aug 29 at 11:19




1




1




Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly
– Henk
Aug 29 at 11:30




Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly
– Henk
Aug 29 at 11:30












Hi, please see my edit, I added a premise about bitcoin's and ethereum's transaction format. Let me know if the edited version is better than the previous one, otherwise I will revert the changes.
– Briomkez
Aug 29 at 15:22




Hi, please see my edit, I added a premise about bitcoin's and ethereum's transaction format. Let me know if the edited version is better than the previous one, otherwise I will revert the changes.
– Briomkez
Aug 29 at 15:22

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f57660%2fdifferences-similarities-of-bitcoin-script-and-ethereum-smart-contract%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay