Understanding Bitcoin Transactions and Their Types

19 replies 87 views
bit_wh4leMember
Posts: 20 · Reputation: 173
#1Dec 15, 2022, 10:52 PM
To grasp how Bitcoin transactions function and what types exist, we gotta kick things off by breaking down Bitcoin addresses, transactions, and scripts and how they all play together. A Bitcoin address is basically a mix of letters and numbers that you can give to anyone who wants to send you some cash. These addresses can come in various formats, with the popular ones being Pay-to-PubKeyHash (P2PKH) and Pay-to-ScriptHash (P2SH). Anyone can send bitcoins to these addresses, but the sender can only use those funds if they meet specific conditions outlined by Bitcoin's scripting system. Speaking of scripts, they’re like instructions that tag along with each transaction. They decide how the next person looking to use those bitcoins can access them. Outputs in transactions include what we call PubKey Scripts (or locking scripts), identified in code as scriptPubKey. When someone receives bitcoins, they create a signature script (also known as an unlocking script), which is a set of data generated by the person spending the bitcoins to comply with the PubKey Script. Signature scripts are coded as scriptSig. For instance, when Alice kicks off a transaction with Bob, the output contains bitcoins that are only usable if the conditions from the PubKey Script are fulfilled. After Alice broadcasts this transaction, it gets added to the blockchain and labeled as an Unspent Transaction Output (UTXO) for Bob.
6 Reply Quote Share
bit_wh4leMember
Posts: 20 · Reputation: 173
#2Dec 15, 2022, 11:40 PM
I will try to add frequently multiple actualizations and additional information to this thread about the transaction types, starting from the oldest one and pushing forward to the latest developments. I didn't know or haven't expected that this subject will be so comprehensive and I had to skip a lot of useful information about particular addresses to keep the OP in an interesting form which is not too long, because as we know, long once tire us very quickly and don't work so god as much shorter/compressed articles. If there are any questions about the addresses or suggestions regarding the thread itself, please be so kind and let me know in the comments. I will try to answer all questions and frequently update the thread with additional info, like: how the particular scripts look like, how they look like, are built or how many transactions from each kind we have actually? As I said before there are hundreds of topics to discuss regarding Bitcoin addresses.
0 Reply Quote Share
p1x3l365Senior Member
Posts: 511 · Reputation: 1890
#3Dec 16, 2022, 01:48 AM
There are so many technical terms that I have not known before reading this topic, so thank you for making this one, wwzsocki. I still wonder your topic belongs to Bitcoin technical support board or Beginners & help board. I don't have issue to see your topic here, because it is certainly helpful for newbies, just want to know that such topic can belong to Bitcoin technical support board or not.
3 Reply Quote Share
hash_bossLegendary
Posts: 1166 · Reputation: 5261
#4Dec 16, 2022, 02:06 AM
If your aim is beginner, then i think you should simplify it even further or more neat formatting to make it's easier or less boring to read. This topic clearly not belongs to Beginners & Help section & IMO doesn't belong to Bitcoin Technical Support as well since it's too detailed.
3 Reply Quote Share
diamond_2011Full Member
Posts: 129 · Reputation: 490
#5Dec 16, 2022, 07:58 AM
I do have to agree with ETFbitcoin here you must simplify it further since even with the infographics provided the topic got a little deeper for newbies to understand each type of transactions Bitcoin have. Another suggestion is adding another topic about "Off-chain" transactions which newbies also needs to understand, not every method of sending/receiving cryptocurrencies requires the use of Blockchain some 3rd party wallet providers like Coinbase offers up off-chain transactions for their users which gives them the ability to send Bitcoin to another Coinbase user instantly and freely. Newbies needs to learn this method as well if they are trying to avoid network fees at all.
4 Reply Quote Share
bit_wh4leMember
Posts: 20 · Reputation: 173
#6Dec 18, 2022, 07:54 AM
That's the problem that there is no way to simplify this text further. I did all what possible to make it short and informative and still, I had to remove many interesting details about Bitcoin transactions and their particular types. This subject was already discussed in the Bitcoin Technical Support board and I thought it could be good for beginners, especially if they desire to learn something new or expand the knowledge about Bitcoin transactions. Additionally, I counted on moderators, that they will move this thread if this board is not the best choice and on members like you, who will comment this. I think I will leave it here for a while and if there will be more comments to move it to Bitcoin Technical Discussion, then I will do it or let mods decide in the end.
0 Reply Quote Share
bit_wh4leMember
Posts: 20 · Reputation: 173
#7Dec 18, 2022, 09:22 AM
When three high-rank members suggest that something needs to be changed or simplified, there is no point in discussing, only one has to do it, so I thought a bit and came to the conclusion that I will divide this article into two parts for less and more advanced users. So far I've added this: Of course, I will Null Data and Non-standard transactions to this shortlist when I write it finally. What you think is better now?
1 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#8Dec 18, 2022, 02:09 PM
in my opinion it is wrong to call these "transaction" types because these are "script" types. in bitcoin we only have 1 form of transaction and if you wanted to be so strict you could say 2 types: legacy and SegWit (a tx containing witness data in it). otherwise since the structure of a transaction is exactly the same we can't categorize them as different "transaction" types. this is the first time i am hearing this term. where did you get it from? is it the one where you place the redeem script (m<pub1><...><pubn>n checkmultisig) inside the scriptPub? FTFY the first crossed out part is misleading. you reveal your public key whenever you spend any of these outputs. FTFY missing: - P2WSH similar to P2SH but the hash of the script is different and the redeemscript itself goes in witness - P2SH-P2WPKH nested SegWit (workarounds) where it is similar to P2WPKH but the whole thing is put inside of a redeem script and hashed - P2SH-P2WSH same as previous one but for P2WSH read more: https://bitcoincore.org/en/segwit_wallet_dev/
1 Reply Quote Share
bit_wh4leMember
Posts: 20 · Reputation: 173
#9Dec 18, 2022, 03:02 PM
As you see from the source links everybody calls these as transaction types and this is why I did the same. Everything has been explained in the OP, what is the script, transaction, etc, so I think there should be no problem with understanding what is what. I provided all sources as always in the post footer, but here it is: https://learnmeabitcoin.com/glossary/p2ms Thanks for FTFY but to be honest I cut these sentences by myself to make it shorter and easy to understand. As you see this is in the first part for beginners. Of course, I should do it properly, without changing the meaning completely and I thought is ok but added your corrections too. Members advised above to make it shorter, so I did it and removed a couple of additional sentences. I have talked about this in my post above, that I found it really hard and to be honest this article was a lot longer in original form. I had to make compromises and cut out all I found or thought is not so important, but everything is important here and that is why I will update this thread further. Don't want to write more in the OP, only add all additional information in the posts during the discussion. Just like now.
0 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#10Dec 18, 2022, 09:11 PM
i wasn't trying to say you were wrong, that is why i said it is my "opinion". thanks, i forgot to check out the links. well, i think when you begin to look under the hood it automatically becomes a lot more complicated, when the part  you are looking at is scripts, then the complication is even more. so don't try too hard to make it any easier, that is impossible. i guess focusing on being short and complete is better. you've already done a good job summarizing and gathering all this here though. kudos for that.
0 Reply Quote Share
bit_wh4leMember
Posts: 20 · Reputation: 173
#11Dec 20, 2022, 07:37 AM
I was surprised how detailed your posts were because the majority of people read only the topic line and max a couple of sentences before they comment. Thanks for your help one more time, you've made a good job too. It's a pleasure to discuss with members like you. I see that you have a lot of knowledge about this subject and want to ask you about it. Are you a programmer or is your profession related to cryptocurrencies, like coding or something? Typical crypto enthusiast doesn't have such knowledge. I started this thread when I was confused with segwit addresses some time ago. I was writing it for some time because transactions and scripts are quite a challenge for an average cryptocurrencies user, especially with no programming knowledge. This is the best way for me to expand my knowledge and learn constantly new things about crypto. Simply when I don't know something and especially when I have problems with something then start to study this subject, until I know maybe not everything but so much that I fill me confident.
3 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#12Dec 20, 2022, 10:42 AM
no, even my field of study has nothing to do with programming. i just always liked computers so at some point in my life i picked up programming as a hobby and slowly learnt more about it (on my own). also ever since i found out about bitcoin, i was fascinated so i also started looking under the hood and slowly learned more about the technical aspect of it. you can call it being "self taught". although i still have a lot to learn, but i certainly enjoy it.
3 Reply Quote Share
bit_wh4leMember
Posts: 20 · Reputation: 173
#13Dec 20, 2022, 04:24 PM
I tried to find information about new developments and what is the future for the Bitcoin transactions because they are evolving constantly during the time. Unfortunately, I wasn't able to find anything and even was afraid that I missed something, but all comments in this thread assured me that I have them all so far. If anybody knows something about Bitcoin development and the future of transactions then please share.
2 Reply Quote Share
bit_wh4leMember
Posts: 20 · Reputation: 173
#14Dec 20, 2022, 08:26 PM
I don't know how I missed this sentence in your post when I was reading for the first time? Sometimes is hard to choose the best-suited board for published text and I always count in such a situation for comments like this one or moderators to move the thread to the right section. I think you are right, so I will move it to the suggested Bitcoin Technical Support board and look there for more activity and discussion.
2 Reply Quote Share
Posts: 4 · Reputation: 40
#15Dec 20, 2022, 09:04 PM
The network clogs and mining pool games of increasing transaction fees are few of the most important topics I'm trying to get a resolution to. Please also try to focus on these things while sharing knowledge about the type of scripts and transactions. Great thread, appreciated. There's been a debate about Bitcoin's block size increment over time to involve more and more transactions, do you believe that's actually a form that can scale it in the long run considering the hyper hefty blockchain size that's technically too high for an average sized hard disk of a PC if people decide to run a node through downloading the whole blockchain?
2 Reply Quote Share
bit_wh4leMember
Posts: 20 · Reputation: 173
#16Dec 21, 2022, 01:25 AM
To be honest, debate about the size of the Bitcoin block does not bring anything and even if, then it is only a temporary solution. With the time passing, we see new problems emerging and we still haven't solved old once. We have the Lightning Network running, which is a good thing of course and we have to help, to get it fully adopted, but still, this does not solve any of the problems with: transactions, speeds onchain, blocks and blockchain size, etc. Everybody was so focused on the LN start that we have forgotten about other important aspects or just naively believed, that Lightning will magically solve all these problems. Bitcointalk was the place for the biggest discussions about BTC development and future plans, so if there are any discussions actually ongoing, please point me to them because   I would really like to know what the future plans for Bitcoin development are and what is the (so-called) roadmap if there is any?
3 Reply Quote Share
Posts: 4 · Reputation: 40
#17Dec 21, 2022, 02:12 AM
I believe LN is a solution for those believing in the offchain transactions with lesser fee involved, but even after doing it through LN can't resolve the size and scaling just because we are bound to take those transactions online in the future and add that size to our current blockchain, I believe that compression of Blockchain could be the only possible scenario that could help but don't really know how it'd be put in action by the devs if they ever decide to do so because the biggest risk of doing that will be - losing some old (and even new) transactional data possibly if it poses a glitch that could remove a piece of the transaction to reduce the size through compressing it, nothing else comes to my mind as of now. Well, to what I've seen, these guys always try to dig a well whenever fire takes place so I haven't clearly seen any such development related debates especially through developers (maybe they are doing it behind the curtains) or it is possible that they believe in actions rather than just words.
0 Reply Quote Share
matrix365Senior Member
Posts: 184 · Reputation: 1104
#18Dec 22, 2022, 06:32 AM
The topic on types of bitcoin transaction is meaningful, but after reading I still don't know that how cheaper transaction with Segwit address is in comparison with Legacy address. If you can, please consider adding this part into your topic. Personally, I would prefer to have more technical things on your topic, includes what I discussed above.
5 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#19Dec 22, 2022, 11:03 AM
every transaction has different parts, version, input list which include previous transaction hash, signature..., output list,... if we simplify it to something like this: in legacy transactions, this is the structure and the entire thing is used for calculating the size and paying the fee based on that. when you use SegWit this structure changes a little and the size is calculated by using everything except the signature so you'll end up with a smaller size and pay a smaller fee in total. of course the more correct thing to say is that we are no longer using "size" we are using "virtual size" which is 1/4 of the tx weight which is calculated by using 3x base size (without witness) + total size (with witness)
3 Reply Quote Share
bit_wh4leMember
Posts: 20 · Reputation: 173
#20Dec 22, 2022, 04:27 PM
Thanks for this suggestion but I have to take all suggestions from members into consideration and some of them think that this thread is too overwhelming already and others (like you) wish to have even more detailed information. As you see there is no way to satisfy everybody and the best solution will be to leave this thread as it is and only add new content in the comments during discussion. But I will not leave you empty-handed and will try to write a new thread about transaction sizes and fees, additionally, there are many interesting things to talk about, like "vbytes" when it goes to transaction sizes. Great explanation, short and detailed. I think even a newbie can now understand why fees are smaller in SegWit transactions. It's because the smaller size which equals a smaller fee.
4 Reply Quote Share
?Reply
Sign in to reply to this topic

Related topics