Bitcoin transaction scripts : does ScriptSig or ScriptPubkey run first?

0

I'm confused as to the order regarding which script is run. For examples sake: say I want to spend 1 Bitcoin which was given to me by Alice in a single transaction of value 1 Bitcoin. I understand that the input to me is 1 Bitcoin and the output is 1 Bitcoin, but I am not sure about the which script runs first when i want to 'claim' this transaction

Edit: after reading the other question, I'm not sure if this is a chicken and egg kind of question. its a cycle where one runs after the other...

DCH

Posted 2018-06-21T20:18:01.007

Reputation: 47

Question was closed 2018-07-03T08:03:21.777

After reading the other question, I'm not sure if this is a chicken and egg kind of question. its kind of like a cycle where one runs after the other?DCH 2018-06-21T21:34:01.313

I see. The funding transaction defines the spending condition in the scriptPubKey, and the spending transaction provides the solution in the sigScript. When the tx' script logic is executed, the sigScript goes onto the stack, followed by the scriptPubKey. I recommend Andreas' book "Mastering Bitcoin", chapter 6 (Transactions, page 132ff). It is freely available online... and Ken Shirriff explains it very well (http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html).

pebwindkraft 2018-06-22T07:56:32.463

Thanks , I have always wanted that book but thought it will be better to cover the basics via the Coursera Princeton course .... however it was the course's lecture on scripts which got me confused as to the order of scriptsDCH 2018-06-22T08:03:03.497

No answers