Bitcoin Forum
December 15, 2024, 06:45:13 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Different components of a transaction (Informative)  (Read 254 times)
Pffrt (OP)
Sr. Member
****
Offline Offline

Activity: 1372
Merit: 322


View Profile
May 30, 2020, 01:51:51 PM
 #1

In each transaction, there is a lot of information which some of us, especially newbies, don't know anything about. Today, as I'm locked due to the Corona Virus effect and have some free time, I thought to write an info article for newbies so that they can learn everything about a transaction in an easy way.
What are the components of a bitcoin transaction?
TxID/ Tx Hash
Block
Size
Input & Output
Change Address
Fee

TxID/ Tx Hash
There are a lot of transactions occurring in bitcoin each day. TxID is the record of each transaction. In traditional accounting, we can compare TxID with the transactions of each day. For example, X company may have severals transaction on a day-
Paid $5k as rent.
Good sold- $10k
Paid electricity bill- $500
All these are some transactions and they have numbers 1,2,3. These 1,2,3 are the txID. A txID contains all the information of a transaction including timestamp, amount, fee etc.

Block
A block can be compared to the traditional page number of a book. For example, the xTH number of pages of X book contains some information. In the same way, a block contains maximum 1 MB data of the tx records.

Size
TX has its size. Depending on the input and output it can vary in bytes.

Input & Output
In traditional ledger books, we have different accounts for income and expenses. We can compare the income with input here. Imagine, you have 1 BTC which you received from your friend. If you are sending 1 BTC to your cousin, bitcoin blockchain will look if you really have 1 BTC. Then it will say, you have 1 BTC from your friend and you are sending that 1 BTC to your cousin. So, in general words, it will link the source of that 1 BTC with the destination of that 1 BTC. Here, the source of that 1 BTC is the input and the destination of that 1 BTC is the output.

Change Address
It's normal as fiat changes. If you have 1 BTC in your wallet and you want to send 0.05 BTC to your friend, the total amount will be used as input but the change of 0.95 BTC (minus fee) will be sent to your change address.

Fee
Fee is paid to the miners to confirm include your transaction in a block. Fee can be customized, can be paid 1 sat/byte or higher. Sometimes, when the mempool is congested (In other words, when there are more than usual tx occurs), the fee increases significantly.

These are very general components of a bitcoin tx, there are some more too. I will update them later.
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18771


View Profile
May 30, 2020, 06:52:09 PM
Merited by pooya87 (1), Bitcoin_Arena (1)
 #2

A txID contains all the information of a transaction including timestamp, amount, fee etc.
Transaction data does not include a timestamp.

In the same way, a block contains maximum 1 MB data of the tx records.
Since SegWit, a block can contain up to 4 MB of data.

TX has its size. Depending on the input and output it can vary in bytes.
Since SegWit, transactions are measured in either virtual bytes or weight units. Measuring in plain bytes is no longer accurate unless you are dealing with a transaction which only contains legacy inputs and outputs.

If you have 1 BTC in your wallet and you want to send 0.05 BTC to your friend, the total amount will be used as input but the change of 0.95 BTC (minus fee) will be sent to your change address.
This is only the case if you have 1 BTC in a single UTXO. In that case, you have to spend the whole UTXO and get 0.95 back as change. If, however, you have 1 BTC in your wallet but it is split among several UTXOs, then your wallet does not need to spend the whole amount, but rather the minimum amount of UTXOs to make up 0.05 BTC.
khaled0111
Legendary
*
Online Online

Activity: 2744
Merit: 3096


Top Crypto Casino


View Profile WWW
May 30, 2020, 11:14:18 PM
 #3

Thanks OP for this topic. Many use bitcoin but have no idea how transactions work and what are their different parts. I hope you will update it with more accurate information based on other members inputs.

Adding to what o_e_l_e_o said, a change address is part of the outputs too. Your wallet will automatically generate it and add it to the transaction outputs (you can set it manually too). You shouldn't present it as an independant component.

tranthidung
Legendary
*
Offline Offline

Activity: 2478
Merit: 4314


Farewell o_e_l_e_o


View Profile WWW
May 31, 2020, 01:29:33 AM
 #4

