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










5















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 '18 at 8:54















5















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 '18 at 8:54













5












5








5


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 '18 at 8:52









QuestionerQuestioner

860415




860415







  • 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 '18 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 '18 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 '18 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 '18 at 8:54










1 Answer
1






active

oldest

votes


















6














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 limits equals to infinite).



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

    – Questioner
    Aug 29 '18 at 11:19






  • 1





    Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly

    – Henk
    Aug 29 '18 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 '18 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',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
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















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









6














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 limits equals to infinite).



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

    – Questioner
    Aug 29 '18 at 11:19






  • 1





    Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly

    – Henk
    Aug 29 '18 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 '18 at 15:22















6














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 limits equals to infinite).



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

    – Questioner
    Aug 29 '18 at 11:19






  • 1





    Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly

    – Henk
    Aug 29 '18 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 '18 at 15:22













6












6








6







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 limits equals to infinite).



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 limits equals to infinite).



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 Oct 6 '18 at 10:53

























answered Aug 29 '18 at 10:25









BriomkezBriomkez

1,1541426




1,1541426












  • And bitcoin script is run on-chain (like smart contract) ? Or they run similar to something like Javascript in web3.js? Thanks

    – Questioner
    Aug 29 '18 at 11:19






  • 1





    Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly

    – Henk
    Aug 29 '18 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 '18 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

    – Questioner
    Aug 29 '18 at 11:19






  • 1





    Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly

    – Henk
    Aug 29 '18 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 '18 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

– Questioner
Aug 29 '18 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

– Questioner
Aug 29 '18 at 11:19




1




1





Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly

– Henk
Aug 29 '18 at 11:30





Yes, bitcoin script is run on-chain so that everyone can verify it was run correctly

– Henk
Aug 29 '18 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 '18 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 '18 at 15:22

















draft saved

draft discarded
















































Thanks for contributing an answer to Ethereum Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




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















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế