Bitcoin Forum

Other => Beginners & Help => Topic started by: Shirik on July 04, 2012, 03:32:15 PM



Title: Script System
Post by: Shirik on July 04, 2012, 03:32:15 PM
I'm a software engineer by profession, so when I started looking at bitcoin, the transaction system immediately grabbed my attention. I think I understand it, but the wiki isn't entirely clear, so I was hoping someone could double-check my understanding.

I checked out https://en.bitcoin.it/wiki/Transactions and https://en.bitcoin.it/wiki/Script and get that each input has half of a script, and each output has half of a script. What has been hanging me up is how the two are combined, but I think I finally figured it out. I think that those two halves don't get paired together. Instead, the input script is paired with the previous transaction's output script, so the input script is basically proving that you're allowed to spend the coins from that transaction. Is that correct?

So if I wanted to, I could create an output that could be used by two different addresses by creating a script that basically said "if sig matches this or this, true" right? (Or I could just say it could be spent by anyone by saying "true" always.)

That being said, do most miners actually accept transactions like this? Or do they just reject any transaction that does not follow the typical pattern? (I read about the mtgox loss, but it seemed like a lot of miners were rejecting that transaction.)


Title: Re: Script System
Post by: theymos on July 04, 2012, 06:16:47 PM
Right. An output's script provides an algorithm for determining whether that output can be spent, and any input trying to spend the output provides the arguments for that algorithm.

Quote
That being said, do most miners actually accept transactions like this? Or do they just reject any transaction that does not follow the typical pattern? (I read about the mtgox loss, but it seemed like a lot of miners were rejecting that transaction.)

Everyone accepts non-standard transactions if they appear in a block. The default client doesn't mine or relay non-standard transactions. A few big miners like Eligius do accept them, though.


Title: Re: Script System
Post by: Shirik on July 04, 2012, 07:37:19 PM
Yeah, what I meant to say is miners refusing to include those transactions in their generated blocks. Naturally you have to accept non-standard transactions in blocks (assuming they're valid) or you wouldn't be able to build on the block chain.

Thanks,