Bitcoin Forum
November 23, 2017, 03:14:29 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Confirming transactions?  (Read 1359 times)
Xyver
Full Member
***
Offline Offline

Activity: 213


View Profile
November 04, 2013, 12:47:23 AM
 #1

Hey, I'm working on brushing up my mining knowledge and there's something I can't quite find.

Before, I thought that every 10-min (ish) a block was made, then the miners began to work on it to solve it, then once they solved it the block was added to the chain, and the transactions were confirmed.

But now, I understand that the block is like a box.  A transaction is made, and put on a waiting list, then the miners come along with a new box (block) and start to fill it up with transactions from the waiting list.  they give priority to the transactions with fees, obviously.

So, they fill up the block, close it, and then solve it?  Do they need to solve the block to "lock it shut" or do they need to solve it to "open it"?

And when they confirm transactions, is that while they're putting them into the box?  So that they fill the box with legitimate transactions, solve it, and add it to the chain, and then as more blocks are stacked on top they count as more transactions, and once it has 6 confirmations (it is 6 blocks deep in the chain) it is verified.
1511450069
Hero Member
*
Offline Offline

Posts: 1511450069

View Profile Personal Message (Offline)

Ignore
1511450069
Reply with quote  #2

1511450069
Report to moderator
Join ICO Now A blockchain platform for effective freelancing
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
Kenshin
Sr. Member
****
Offline Offline

Activity: 280


View Profile
November 04, 2013, 12:50:22 AM
 #2

Have you read this? http://bitcoin.org/bitcoin.pdf

It should explain everything about bitcoin.
Xyver
Full Member
***
Offline Offline

Activity: 213


View Profile
November 04, 2013, 12:58:24 AM
 #3

Yes, I know how to google.

I've done my research, and don't understand.  Hence why I'm asking for help.

(Sorry if that sounded snarky)
eleuthria
Legendary
*
Offline Offline

Activity: 1750



View Profile
November 04, 2013, 05:51:44 AM
 #4

You've got part of it right.  A block is like a box that's been filled with transactions and then filed into the blockchain.  However, it's more of the following:


1) There are hundreds of transactions floating in the network that are not yet included in any block.
2) Miners group those unconfirmed transactions into a *potential* block, and start trying to come up with a hash that will meet the current network difficulty for this potential block they've assembled.  They pick transactions based on priority, which is a mixture of the age of a transactions inputs, the size of the inputs/outputs, and the fees attached to the transaction.
3) If a miner creates a successful hash for their potential block, they broadcast the block to the network that they now have a new block properly added to the blockchain.  This gives transactions their first confirmation.  As future blocks are added to the chain based off this one, they gain an extra confirmation.

3a)  If two competing miners come up with a block solution at the same time, it's possible your transaction *loses* its confirmation.  If the competing block found at the same time (roughly) does not include it, and the following block on the network uses this competing block, your transaction will lose its confirmation and end up floating across the network again waiting for a miner to pick it up.

RIP BTC Guild, April 2011 - June 2015
Xyver
Full Member
***
Offline Offline

Activity: 213


View Profile
November 04, 2013, 07:17:35 AM
 #5

You've got part of it right.  A block is like a box that's been filled with transactions and then filed into the blockchain.  However, it's more of the following:


1) There are hundreds of transactions floating in the network that are not yet included in any block.
2) Miners group those unconfirmed transactions into a *potential* block, and start trying to come up with a hash that will meet the current network difficulty for this potential block they've assembled.  They pick transactions based on priority, which is a mixture of the age of a transactions inputs, the size of the inputs/outputs, and the fees attached to the transaction.
3) If a miner creates a successful hash for their potential block, they broadcast the block to the network that they now have a new block properly added to the blockchain.  This gives transactions their first confirmation.  As future blocks are added to the chain based off this one, they gain an extra confirmation.

3a)  If two competing miners come up with a block solution at the same time, it's possible your transaction *loses* its confirmation.  If the competing block found at the same time (roughly) does not include it, and the following block on the network uses this competing block, your transaction will lose its confirmation and end up floating across the network again waiting for a miner to pick it up.

Right.  So do the miners confirm the transactions before they put them in the box?  Or are they confirmed when the block is solved.  I know you mean that the blocks get multiple confirmations the deeper they are in the chain, but when are they checked for double spends or false coins?  Is that when the miners put them in the block?
Xyver
Full Member
***
Offline Offline

Activity: 213


View Profile
November 08, 2013, 07:14:14 PM
 #6

Bump? I'm still not finding this.  How do the miners know/when do they check if a transaction is legitamite? When the block is being filled, or as it is solved?
afrustrum
Newbie
*
Offline Offline

Activity: 17



View Profile
November 10, 2013, 12:15:00 PM
 #7

Pages 2 and 3 of http://bitcoin.org/bitcoin.pdf appear to say that each node (ie. miner) assembles a potential block out of some of the unconfirmed transactions it's received.

As far as I understand, it "validates" each transaction only in so far as checking the syntax is correct, and, I suppose, that the timestamps and input address hashes match corresponding output address in the existing blockchain. Then the mining node tries to find a proof of work hash for that block with sufficient leading zeroes to qualify for being announced as the new highest block in the chain. (This step takes a lot of CPU and, with high difficulty, is very unlikely for any one node.)

