Bitcoin Forum
November 05, 2024, 06:46:07 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Different transactions in different blocks?  (Read 1115 times)
alidorri (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 2


View Profile
May 13, 2016, 07:39:58 AM
 #1

Hi


As you know, different miners may try to mine blocks in blockchain, and it is possible that one transaction being added to different blocks. How blockchain face with this problem? In other world, is it possible that one transaction be in two or more blocks? if not, how other miners find out that their transactions are stored in blockchain?
Foxpup
Legendary
*
Offline Offline

Activity: 4531
Merit: 3183


Vile Vixen and Miss Bitcointalk 2021-2023


View Profile
May 13, 2016, 08:38:41 AM
Merited by ABCbits (4)
 #2

It's not clear what you're asking, but if you're if you're asking if it's possible for the same transaction to be in two or more blocks, this is not possible for normal transactions, since the same bitcoins cannot be spent twice (blocks which include transactions doing so are invalid and will be rejected by all nodes).

This does not apply to coinbase transactions (which generate new bitcoins instead of spending existing ones) - different blocks can have (and, indeed, have had) identical coinbase transactions, which is a problem since only one of them can ever be spent, for the above reason. Miners lose money if they erroneously produce such transactions.

Will pretend to do unspeakable things (while actually eating a taco) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
I am not on the scammers' paradise known as Telegram! Do not believe anyone claiming to be me off-forum without a signed message from the above address! Accept no excuses and make no exceptions!
alidorri (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 2


View Profile
May 13, 2016, 09:06:28 AM
 #3


But miners listen to network and capture received transactions to their block, what if two miners capture the same block (which is possible) and then mine it in different blocks? its not double spending since its one unique transaction, input and output are the same not different.
Foxpup
Legendary
*
Offline Offline

Activity: 4531
Merit: 3183


Vile Vixen and Miss Bitcointalk 2021-2023


View Profile
May 13, 2016, 09:43:25 AM
Merited by ABCbits (2)
 #4

Multiple transactions with the same inputs is the very definition of double spending and is not allowed, regardless of all other factors. This includes multiple copies of the same transaction. This is also why identical transactions are only possible for coinbase transactions: they can't have the same inputs because they don't have inputs in the first place.

Will pretend to do unspeakable things (while actually eating a taco) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
I am not on the scammers' paradise known as Telegram! Do not believe anyone claiming to be me off-forum without a signed message from the above address! Accept no excuses and make no exceptions!
alidorri (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 2


View Profile
May 13, 2016, 09:48:57 AM
Merited by ABCbits (1)
 #5

now i get it, so how miners figure out this problem? I mean how they can make sure that they are not mining a transaction which is mined before?
Foxpup
Legendary
*
Offline Offline

Activity: 4531
Merit: 3183


Vile Vixen and Miss Bitcointalk 2021-2023


View Profile
May 13, 2016, 10:10:45 AM
Merited by ABCbits (2)
 #6

Because each block refers to hash of the previous one (that's what makes it a blockchain), miners must download and (hopefully) verify the latest block before they can mine the next one. (There's been at least one case where a mining pool decided to skip the verification step (for speed) and lost a huge amount a money by unknowingly mining invalid blocks.)

Will pretend to do unspeakable things (while actually eating a taco) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
I am not on the scammers' paradise known as Telegram! Do not believe anyone claiming to be me off-forum without a signed message from the above address! Accept no excuses and make no exceptions!
NeuroticFish
Legendary
*
Offline Offline

Activity: 3850
Merit: 6583


Looking for campaign manager? Contact icopress!


View Profile
May 13, 2016, 10:16:10 AM
Last edit: May 13, 2016, 12:41:16 PM by NeuroticFish
 #7

now i get it, so how miners figure out this problem? I mean how they can make sure that they are not mining a transaction which is mined before?

When a block is mined, there is some sort of "winner block", that one and only one will be added to the block chain, that one will be referred by the next block. If the transaction is there, it's fine, else it will have to wait until it's included into a "winner" block.

If different miners decide for a different "winner" block, then a FORK is made. That's rather unusual and rather soon the wrong fork is discarded.


Edit: the next post is better explained

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
DannyHamilton
Legendary
*
Offline Offline

Activity: 3472
Merit: 4801



View Profile
May 13, 2016, 12:02:12 PM
Merited by ABCbits (5)
 #8

now i get it, so how miners figure out this problem? I mean how they can make sure that they are not mining a transaction which is mined before?

Miners (or mining pools) keep track of the current list of unspent transaction outputs (UTXO), and the list of current unconfirmed transactions.

Whenever a miner (or pool) hears about a new transaction, it checks to make sure that all the inputs to the transaction are in the UTXO.  If there are any inputs that are not in the UTXO, then the transaction is invalid and is rejected.  This means that a miner (or pool) will only keep the first transaction that it hears about with any given transaction input.  Whenever a valid transaction is received, the miner (or pool) removes the transaction's inputs from their UTXO.  Whenever a transaction is dropped from the memory pool, the inputs of that dropped transaction are added back into the UTXO.

The miner selects the transactions for their block from their list of unconfirmed transactions.  Most other miners (or pools) will be selecting the same transactions for their own blocks.  Then all the miners (and pools) on the entire network attempt to complete the proof-of-work.  Once a miner (or pool) is successful in completing their block, they broadcast it to the network.  As each miner (or pool) receives the block, they verify that it is valid.  If it is not, then they reject it and continue working on their own block. If the block is valid, then they remove all the transactions that are in the block from their own list of unconfirmed transactions (and all the inputs that are in the block from their own UTXO). Then they build a new block with the transactions that remain in their memory pool and continue their proof-of-work with the new block that they've just created.

Occasionally, two miners (or pools) will broadcast a solved block at nearly the same time.  Each node on the network will use whichever of the two block it receives first, and the other block will be rejected as invalid. The entire network will be split as to which block they believe is the "real" block.  Eventually a miner will solve the next block on top of whichever block they thought was the "real" one.  Since their chain will now be 1 block longer than the competing chain, it will "win".  All the miners, pools, and nodes on that had been working on top of the other block will abandon it.  They will add all the transactions from their old block back to their memory pool, and all the inputs back to their UTXO. They'll then update their UTXO and memory pool based on the two block they receive from the now longer chain.  The abandoned block is commonly called an "orphaned" block.
alidorri (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 2


View Profile
May 15, 2016, 11:19:47 PM
 #9

Thanks, You answered all my questions clearly, many thanks for your clear illustration.
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!