Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: upal on December 29, 2013, 08:41:12 PM



Title: To know a block in mainchain
Post by: upal on December 29, 2013, 08:41:12 PM
I have this...

https://blockchain.info/rawblock/00000000000007d0f98d9edca880a6c124e25095712df8952e0439ac7409738a

Here it shows "main_chain":true. After some Tx inside this block get a few confirmation, is it possible that "main_chain":true will convert to "main_chain":false ?


Title: Re: To know a block in mainchain
Post by: shorena on December 29, 2013, 08:44:19 PM
Since its from 2011, its not. But there might be orphanblocks that are no longer part of the main chain.
Its the reason that transactions take 6 blocks to get fully accepted.


Title: Re: To know a block in mainchain
Post by: upal on December 29, 2013, 09:19:54 PM
Since its from 2011, its not. But there might be orphanblocks that are no longer part of the main chain.
Its the reason that transactions take 6 blocks to get fully accepted.

That Block Hash is just an example. 6 blocks means 6 confirmations ?


Title: Re: To know a block in mainchain
Post by: DannyHamilton on December 29, 2013, 10:51:57 PM
6 blocks means 6 confirmations ?

Yes.


Title: Re: To know a block in mainchain
Post by: upal on December 30, 2013, 09:06:24 AM
6 blocks means 6 confirmations ?

Yes.

I was reading this: https://en.bitcoin.it/wiki/Confirmation

So what I understand, theoretically at any point of time "main_chain":true may get converted to "main_chain":false. But generally it does not happen after 6 confirmations.

Please correct me if I am wrong.


Title: Re: To know a block in mainchain
Post by: shorena on December 30, 2013, 09:32:48 AM
6 blocks means 6 confirmations ?

Yes.

I was reading this: https://en.bitcoin.it/wiki/Confirmation

So what I understand, theoretically at any point of time "main_chain":true may get converted to "main_chain":false. But generally it does not happen after 6 confirmations.

Please correct me if I am wrong.


Well the last 6 block be set to "main_chain:false" if there is another longer (at least 7 blocks) but still valid chain and it is very unlikely that this happens. This would only happen if someone had the majority of the hasingpower and would use it not to mine bitcoins but to manipulate the transactions. If you search for "51% attack" you should be able to fine more on that topic.


Title: Re: To know a block in mainchain
Post by: upal on December 30, 2013, 10:13:33 AM
6 blocks means 6 confirmations ?

Yes.

I was reading this: https://en.bitcoin.it/wiki/Confirmation

So what I understand, theoretically at any point of time "main_chain":true may get converted to "main_chain":false. But generally it does not happen after 6 confirmations.

Please correct me if I am wrong.


Well the last 6 block be set to "main_chain:false" if there is another longer (at least 7 blocks) but still valid chain and it is very unlikely that this happens. This would only happen if someone had the majority of the hasingpower and would use it not to mine bitcoins but to manipulate the transactions. If you search for "51% attack" you should be able to fine more on that topic.

Does it mean that just after a transaction is made, its block shows "main_chain:false", till its block height fall below 6 of longest chain ?


Title: Re: To know a block in mainchain
Post by: shorena on December 30, 2013, 10:32:50 AM
6 blocks means 6 confirmations ?

Yes.

I was reading this: https://en.bitcoin.it/wiki/Confirmation

So what I understand, theoretically at any point of time "main_chain":true may get converted to "main_chain":false. But generally it does not happen after 6 confirmations.

Please correct me if I am wrong.


Well the last 6 block be set to "main_chain:false" if there is another longer (at least 7 blocks) but still valid chain and it is very unlikely that this happens. This would only happen if someone had the majority of the hasingpower and would use it not to mine bitcoins but to manipulate the transactions. If you search for "51% attack" you should be able to fine more on that topic.

Does it mean that just after a transaction is made, its block shows "main_chain:false", till its block height fall below 6 of longest chain ?

No, the last block allways shows "main_chain:true" untill there is a longer chain.

Here is one with main_chain:false

https://blockchain.info/rawblock/454891/00000000000000033cb2a1173ec63df6b57b73695154e18be9b84a98efeb521b

As you can see here https://blockchain.info/blocks

it was block #277712 but whoever made Block #277713 used the other #277712 from 2013-12-30 09:56:31 as the previous block and thus this one was set to main_chain:false, which leads to this
transaction https://blockchain.info/tx/38cac86b901154abdfad7715266395ceef39996be10c802a8a0fc3fe412cc154
(the reward for mining the block) never getting a verification.


Title: Re: To know a block in mainchain
Post by: bitpop on December 30, 2013, 10:51:01 AM
6 confirmations guarantees that won't happen
That's the point of confirmations


Title: Re: To know a block in mainchain
Post by: upal on December 30, 2013, 12:51:55 PM
OK ...So when I am checking a transaction in blockchain, if I go by the following process, is that safe ?

1. Checking if no. of confirmation > 6

2. When it is > 6, the block of the transaction is in the main chain.


Title: Re: To know a block in mainchain
Post by: upal on December 30, 2013, 04:01:00 PM
any help ?


Title: Re: To know a block in mainchain
Post by: cr1776 on December 30, 2013, 06:07:26 PM
OK ...So when I am checking a transaction in blockchain, if I go by the following process, is that safe ?

1. Checking if no. of confirmation > 6

2. When it is > 6, the block of the transaction is in the main chain.

This will almost always be true. BUT in March 2013 a fork lasted 24 blocks, iirc.  It is unlikely to happen again - these were extremely rare circumstances - but it should be noted.


Title: Re: To know a block in mainchain
Post by: bitpop on December 31, 2013, 03:50:59 AM
It depends on your exact application. For most 0 conf is fine


Title: Re: To know a block in mainchain
Post by: cr1776 on December 31, 2013, 10:15:05 AM
It depends on your exact application. For most 0 conf is fine

Yes, it depends on the application, but always not edge cases. :-)


Title: Re: To know a block in mainchain
Post by: upal on December 31, 2013, 10:53:27 AM
It depends on your exact application. For most 0 conf is fine

Yes, it depends on the application, but always not edge cases. :-)

I think ZERO confirmation is NOT fine, because a fraud can make a transaction with ZERO transaction fee which will probably never be confirmed !!!


Title: Re: To know a block in mainchain
Post by: deepceleron on January 01, 2014, 12:20:14 PM
Have a look at an orphan: https://blockchain.info/block-index/239232

Main chain is another way of saying the longest chain.

If two miners mined the same block number at the same time and transmit it to the network equally well, it is unclear which will become part of the main chain until another block is mined - the next mined block will have chosen which one goes into the permanent record, and the other block will be orphaned.

From a user and transaction point of view, this kind of network orphaning doesn't have much impact, as both chains could have your transaction in them, and miners don't have any specific prejudices against a particular Bitcoin user's transactions.

The reason that confirmations are required before a payment is trustable is that a dedicated adversary may be able to fool you with a payment that will never confirm, because they successfully double-spend the coins to someone else. The payment that is included in the blockchain is the permanent one.