The one node lucky enough to find this hash announces it, the majority of other nodes accept it and the network works on new potential blocks based off that new block. I think of the act of the network accepting the block as the new highest as the first confirmation for all its included transactions. There are also details involved with near-simultaneous finding of new blocks, but that's basically it.

BTC: 19coxnDZp1XWTrasjDvUmJLjodRHHZEmtU NMC: NEhYiyYuhHJB4ZfQg2vxwenctj7XZdmXEV
blub
Member
**
Offline Offline

Activity: 88


View Profile
November 10, 2013, 06:14:46 PM
 #8

when are they checked for double spends or false coins?  Is that when the miners put them in the block?

The miner put transactions in the block that are valid for the current blockchain. When an other pool finds a block that makes a transaction invalid, it will be exluded from the next atempt to find a block. Also if 2 or more transaction occour, which invalidates each other (double spend), each miner chooses one to include in his block

Xyver
Full Member
***
Offline Offline

Activity: 213


View Profile
November 10, 2013, 11:25:02 PM
 #9

when are they checked for double spends or false coins?  Is that when the miners put them in the block?

The miner put transactions in the block that are valid for the current blockchain. When an other pool finds a block that makes a transaction invalid, it will be exluded from the next atempt to find a block. Also if 2 or more transaction occour, which invalidates each other (double spend), each miner chooses one to include in his block

Ok, so from the sounds of it, the miners only put valid transactions into the potential block?  So I guess the miners check when they put them in the block.
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218


Gerald Davis


View Profile
November 10, 2013, 11:36:22 PM
 #10

when are they checked for double spends or false coins?  Is that when the miners put them in the block?

The miner put transactions in the block that are valid for the current blockchain. When an other pool finds a block that makes a transaction invalid, it will be exluded from the next atempt to find a block. Also if 2 or more transaction occour, which invalidates each other (double spend), each miner chooses one to include in his block

Ok, so from the sounds of it, the miners only put valid transactions into the potential block?  So I guess the miners check when they put them in the block.

Correct.  An block with an invalid tx is an invalid block and a complete waste of the massive amount of work necessary to solve it. An invalid block would be instantly rejected by all other nodes and will never be part of the longest chain.

However miners actually validate txs as soon as they receive them.  Actually ALL nodes validate tx as soon as they receive them.  Don't use the word "confirm" to mean validate as "confirm" generally is used to indicate a tx that is included in a solved block which has been added to the blockchain and is part of the longest chain.
 
So a node (any node) receives a tx from its peer.  If it is invalid the node discards it.  If it is valid it adds it to the memory pool (list of unconfirmed tx) and then relays it to all its peers.  Those peers do the same thing (including the independent verification of the tx).  Now if the node is also a miner* it will take some tx from the memory pool (all of which are already valid) assemble them into a merkle tree and construct a block header from that.   If the block is solved the miner will broadcast the block to other nodes.

When a node receives a new block it validate the block including:
1) all tx in the block are valid
b) the merkle tree and merkle tree root is valid
3) all the information in the block header is valid
4) the block hash meets the difficulty target

Once the node confirms the block is valid it will add the block to the blockchain AND remove the tx included in the block from the memory pool.  The node will then relay the block to all of its peers which do the same thing.  If the block is ever orphaned the node will add all tx that were in the block back to its memory pool.

Thus all nodes have two "lists"
a) the memory pool = list of valid unconfirmed tx not yet included in a block.
b) the blockchain = linked list of blocks and the confirmed tx they contain.

All nodes follow this sequence (for both txs and blocks)
receive -> validate -> store/update -> relay
Xyver
Full Member
***
Offline Offline

Activity: 213


View Profile
November 11, 2013, 10:24:25 AM
 #11


Correct.  An block with an invalid tx is an invalid block and a complete waste of the massive amount of work necessary to solve it. An invalid block would be instantly rejected by all other nodes and will never be part of the longest chain.

However miners actually validate txs as soon as they receive them.  Actually ALL nodes validate tx as soon as they receive them.  Don't use the word "confirm" to mean validate as "confirm" generally is used to indicate a tx that is included in a solved block which has been added to the blockchain and is part of the longest chain.
 
So a node (any node) receives a tx from its peer.  If it is invalid the node discards it.  If it is valid it adds it to the memory pool (list of unconfirmed tx) and then relays it to all its peers.  Those peers do the same thing (including the independent verification of the tx).  Now if the node is also a miner* it will take some tx from the memory pool (all of which are already valid) assemble them into a merkle tree and construct a block header from that.   If the block is solved the miner will broadcast the block to other nodes.

When a node receives a new block it validate the block including:
1) all tx in the block are valid
b) the merkle tree and merkle tree root is valid
3) all the information in the block header is valid
4) the block hash meets the difficulty target

Once the node confirms the block is valid it will add the block to the blockchain AND remove the tx included in the block from the memory pool.  The node will then relay the block to all of its peers which do the same thing.  If the block is ever orphaned the node will add all tx that were in the block back to its memory pool.

Thus all nodes have two "lists"
a) the memory pool = list of valid unconfirmed tx not yet included in a block.
b) the blockchain = linked list of blocks and the confirmed tx they contain.

All nodes follow this sequence (for both txs and blocks)
receive -> validate -> store/update -> relay

Beautiful, thank you Smiley
btchellas
Jr. Member
*
Offline Offline

Activity: 35


View Profile
November 11, 2013, 05:24:19 PM
 #12

thanks for the info
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!