๐Ÿ“Œ a BlockChain Learning Blog # S3E2 โšก Basics of Bitcoin Transaction โšก

in #devdlearningblog โ€ข 7 years ago (edited)

1062080209.jpg
Image Source

Dear Community,

This is another blog post in the ongoing series of BlockChain Learning. #devdlearningblog . Todays blog is dedicated on basics of a bitcoin transaction.

๐Ÿ“Œ Bitcoin does not have account balance concept in deep core rather it works on UTXO concepts (Unspent Transaction Outputs)

1_eAKr5SIZfWXwC9dFBOmS3Q.png
image source

๐Ÿ“Œ In short if someone sends you a bitcoin on your bitcoin address that mean he is transferring the ownership and authorizing you to claim those bitcoin.

๐Ÿ“Œ Every authorization in its core is a script instruction or you can say some lines of code.

๐Ÿ“Œ When your friend send the bitcoin to your bitcoin address that time internally authorization claim is assigned to your address.

๐Ÿ“Œ When you tries to spend assigned UTXO that time you need to prove that you are a rightful owner of this assigned and validation part is done by your private key as authorization claim is assigned to your public key by sender.

๐Ÿ‘‰ Bitcoin transaction script looks like below


scriptSig: <sig> <pubKey>
scriptPubKey: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG

๐Ÿ“Œ Bitcoin Scripts are simple, compact, stack-based and processed left to right, Not Turing Complete (no loops)

๐Ÿ“Œ The whole script execute in a stack and claim is only valid if the end result comes our as TRUE.

โšก Some Interesting Bitcoin Scripts โšก


๐Ÿ‘‰ Provably un-spendable or prunable outputs


scriptPubKey: OP_RETURN {zero or more ops}

OP_RETURN is a script opcode used to mark a transaction output as invalid. Since any outputs with OP_RETURN are provably unspendable, OP_RETURN outputs can be used to burn bitcoins.


๐Ÿ‘‰ Anyone-can-spend outputs


scriptPubKey: {empty}
scriptSig: OP_TRUE

Output of stack will always True without any validation so anyone can claim and spend these bitcoins assigned to this output.


๐Ÿ‘‰ Freezing funds until a time in the future


scriptPubKey: <expiry_time> OP_CHECKLOCKTIMEVERIFY OP_DROP OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
scriptSig: <sig> <pubKey>

In such transaction the rightful owner can only spend this transaction when he will able to meet an additional condition for current time equals to expiry_time.


Hope this was an interesting read for you all & would have help you understand how things works under the hood. Leave a comment in case of any suggestion or questions.

#bitcoin #howto #blockchain

๐Ÿ‘‰ To view more kindly follow my blog https://steemit.com/@devrajsinghrawat

๐Ÿ“Œ Thank you in advance for your comments...

๐Ÿ“Œ Sign up nad Earn Free Bitcoin for solving simple tasks at Earn
image.png

๐Ÿ“Œ Mannabase is an online platform for the worldโ€™s first Universal Basic Income cryptocurrency. You are also welcome! https://www.mannabase.com/?ref=e7e72550c8

๐Ÿ‘‰ Sign up to best Crypto to Crypto Exchanegs Binance Signup & KuCoin Signup

โšก Best part about Kucoin Exchange is KuCoin Bonus โšก


โšก All your RESTEEM's always are much appreciated here, and always noticed โšก

๐Ÿš€ Stay Tuned & Keep Steeming,
Cheers
๐Ÿš€

Sort: ย 

Awesome details .. thxs for sharing

@originalworks !originalworks

Excellent article. I learned a lot of interesting and cognitive. I'm screwed up with you, I'll be glad to reciprocal subscription))