ArsenShnurkov (OP)
Legendary
Offline
Activity: 1386
Merit: 1000
|
|
January 19, 2013, 10:43:39 PM Last edit: January 19, 2013, 11:15:47 PM by ArsenShnurkov |
|
What prevent the miners from generating the whole new blockchain with low difficulty along the chain? Thus the chain can be splitted from the starting block or from any checkpoint...
|
|
|
|
|
|
You can see the statistics of your reports to moderators on the "Report to moderator" pages.
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
|
|
Gabi
Legendary
Offline
Activity: 1148
Merit: 1008
If you want to walk on water, get out of the boat
|
|
January 19, 2013, 11:09:21 PM |
|
The fact that no client would accept it?
|
|
|
|
ArsenShnurkov (OP)
Legendary
Offline
Activity: 1386
Merit: 1000
|
|
January 19, 2013, 11:11:24 PM Last edit: January 20, 2013, 01:01:17 AM by ArsenShnurkov |
|
no client would accept it?
Why? New chain can be made longer than the existing one 1) take the place in the "official" chain where difficulty changes 2) generate 2016 blocks to establish low difficulty 3) generate rest of new chain with low difficulty 4) ship all of this to the network 5) ... 6) profit UPD: http://sourceforge.net/mailarchive/message.php?msg_id=28441042
|
|
|
|
kokjo
Legendary
Offline
Activity: 1050
Merit: 1000
You are WRONG!
|
|
January 19, 2013, 11:18:41 PM |
|
the best chain is determined not by length(blocks) but by work(hashs).
|
"The whole problem with the world is that fools and fanatics are always so certain of themselves and wiser people so full of doubts." -Bertrand Russell
|
|
|
ArsenShnurkov (OP)
Legendary
Offline
Activity: 1386
Merit: 1000
|
|
January 19, 2013, 11:21:24 PM |
|
I mean not the length(blocks) but count(blocks in the chain)the best chain is determined not by length(blocks) but by work(hashs).
I don't understood this. The number of calculated hashes is not included into the block, so there is no way to reliable determine the amount of work
|
|
|
|
DeathAndTaxes
Donator
Legendary
Offline
Activity: 1218
Merit: 1079
Gerald Davis
|
|
January 19, 2013, 11:30:18 PM |
|
The "best" chain is the one with the highest combined difficulty. So a longer but easier chain won't be seen as the "best/longest".
The only way to have the longer chain is to do more work then the current longest chain.
|
|
|
|
kokjo
Legendary
Offline
Activity: 1050
Merit: 1000
You are WRONG!
|
|
January 19, 2013, 11:33:46 PM |
|
the best chain is determined not by length(blocks) but by work(hashs).
I don't understood this. The number of calculated hashes is not included into the block, so there is no way to reliable determine the amount of work each blockheader contains a field called "bits", the field describes how much of the hash should be 0's, before the block is considered valid. this number is the same as difficulty. a difficulty adjustment every 2 weeks, adjusts the bits field, depending on the timestamps on the first and last block in that difficulty period. trying to match 2 week on average: if blocks are created too fast, difficulty rises; too slow, difficulty falls.
|
"The whole problem with the world is that fools and fanatics are always so certain of themselves and wiser people so full of doubts." -Bertrand Russell
|
|
|
ArsenShnurkov (OP)
Legendary
Offline
Activity: 1386
Merit: 1000
|
|
January 19, 2013, 11:35:53 PM |
|
The "best" chain is the one with the highest combined difficulty.
Where i can find this check in the code? (in which source code file and function)
|
|
|
|
21after2
Member
Offline
Activity: 112
Merit: 16
|
|
January 19, 2013, 11:55:34 PM |
|
This should probably be in mining, I would think, as opposed to newbies.
|
|
|
|
ArsenShnurkov (OP)
Legendary
Offline
Activity: 1386
Merit: 1000
|
|
January 19, 2013, 11:58:04 PM Last edit: January 20, 2013, 12:49:53 AM by ArsenShnurkov |
|
I found global variable CBigNum bnBestChainWork = 0; in file https://github.com/bitcoin/bitcoin/blob/0e31ae9818528d52bbd802a8917b7015f8e38ae7/src/main.cpp#L38Now I want to understand how the code calculate this "Work" class CBlockIndex contains member CBigNum bnChainWork;Here https://github.com/bitcoin/bitcoin/blob/0e31ae9818528d52bbd802a8917b7015f8e38ae7/src/main.cpp#L1925https://github.com/bitcoin/bitcoin/blob/0e31ae9818528d52bbd802a8917b7015f8e38ae7/src/main.cpp#L2537it is calculated bnChainWork = (pindexNew->pprev ? pindexNew->pprev->bnChainWork : 0) + pindexNew->GetBlockWork(); https://github.com/bitcoin/bitcoin/blob/0e31ae9818528d52bbd802a8917b7015f8e38ae7/src/main.h#L1788struct CBlockIndexWorkComparator { bool operator()(CBlockIndex *pa, CBlockIndex *pb) { if (pa->bnChainWork > pb->bnChainWork) return false; if (pa->bnChainWork < pb->bnChainWork) return true;
if (pa->GetBlockHash() < pb->GetBlockHash()) return false; if (pa->GetBlockHash() > pb->GetBlockHash()) return true;
return false; // identical blocks } };
global set of blocks https://github.com/bitcoin/bitcoin/blob/0e31ae9818528d52bbd802a8917b7015f8e38ae7/src/main.cpp#L42set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexValid; // may contain all CBlockIndex*'s that have validness >=BLOCK_VALID_TRANSACTIONS, and must contain those who aren't failed Actually, I don't understood, how operator() is called in set: http://www.sgi.com/tech/stl/stl_set.h(I don't know C++ well) Ok, it's usual technique - http://www.sgi.com/tech/stl/set.htmlWhere one can read about block's lifecycle with references to code? How they are received, in which variables they are stored in memory, when they persists to disk and so on?
|
|
|
|
deepceleron
Legendary
Offline
Activity: 1512
Merit: 1025
|
|
January 20, 2013, 12:18:20 PM Last edit: January 20, 2013, 12:30:32 PM by deepceleron |
|
http://bitcoin.org/bitcoin.pdfSection 4; Section 11 The actual "strength" of the blockchain is the chain of difficulty targets stored in blocks since the time of the block one would attempt to replace. The SHA256 hashes of blocks are all below the target; finding such a hash is computationally expensive. By definition, other miners would reject a sequence of blocks where the difficulty target is not as expected for the difficulty period of 2016 blocks or the block hashes did not meet the difficulty. In the actual block, "bits" is a compact form of of the target. { "hash":"000000000000026e70652663fd4a5e3a1c38cfdf0c1b2666308c3816d9c21321", "ver":2, "prev_block":"00000000000000e788455adcba11a49a452acd5298e3a26d2db4cb9fcc050d1a", "mrkl_root":"b5484c1dd069b73063ea5cc594826b1541a8d5fd069629e9e950bb304789670b", "time":1358682853, "bits":436545969,
|
|
|
|
|