BEST Music Of 2020

If you would have tried to predict the ways of 2020 you could have never in a million years guessed the way that it actually turned out. The sudden attack of Covid threw everything overboard changing…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Dealing with Bitcoin script. Spend bitcoin transaction P2SH output.

This article describes how to spend bitcoins from P2SH address using correct scriptSig value. P2SH address was created in previous article.

After sending coins to P2SH address comes most interesting part — spending coins from P2SH address. And we should use our scriptSig which is simply enough. Just put there number 14 and hash of scriptPubKey. Sounds easy but we work with raw data and we will create transaction “by hands” using just text editor. Value of scriptSig described below.

First in spend scriptSig should be value which is needed in last part of equation 5+9=14. It’s 14 number. Then there should be a full scriptPubKey. It is used to reach 2 important goals — check if it’s correct transaction output and provide exact script itself because of funding transaction doesn’t contain this script but only hash of it. So network can check if hash of script in funding transaction corresponds to script provided in spending transaction. And if all are correct, then script can be executed. After concatenating of all parts scriptSig has next representation:

Explanation of scriptSig parts.
Stack based script execution flow.

Add a comment

Related posts:

Malam Terakhir Mark

Ia melagu. Terus melagu. Menghabiskan sisa waktu berada di tempat yang fana sambil memandangi lorong didepannya yang kian gelap dan sunyi mengikuti larutnya malam. Ia memperkecil suaranya. Kini ia…

Test post on Medium

What do you think about the day after Christmas? Is it a resting day, a Christmas extension, a day created to actually “box” people or just another day coined by some lazy individuals who don’t think…

Attention in the digital era

The digital era and the digital economy are driven by industrial disruptions such as Amazon — e-commerce, Facebook — social interaction, Netflix — entertainment, Uber — transportation and many such…