Change Address
It's normal as fiat changes. If you have 1 BTC in your wallet and you want to send 0.05 BTC to your friend, the total amount will be used as input but the change of 0.95 BTC (minus fee) will be sent to your change address.
It is not completely correct. In wallets, there are some options to enable or disable the change address feature. People can choose or unchoose the option to use or not use the feature, respectively.

In Electrum wallet, ie. go to Tools > Preferences > Transactions: Then you can choose the 2 options:
  • Use change addresses
  • Use multiple change addresses

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
Maus0728
Legendary
*
Offline Offline

Activity: 2072
Merit: 1582


View Profile
May 31, 2020, 02:42:33 AM
 #5

Transaction data does not include a timestamp.
As far as I know, timestamp is included in all block explorers. Some explorers indicate the "received time" of the transaction.

This is only the case if you have 1 BTC in a single UTXO. In that case, you have to spend the whole UTXO and get 0.95 back as change. If, however, you have 1 BTC in your wallet but it is split among several UTXOs, then your wallet does not need to spend the whole amount, but rather the minimum amount of UTXOs to make up 0.05 BTC.
Yep this is possible if the wallet supports the "coin control" feature in which the user can freely select UTXOs' as an input to cover the required amount.

Change Address
It's normal as fiat changes. If you have 1 BTC in your wallet and you want to send 0.05 BTC to your friend, the total amount will be used as input but the change of 0.95 BTC (minus fee) will be sent to your change address.
@tranthidung is correct. If the "Use change addresses" is selected in tools, the remaining balance will be automatically sent to one of your unused "change address". If it is not selected or unchecked in tools menu, the remaining balance will automatically sent into one of your unused "receiving address" without indicating your address in the payment field if you are using Electrum wallet.
pooya87
Legendary
*
Offline Offline

Activity: 3668
Merit: 11107


Crypto Swap Exchange


View Profile
May 31, 2020, 03:36:46 AM
 #6

Transaction data does not include a timestamp.
As far as I know, timestamp is included in all block explorers. Some explorers indicate the "received time" of the transaction.

"blocks" have a timestamp (which may or may not be accurate) not "transactions". transactions have "locktime" which is a different thing than a timestamp.

and what block explorers show can be different values, some show the time their node has received the transaction (even the IP address of the node that sent the tx for the first time), some show the time tx was included in the block (ie. the block time) and some show both.

What are the components of a bitcoin transaction?
TxID/ Tx Hash
Block
Size
Input & Output
Change Address
Fee
apart from input/output, the rest are not "components" of a bitcoin transactions. they are more like additional calculated information. the actual transaction components are: version, tx_in (outpoint, signaturescript, sequence), tx_out (amount, pubkeyscript), witness and locktime.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pffrt (OP)
Sr. Member
****
Offline Offline

Activity: 1372
Merit: 322


View Profile
May 31, 2020, 03:08:35 PM
 #7

It is not completely correct. In wallets, there are some options to enable or disable the change address feature. People can choose or unchoose the option to use or not use the feature, respectively.
Isn't it like if you enable change address, one of your change address will receive the change and if you don't enable it, the same address of the input will be used as change address. I get to check once again, lol.
khaled0111
Legendary
*
Online Online

Activity: 2744
Merit: 3096


Top Crypto Casino


View Profile WWW
May 31, 2020, 04:18:26 PM
Last edit: May 31, 2020, 09:33:12 PM by khaled0111
 #8

@Pffrt, you are right.
In Electrum for example, if you uncheck the Use change addresses box, the change will be sent back to one of the addresses used as inputs.

However, keep in mind that it mainly depends on the wallet you are using. Correct me if am wrong, but if you create a transaction (manually) without defining a change address, the remaining balance will be collected by the miner.

o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18771


View Profile
May 31, 2020, 06:30:41 PM
Merited by khaled0111 (1)
 #9

Correct me if am wrong, but if you create a transaction (manually) without defining a change address, the remaining balance will be collected by the miner.
You are correct.

There isn't actually a field for defining the fee in the transaction data. What you do define is which inputs to include in your transaction, and you define how many satoshis to send to each output. Defining a change address is just the same as defining any other output, as far the transaction is concerned. Whatever the difference is between the sum of the inputs and the sum of the outputs is taken as the fee.

Most wallets deal with all this automatically, but if for some reason a change output wasn't defined, then whatever wasn't sent to the recipient(s) would be taken as the fee.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!