Author

Topic: What are checkpoints in bitcoin code? (Read 14841 times)

legendary
Activity: 1232
Merit: 1094
April 10, 2014, 06:06:00 AM
#93
I'm having a hard time figuring out why checkpoints do not provide any security ....

They have positives and negatives.

A checkpoint means that miners won't jump to a secret fork.

Miners who didn't checkpoint will still jump and so will some clients if they were offline when the checkpoint triggered.

This means you split the network into 2 pieces if a major fork happens.
newbie
Activity: 2
Merit: 0
April 10, 2014, 05:19:57 AM
#92
who makes the checkpoints?
The bitcoin core devs
so ultimately, the state of the block chain depends entirely on them.
not really. they only put checkpoint for blocks that are buried at least few hundreds deep already - unlikely to be reverted by honest means.
but if you disagree with any checkpoint they add, just don't upgrade your node and you will be fine.

well that's a practical solution, but it violates the notion of 'peer-to-peer' or equality for all nodes in the network.

there is no indication of 'checkpoints' in the satoshi whitepaper.

furthermore, if we rely on such checkpoints for security, why do we even have proof of work at all?  Why don't we just rely on the checkpoints?

I'm having a hard time figuring out what you mean by "equality of all nodes".  The equality (or inequality) of nodes is not part of the system.  No one cares about nodes.  We care about the chain.  If a node has the correct chain and can give you a copy, it is "equal" to all of the other good nodes.  If it doesn't, or can't, then it equal at all, isn't even a node.

The checkpoints do not provide any security, nor were they ever intended to.  They just keep "unequal" nodes from wasting your time with bogus chains (whether by accident or malice).

Also, you are free to edit and recompile as needed.  You can strip them out entirely, or add your own, or change them.  Whatever you want.  The reference client is written for (and compiled for) working well for a wide audience.

Technically, a longer chain is the best chain, regardless of the checkpoints.  In practice, the checkpoints are far enough in the past that if a new chain showed up that overturned one, we'd almost universally consider it an attack, and roll back.

P.S.  No one particularly likes the checkpoints, the devs least of all.  There has been much discussion about removing them, or switching to a soft system (config file, etc).  So far, no one has come up with a really good solution.


I'm having a hard time figuring out why checkpoints do not provide any security ....
legendary
Activity: 1232
Merit: 1094
April 10, 2014, 04:55:06 AM
#91
How about following rule:
when a block is generated, the block 120 blocks deep the chain is checkpointed, *if*
- current hashing power is more than half of the to-be-checkpointed block

How do you measure current hashing power?

Do you mean difficulty must be at least 50% of what it was 120 blocks ago?  That isn't much protection since difficulty doesn't change very often.

Quote
Does this guarantee solving problems with forked chains? Only the chain is checkpointed which has majority of the hashing power.

The problem with checkpointing is what happens if there is a reversal.

For example, if I launch a 51% attack starting from behind the checkpoint, then all new nodes will follow my chain.

Nodes that were offline will also follow my chain.

Nodes that were online would follow the other chain.

This forks the network and it can't heal itself.

I think sending the entire header tree would help here.  A new node that connects would see that there was a 120+ block fork.  It could warn the user that the chain is potentially unstable at the moment.

Nodes would be able to see that there was a fork that would have caused a checkpoint.

Quote
Still thinking good formula to estimate if the hashing power is more than half.. both blocks difficulty and time should be considered. And maybe some safety reserve, so variations on block times does not affect the result.

Including block time is risky, since it creates an incentive to mess with the field.  An attacker could set it to whatever he likes (but not to far in the future).

Faking high hash rate means earlier block times, so the future rule doesn't apply.  If I produce a sequence of blocks with timestamps 1 second apart, it will seem like a massive hash rate.

Quote
Edit: when a new soft checkpoint is made, the previous one can be forgotten, ie there need not to be more than one soft checkpoint at a time.

If they are both on the same chain, then keeping the old one has no effect one way or another.

What do you mean by soft?  The rule could be that a fork 120 blocks longer can displace a checkpoint.  This would at least allow the network to re-sync.

Clients could enter emergency mode using this rule.

- find longest chain (L)
- find any other chain which
-- forked more than 120 blocks ago
-- where the fork is at least 120 blocks long
-- has a weight of at least (L's weight - 120 blocks)

The hard checkpoints also speed up validation.  They could do that without acting as checkpoints.

Validation would start at the last hard checkpoint that is on the longest chain.

If the entire chain was displaced by a higher POW chain, then nodes would accept the new chain.  They would have to verify it in its entirety.
sr. member
Activity: 477
Merit: 500
April 10, 2014, 01:13:02 AM
#90
I'm quite sure this has been discussed before, but why clients does not make automatic checkpoints? I understand that transactions which are at least 6 blocks old, are considered valid. There should be no reason to re-arrange the blockchain after that, for any reason. If 6 blocks sounds too short, maybe 120 blocks then? Coinbase coins should definitely be stoned when they are spendable.


I still consider that since coinbase transactions are agreed by the network to be spendable, that means they are agreed to be existent to foreseeable future and thus should be checkpointed.

How about following rule:
when a block is generated, the block 120 blocks deep the chain is checkpointed, *if*
- current hashing power is more than half of the to-be-checkpointed block

Not sure if this checkpointing even need to be broadcasted; every client should be in full agreement of it.

Then, I also suggest that coinbase transactions *are not spendable* unless they are checkpointed.

Does this guarantee solving problems with forked chains? Only the chain is checkpointed which has majority of the hashing power.
Still thinking good formula to estimate if the hashing power is more than half.. both blocks difficulty and time should be considered. And maybe some safety reserve, so variations on block times does not affect the result.

Does this open any attack vectors?


Edit: when a new soft checkpoint is made, the previous one can be forgotten, ie there need not to be more than one soft checkpoint at a time.
newbie
Activity: 11
Merit: 0
April 09, 2014, 09:25:42 AM
#89
amazing checkpoint,still cant quitely follow
full member
Activity: 173
Merit: 100
March 10, 2014, 11:43:15 PM
#88
who makes the checkpoints?
The bitcoin core devs
so ultimately, the state of the block chain depends entirely on them.
not really. they only put checkpoint for blocks that are buried at least few hundreds deep already - unlikely to be reverted by honest means.
but if you disagree with any checkpoint they add, just don't upgrade your node and you will be fine.

well that's a practical solution, but it violates the notion of 'peer-to-peer' or equality for all nodes in the network.

there is no indication of 'checkpoints' in the satoshi whitepaper.

furthermore, if we rely on such checkpoints for security, why do we even have proof of work at all?  Why don't we just rely on the checkpoints?

Being peer-to-peer also means that everyone in the network can choose to use whatever client or whatever version of a certain client in order to be part of the Bitcoin network. As of now, we don't have too many options for running a full node, but in the future, more independent implementations will likely to emerge.
kjj
legendary
Activity: 1302
Merit: 1026
March 10, 2014, 11:40:31 PM
#87
The main issue is that in the event of a flaw which causes the network to fork you have now hard coded that fork.

For example if the db bug issue which caused a fork in the network, miners on the longer fork modified their blockchains to support the shorter fork.  So some intervention was required but for all 100,000+ other nodes they simply saw a re-org once the the shorter fork became the longer one.  If they used ratcheting checkpoints they would have been permanently locked onto a minority fork and attackers could have exploited that.

There may be some merit in using a ratcheting checkpoint system however it would have to be set much much deeper than 6 blocks.  Even 144 blocks (one day) may be insufficient.  Something like 1,024 blocks (~1 week) is more the range that would be conservative enough.

Also understand a ratcheing checkpoint system only helps existing nodes.  Bootstraping nodes would be remain vulnerable as they haven't seen the longest chain yet.

Do you mean this:
https://bitcoin.org/en/alert/2013-03-11-chain-fork

But it would have been solved simply by bootstrapping the blockchain along with the software downgrade. If it needs software update, you allways have the option to force block reload, maybe from some hardcoded checkpoint.

In that case, whoever controls the update system controls everything.
donator
Activity: 1218
Merit: 1080
Gerald Davis
March 10, 2014, 03:12:42 PM
#86
But it would have been solved simply by bootstrapping the blockchain along with the software downgrade. If it needs software update, you allways have the option to force block reload, maybe from some hardcoded checkpoint.

That is my point and until 100% of nodes upgrade their software they would be vulnerable to an isolation attack.  It creates a more fragile and exploitable system than users wallets simply being able to switch to the longest chain with no action required on the part of the user.
sr. member
Activity: 477
Merit: 500
March 10, 2014, 03:10:19 PM
#85
The main issue is that in the event of a flaw which causes the network to fork you have now hard coded that fork.

For example if the db bug issue which caused a fork in the network, miners on the longer fork modified their blockchains to support the shorter fork.  So some intervention was required but for all 100,000+ other nodes they simply saw a re-org once the the shorter fork became the longer one.  If they used ratcheting checkpoints they would have been permanently locked onto a minority fork and attackers could have exploited that.

There may be some merit in using a ratcheting checkpoint system however it would have to be set much much deeper than 6 blocks.  Even 144 blocks (one day) may be insufficient.  Something like 1,024 blocks (~1 week) is more the range that would be conservative enough.

Also understand a ratcheing checkpoint system only helps existing nodes.  Bootstraping nodes would be remain vulnerable as they haven't seen the longest chain yet.

Do you mean this:
https://bitcoin.org/en/alert/2013-03-11-chain-fork

But it would have been solved simply by bootstrapping the blockchain along with the software downgrade. If it needs software update, you allways have the option to force block reload, maybe from some hardcoded checkpoint.
donator
Activity: 1218
Merit: 1080
Gerald Davis
March 10, 2014, 02:07:37 PM
#84
The main issue is that in the event of a flaw which causes the network to fork you have now hard coded that fork.

For example if the db bug issue which caused a fork in the network, miners on the longer fork modified their blockchains to support the shorter fork.  So some intervention was required but for all 100,000+ other nodes they simply saw a re-org once the the shorter fork became the longer one.  If they used ratcheting checkpoints they would have been permanently locked onto a minority fork and attackers could have exploited that.

There may be some merit in using a ratcheting checkpoint system however it would have to be set much much deeper than 6 blocks.  Even 144 blocks (one day) may be insufficient.  Something like 1,024 blocks (~1 week) is more the range that would be conservative enough.

Also understand a ratcheing checkpoint system only helps existing nodes.  Bootstraping nodes would be remain vulnerable as they haven't seen the longest chain yet.
sr. member
Activity: 477
Merit: 500
March 10, 2014, 02:00:08 PM
#83
I'm quite sure this has been discussed before, but why clients does not make automatic checkpoints? I understand that transactions which are at least 6 blocks old, are considered valid. There should be no reason to re-arrange the blockchain after that, for any reason. If 6 blocks sounds too short, maybe 120 blocks then? Coinbase coins should definitely be stoned when they are spendable.

So I'd like to hear what is the reasoning behind the fact that there are no automatic checkpoints?

Let's *try* to imagine situations where automatic checkpoint (here I mean every node considers it chain's blocks from head-6 and earlier to be 'stoned', non-changeable) would cause harm:

1. Branch which will survive 6 blocks. Isn't this practically an error case? If it can happen, that just means 6 block validation time is too short since it cannot guarantee transactions confirmed.
2. Some node mines isolated from the others. This is the case where it would cause minor problem. However the problem is very local, and very similar problem would be regardless of the automatic checkpoint.

Basicly it would just be a non-centralised agreement between nodes after they find a new head block; we all consider blocks backwards from this-6 nodes to be immutable.
legendary
Activity: 1232
Merit: 1094
December 21, 2013, 08:14:19 AM
#82
I should look closer to your proposal.

It's not my idea, the OP in that thread thought of it.

Quote
For now I have one question:
Does "up" link points to future? If so - is it included in block hash or can it be falsified?

No, they always points backwards.

To determine where to point the up link.

- count the number of leading zeros on the previous block's hash (i.e. the block you plan to build on top of)
- starting from the block before that, find the first block with more leading zeros
- point to the block one after that

So, if the blocks had leading zeros

A: 11(up = Genesis)
B: 10 (up = Genesis)
C: 20 (up = B)   (Not both prev and up point at B)
D: 10 (up = Genesis)
E: 10 (up = D)
F: 10 (up = D)
G: 10 (up = D)
H: 15 (up = D)
I: 10 (up = D)
J: 10 (up = I)
K: 10 (up = I)

The for block L, the links would be

prev: K
up: I

The reason is that H has more leading zeros than K.  You don't link to C, even though it has more leading zeros.  Once you find that block, the up link points to the one after that.

So, finding the best block

stating at K, follow up link, until up link points to genesis
- follow up link to get to I (prev now point at H, so found block with 15 leading zeros)
- follow up link to get to D (prev now points at C, so found block with 20 leading zeros)
- up for D link points to genesis, so break from loop

follow D's previous link to get C which is the best block

You can also find all blocks with more than n leading zeros by following the previous link any time you find a block with more than that number of leading zeros.
kjj
legendary
Activity: 1302
Merit: 1026
December 21, 2013, 02:16:28 AM
#81
Do you understand that this option is protocol specification change? It effectively forks blockchain.

Heh.  This is the sort of nonsense I was talking about.

This is local control.  You, the node operator, have options.  Hardly a new thing.  Since day 1, all node operators have had the ability to fork for whatever reason and through whatever means they desire.

You have a warped view of "decentralized".  It doesn't mean that no one has any authority, it means that no one can stop you.

Who can stop you from turning checkpoints off?  No one.
Who can stop you from stripping them out of the source entirely and running your own pure node?  No one.
newbie
Activity: 28
Merit: 0
December 21, 2013, 01:20:20 AM
#80
Of course hidden fork crunched at high speed in shadow is unlikely, and maybe checkpoints do not harm due to low probability of such fork.
But they harm in other way - they compromise Bitcoin decentralization, which is in my opinion is the biggest attractive feature of Bitcoin.
Today they add checkpoints (this effectively changes protocol specification), tomorrow they could freeze BTC on your address, by adding small tweaks to validation routine (just like checkpoints validation).

Nonsense, every word.

Unbeatable arguments, thank you.

Quote
root@linuxcoin:/home/user# bitcoind --help
Bitcoin version v0.8.6.0-g03a7d67-beta

  -checkpoints           Only accept block chain matching built-in checkpoints (default: 1)

Do you understand that this option is protocol specification change? It effectively forks blockchain.
newbie
Activity: 28
Merit: 0
December 21, 2013, 01:11:47 AM
#79
In a way, bitcoin (and almost all other crypto coins) are still some what centralized. The devs are the centralization. There's not much we can do about that.

Yes, they are centralization. But as long as they do not adjust blockchain on regular basis (select which chain is good and which is not) - they gain trust of users.

The redeeming thing is that almost all of them are open source with code available to be self-compiled.

Yes, but the problem is that the client with checkpoints and one without - are not 100% compatible with each other. Checkpoints are not just cosmetic change.

While the protocol itself is decentralized, it is a requirement that honest nodes form a consensus. Remember the hard fork early this year.

Bitcoin already has mechanism to achieve consensus - voting by computing resources, it should not be substituted by any centralized authority.
kjj
legendary
Activity: 1302
Merit: 1026
December 21, 2013, 12:40:27 AM
#78
  -addtag=           Add a tag to your coinbase
  -txindex               Maintain a full transaction index (default: 0)

What do those two do? I'm guessing the tag is meant for miners? Is it useful for regular people who just run a node or wallet?

Since I just run QT like normal, I don't get the full transaction index? Does that take up additional space or isn't everything in the blockchain anyway? Or I am correct to guess that this is better used by large online wallets or something?

Heh, oops, -addtag is a custom mod that I maintain.  It does indeed add tags to the coinbase for mining.

-txindex makes the node keep an index of all transactions.  This is very helpful for RPC services, particularly those using raw transactions.
legendary
Activity: 3416
Merit: 1912
The Concierge of Crypto
December 20, 2013, 11:05:16 PM
#77
  -addtag=           Add a tag to your coinbase
  -txindex               Maintain a full transaction index (default: 0)

What do those two do? I'm guessing the tag is meant for miners? Is it useful for regular people who just run a node or wallet?

Since I just run QT like normal, I don't get the full transaction index? Does that take up additional space or isn't everything in the blockchain anyway? Or I am correct to guess that this is better used by large online wallets or something?
kjj
legendary
Activity: 1302
Merit: 1026
December 20, 2013, 10:04:57 PM
#76
I think the checkpoints are about at least a month or two back in time. Anyone who has more than 51% of 6.5 Petahash of mining power that can fork their own chain past the latest check point, is better off mining regularly and getting 51% of 3600 coins daily or about 1800 coins, at least for the next 2000 blocks when the difficulty will double.

Of course hidden fork crunched at high speed in shadow is unlikely, and maybe checkpoints do not harm due to low probability of such fork.
But they harm in other way - they compromise Bitcoin decentralization, which is in my opinion is the biggest attractive feature of Bitcoin.
Today they add checkpoints (this effectively changes protocol specification), tomorrow they could freeze BTC on your address, by adding small tweaks to validation routine (just like checkpoints validation).

Nonsense, every word.

Quote
root@linuxcoin:/home/user# bitcoind --help
Bitcoin version v0.8.6.0-g03a7d67-beta

Usage:
  bitcoind [options]
  bitcoind [options] [params]  Send command to -server or bitcoind
  bitcoind [options] help                List commands
  bitcoind [options] help       Get help for a command

Options:
  -?                     This help message
  -conf=           Specify configuration file (default: bitcoin.conf)
  -pid=            Specify pid file (default: bitcoind.pid)
  -gen                   Generate coins (default: 0)
  -datadir=         Specify data directory
  -dbcache=           Set database cache size in megabytes (default: 25)
  -timeout=           Specify connection timeout in milliseconds (default: 5000)
  -proxy=       Connect through socks proxy
  -socks=             Select the version of socks proxy to use (4-5, default: 5)
  -tor=         Use proxy to reach tor hidden services (default: same as -proxy)
  -dns                   Allow DNS lookups for -addnode, -seednode and -connect
  -port=           Listen for connections on (default: 8333 or testnet: 18333)
  -maxconnections=    Maintain at most connections to peers (default: 125)
  -addnode=          Add a node to connect to and attempt to keep the connection open
  -connect=          Connect only to the specified node(s)
  -seednode=         Connect to a node to retrieve peer addresses, and disconnect
  -externalip=       Specify your own public address
  -onlynet=         Only connect to nodes in network (IPv4, IPv6 or Tor)
  -discover              Discover own IP address (default: 1 when listening and no -externalip)
  -checkpoints           Only accept block chain matching built-in checkpoints (default: 1)
  -listen                Accept connections from outside (default: 1 if no -proxy or -connect)
  -bind=           Bind to given address and always listen on it. Use [host]:port notation for IPv6
  -dnsseed               Find peers using DNS lookup (default: 1 unless -connect)
  -banscore=          Threshold for disconnecting misbehaving peers (default: 100)
  -bantime=           Number of seconds to keep misbehaving peers from reconnecting (default: 86400)
  -maxreceivebuffer=  Maximum per-connection receive buffer, *1000 bytes (default: 5000)
  -maxsendbuffer=     Maximum per-connection send buffer, *1000 bytes (default: 1000)
  -paytxfee=        Fee per KB to add to transactions you send
  -daemon                Run in the background as a daemon and accept commands
  -testnet               Use the test network
  -debug                 Output extra debugging information. Implies all other -debug* options
  -debugnet              Output extra network debugging information
  -logtimestamps         Prepend debug output with timestamp (default: 1)
  -shrinkdebugfile       Shrink debug.log file on client startup (default: 1 when no -debug)
  -printtoconsole        Send trace/debug info to console instead of debug.log file
  -rpcuser=        Username for JSON-RPC connections
  -rpcpassword=      Password for JSON-RPC connections
  -rpcport=        Listen for JSON-RPC connections on (default: 8332 or testnet: 18332)
  -rpcallowip=       Allow JSON-RPC connections from specified IP address
  -rpcconnect=       Send commands to node running on (default: 127.0.0.1)
  -rpcthreads=        Set the number of threads to service RPC calls (default: 4)
  -blocknotify=     Execute command when the best block changes (%s in cmd is replaced by block hash)
  -walletnotify=    Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)
  -alertnotify=     Execute command when a relevant alert is received (%s in cmd is replaced by message)
  -upgradewallet         Upgrade wallet to latest format
  -keypool=           Set key pool size to (default: 100)
  -rescan                Rescan the block chain for missing wallet transactions
  -addtag=           Add a tag to your coinbase
  -salvagewallet         Attempt to recover private keys from a corrupt wallet.dat
  -checkblocks=       How many blocks to check at startup (default: 288, 0 = all)
  -checklevel=        How thorough the block verification is (0-4, default: 3)
  -txindex               Maintain a full transaction index (default: 0)
  -loadblock=      Imports blocks from external blk000??.dat file
  -reindex               Rebuild block chain index from current blk000??.dat files
  -par=               Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)
legendary
Activity: 3416
Merit: 1912
The Concierge of Crypto
December 20, 2013, 10:01:00 PM
#75
In a way, bitcoin (and almost all other crypto coins) are still some what centralized. The devs are the centralization. There's not much we can do about that.

The redeeming thing is that almost all of them are open source with code available to be self-compiled.

If it were not check points, there is also the bootstrap file uploaded by Jeff Garzik. That is sort of centralized, but distributed by torrent, for all new users who need an initial sync of the correct block chain.

While the protocol itself is decentralized, it is a requirement that honest nodes form a consensus. Remember the hard fork early this year.
newbie
Activity: 28
Merit: 0
December 20, 2013, 09:51:56 PM
#74
I think the checkpoints are about at least a month or two back in time. Anyone who has more than 51% of 6.5 Petahash of mining power that can fork their own chain past the latest check point, is better off mining regularly and getting 51% of 3600 coins daily or about 1800 coins, at least for the next 2000 blocks when the difficulty will double.

Of course hidden fork crunched at high speed in shadow is unlikely, and maybe checkpoints do not harm due to low probability of such fork.
But they harm in other way - they compromise Bitcoin decentralization, which is in my opinion is the biggest attractive feature of Bitcoin.
Today they add checkpoints (this effectively changes protocol specification), tomorrow they could freeze BTC on your address, by adding small tweaks to validation routine (just like checkpoints validation).
newbie
Activity: 28
Merit: 0
December 20, 2013, 09:43:32 PM
#73
There would be no way to prove that they are part of the chain.

Yes - I considered this. I think it is not a problem, because it is very unlikely that someone can prepare 0.01*MaxBlocks different blocks (unchained, as you noted) which have accumulated difficulty more than 1% or so of total accumulated work spent on main chain for whole time of Bitcoin existence.

In the High hash highway, a second pointer is added.  Headers would have a link to the previous block and also an "up" link.

This allows you follow backwards from the leaf of the chain much faster, but still hit all the high blocks.  However, it is a hard fork.

The 2nd link points to the nearest block with more leading zero bits than the previous block.
I should look closer to your proposal. For now I have one question:
Does "up" link points to future? If so - is it included in block hash or can it be falsified?
legendary
Activity: 3416
Merit: 1912
The Concierge of Crypto
December 20, 2013, 08:50:11 PM
#72
I think the checkpoints are about at least a month or two back in time. Anyone who has more than 51% of 6.5 Petahash of mining power that can fork their own chain past the latest check point, is better off mining regularly and getting 51% of 3600 coins daily or about 1800 coins, at least for the next 2000 blocks when the difficulty will double.
legendary
Activity: 1232
Merit: 1094
December 20, 2013, 08:29:16 PM
#71
we should add ability to request block headers sorted by difficulty, starting with the most expensive one and continue in descending order. This would allow to detect flood with even less traffic, like few percents of Max_Blocks.

There would be no way to prove that they are part of the chain.

In the High hash highway, a second pointer is added.  Headers would have a link to the previous block and also an "up" link.

This allows you follow backwards from the leaf of the chain much faster, but still hit all the high blocks.  However, it is a hard fork.

The 2nd link points to the nearest block with more leading zero bits than the previous block.

In fact, I think optimal would be, point to the block after the nearest block with more leading zero bits than the previous block.

So, the blocks had the following leading zero bits

A) 30
B) 31 - up -> genesis (since 30 is the best so far)
C) 29 - up -> genesis (since 31 is the best so far)
D) 33 - up -> C
E) 31 - up -> genesis (since 33 is the best block)
F) 32 - up -> E
G) 30 - up -> E
H) 32 - up -> G

If you follow the up link backwards, you go to a block that is the successor of a block with at least 1 more leading zero than the previous block.

To find the highest block, these are the steps

- Set N to the index of the leaf block
- Set b to the number of leading zeros for block N-1

Loop
- The up pointer for block N points to block M
- Block M-1 has more leading zeros than block N-1 (by definition)
- It also has more leading zeros than any blocks from N-1 to M, inclusive
- This means you can't have skipped a better block than block M-1
- set N = M
- set b = the number of leading zeros for block M-1

Each time through the loop b is guaranteed to increase and also you are guaranteed not to skip the best block.

Therefore, this search will find the best block.

The PoW of the main chain can be estimated just by looking at the work of the best block.

You can also use the system to find all blocks which have difficulty within a number of bits of the best block.
newbie
Activity: 28
Merit: 0
December 20, 2013, 06:50:31 PM
#70
I think the headers first change is a key stepping stone for this.

Downloading 300k blocks is around a 20MB download.

With modern bandwidth, nodes could download that from 8 peers reasonably quickly and then discard any chain that doesn't have sufficient POW.

I agree, for now and most likely for future downloading all block headers is not an issue. So don't even need to adjust protocol.
newbie
Activity: 28
Merit: 0
December 20, 2013, 04:28:47 PM
#69
It would be cool if someone could work out a formula.
Max blocks = f(time since genesis, POW)

Yes, this is the key for improvement. It does not have to provide strict upper_bound, but something that >= strict_upper_bound.
Plus, if this approach will be accepted, we should add ability to request block headers sorted by difficulty, starting with the most expensive one and continue in descending order. This would allow to detect flood with even less traffic, like few percents of Max_Blocks.
legendary
Activity: 1232
Merit: 1094
December 20, 2013, 09:46:15 AM
#68
Not everything goes to BIP.  This is a purely internal function of the reference client.  Most discussion of changes like this actually happen on github, attached to the pull request that implements them.

I think the headers first change is a key stepping stone for this.

Downloading 300k blocks is around a 20MB download.

With modern bandwidth, nodes could download that from 8 peers reasonably quickly and then discard any chain that doesn't have sufficient POW.

The more blocks in a blockchain, the higher the total POW.  It would be cool if someone could work out a formula.

Max blocks = f(time since genesis, POW)
kjj
legendary
Activity: 1302
Merit: 1026
December 20, 2013, 07:51:05 AM
#67
Cool.  When can we expect your patch?

I think this idea should be discussed first in separate topic. Then, as I understand it should go to Bitcoin Improvement Proposals.

Not everything goes to BIP.  This is a purely internal function of the reference client.  Most discussion of changes like this actually happen on github, attached to the pull request that implements them.
newbie
Activity: 28
Merit: 0
December 20, 2013, 04:08:55 AM
#66
Cool.  When can we expect your patch?

I think this idea should be discussed first in separate topic. Then, as I understand it should go to Bitcoin Improvement Proposals.
sr. member
Activity: 280
Merit: 257
bluemeanie
December 16, 2013, 06:10:50 PM
#65
I am reading bitcoin codes, and I don't quite get what are checkpoints in the bitcoin code:

Quote
        ( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"))
        ( 33333, uint256("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6"))
        ( 74000, uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20"))
        (105000, uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97"))
        (134444, uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"))
        (168000, uint256("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763"))
        (193000, uint256("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317"))
        (210000, uint256("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e"))
        (216116, uint256("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e"))
        (225430, uint256("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932"))

Are they hashes of the blocks at 11111,33333, etc positions? If so how can we precompute them, as going from 1 to block 225430 would take big amount of time of computations...


they're what make Bitcoin not Peer-To-Peer.

kjj
legendary
Activity: 1302
Merit: 1026
December 16, 2013, 06:01:05 PM
#64
Way back on post #5 gmaxwell explains it pretty well.

Again, it is possible to solve this problem by other approaches.
For example via MAIN_CHAIN_MIN_POW as suggested above - it does not compromises decentralization.

We know when Bitcoin was released, we know current date - we can calculate upper bound for block count in any chain.
When somebody tries to send us old chain - we ask it to sent block headers sorted by difficulty, starting with the most expensive one and continue in descending order. 1% of top block headers should have at least 0.01*MAIN_CHAIN_MIN_POW accumulated difficulty, if it is not - then it is fake, else continue, and so on.

Cool.  When can we expect your patch?
newbie
Activity: 28
Merit: 0
December 16, 2013, 04:24:05 PM
#63
Way back on post #5 gmaxwell explains it pretty well.

Again, it is possible to solve this problem by other approaches.
For example via MAIN_CHAIN_MIN_POW as suggested above - it does not compromises decentralization.

We know when Bitcoin was released, we know current date - we can calculate upper bound for block count in any chain.
When somebody tries to send us old chain - we ask it to sent block headers sorted by difficulty, starting with the most expensive one and continue in descending order. 1% of top block headers should have at least 0.01*MAIN_CHAIN_MIN_POW accumulated difficulty, if it is not - then it is fake, else continue, and so on.
kjj
legendary
Activity: 1302
Merit: 1026
December 16, 2013, 03:47:22 PM
#62
You didn't actually read this thread before posting, did you?

I did read this thread, and several old ones: https://bitcointalksearch.org/topic/bitcoin-032-released-437 , https://bitcointalksearch.org/topic/bitcoin-is-not-as-advertised-1647
Do you have any particular objection to discuss?

Way back on post #5 gmaxwell explains it pretty well.

Yes, you are correct.  They are there so some quantum computing farm (doesn't exist, but...) can't come out of nowhere and roll back blocks by mining a long chain from far in the past.
Thats not really what they're for— though that have the effect too. Most of their usefulness is that they prevent a dos attacker from filling up bitcoin node's disk space with long runs of low difficulty blocks forked off low in the chain.

e.g. you start off with difficulty 1 blocks at block 0, now mine-able by the millions by a single asic— _MAYBE_ a chain that starts off that way could eventually turn out to be the longest so absent the checkpoints a node would happily follow an endlessly long chain of them.

They also make is so that an attacker who has complete control of your network (and thus can prevent you from hearing the longest chain from the honest bitcoin network) from putting you on a fake (low difficulty) isolated chain unless they can also trick you into running replaced software. With the checkpoints such an attacker hast to have a ton of mining power in order to continue the chain.
newbie
Activity: 28
Merit: 0
December 16, 2013, 03:31:13 PM
#61
It's an optimization that can be disabled with a command line switch.

Even if it was done for the purposes of optimization - it is still protocol specification change. Clients with disabled "optimization" could accept some branches which would be rejected by client on default settings.

There are other possible approaches to do such kind of optimization, for example MAIN_CHAIN_MIN_POW described above, but it does not compromises decentralization trust as checkpoints do.
legendary
Activity: 1400
Merit: 1013
December 16, 2013, 03:21:06 PM
#60
Protocol rules allows to choose other branch if it has more accumulated difficulty, even if it is rooted in old blocks before checkpoints. Checkpoints override those rules - they essentially change protocol specification. By adding new checkpoint - you are forking protocol specification.
Choice of checkpoints should be done decentralized - by voting, and Bitcoin already has voting mechanism - vote by computing work. But if voting happens by hard checkpoints, selected by dozen of people - then it is centralized, with all bad sides of centralization.
It's an optimization that can be disabled with a command line switch.
newbie
Activity: 28
Merit: 0
December 16, 2013, 03:18:01 PM
#59
I don't understand how you think that checkpoints mean that a small group of people is deciding which branch is correct.

Checkpoints were put by small group of people, most of people even do not heard about checkpoints - and continue to think about Bitcoin as pure decentralized currency, while it is not.

The protocol rules chose the correct branch.  The checkpoints only document what that historical choice was.

Protocol rules allows to choose other branch if it has more accumulated difficulty, even if it is rooted in old blocks before checkpoints. Checkpoints override those rules - they essentially change protocol specification. By adding new checkpoint - you are forking protocol specification.
Choice of checkpoints should be done decentralized - by voting, and Bitcoin already has voting mechanism - vote by computing work. But if voting happens by hard checkpoints, selected by dozen of people - then it is centralized, with all bad sides of centralization.
legendary
Activity: 1246
Merit: 1002
December 16, 2013, 02:57:13 PM
#58
Bitcoin is decentralized. And no small group of people should decide which branch is correct and which is not.

I don't understand how you think that checkpoints mean that a small group of people is deciding which branch is correct.

The protocol rules chose the correct branch.  The checkpoints only document what that historical choice was.

newbie
Activity: 28
Merit: 0
December 16, 2013, 02:16:58 PM
#57
You didn't actually read this thread before posting, did you?

I did read this thread, and several old ones: https://bitcointalksearch.org/topic/bitcoin-032-released-437 , https://bitcointalksearch.org/topic/bitcoin-is-not-as-advertised-1647
Do you have any particular objection to discuss?
kjj
legendary
Activity: 1302
Merit: 1026
December 16, 2013, 02:12:41 PM
#56
Bitcoin is decentralized. And no small group of people should decide which branch is correct and which is not.
Checkpoints hardcoded in code were selected by small group of people.
But if Bitcoin is still claimed to be decentralized, not controlled by government, small group of people (who can be blackmailed, or forced by thermo-rectal cryptanalysis) - then only majority of users should have right to make decision.

Users should vote on which branch is correct and which is not. Bitcoin already has such voting mechanism - vote by computing power.


Of course hidden fork crunched at high speed in shadow is unlikely, and maybe checkpoints do not harm due to low probability of such fork.
But they harm in other way - they compromise Bitcoin decentralization, which is in my opinion is the biggest attractive feature of Bitcoin.
Today they add checkpoints, tomorrow they could freeze BTC on your address, by adding small tweaks to validation routine (just like checkpoints validation).

Checkpoints add almost no value - they do not prevent offensive usage of high computing power, but they trading off fair amount of credibility.
Nobody except majority should have control over blockchain, and Bitcoin's definition of majority is computing power.
Otherwise users must know that blockchain is controlled by small group of human being.

You didn't actually read this thread before posting, did you?
newbie
Activity: 28
Merit: 0
December 16, 2013, 01:58:02 PM
#55
Bitcoin is decentralized. And no small group of people should decide which branch is correct and which is not.
Checkpoints hardcoded in code were selected by small group of people.
But if Bitcoin is still claimed to be decentralized, not controlled by government, small group of people (who can be blackmailed, or forced by thermo-rectal cryptanalysis) - then only majority of users should have right to make decision.

Users should vote on which branch is correct and which is not. Bitcoin already has such voting mechanism - vote by computing power.


Of course hidden fork crunched at high speed in shadow is unlikely, and maybe checkpoints do not harm due to low probability of such fork.
But they harm in other way - they compromise Bitcoin decentralization, which is in my opinion is the biggest attractive feature of Bitcoin.
Today they add checkpoints, tomorrow they could freeze BTC on your address, by adding small tweaks to validation routine (just like checkpoints validation).

Checkpoints add almost no value - they do not prevent offensive usage of high computing power, but they trading off fair amount of credibility.
Nobody except majority should have control over blockchain, and Bitcoin's definition of majority is computing power.
Otherwise users must know that blockchain is controlled by small group of human being.
newbie
Activity: 28
Merit: 0
December 15, 2013, 10:44:17 PM
#54
Is it clearly total work, rather than block height?

Yes, it is total accumulated work.
legendary
Activity: 1246
Merit: 1002
December 15, 2013, 10:38:00 PM
#53

block-chain with bigger combined work amount is the winner, period.


Is it clearly total work, rather than block height?
newbie
Activity: 28
Merit: 0
December 15, 2013, 10:19:02 PM
#52
You are free to use and distribute a fork of the client without any checkpoints.  Checkpoints aren't required. Assumming an attacker isn't attempting to DDOS your node by filling it with years worth of bogus blocks or try to perform a 51% attack months deep in the chain the lack of checkpoint will have absolutely no effect on your node.

So if you are worried then remove the checkpoints, compile it and use that node.  If you are really worried set up an online mirror and advertise your checkpoint free version.

It is not just change of button color or font size, it is protocol specification change.
If one fork has checkpoints and other does not - then they do not have consensus on how to select main blockchain, and this could lead to blockchain fork (at least theoretically).
Bitcoin already has consensus mechanism, and it is the foundation - block-chain with bigger combined work amount is the winner, period.

In a same way as we have checkpoints now, it is possible to freeze BTC on particular address - tune a bit validation rountine (just like checkpoints validation), wait for update of majority of clients - and vu à la. I bet, governments would love this feature, keep going!
Any kind of such validation is poison to trust for the most important of Bitcoin features - decentralization.
newbie
Activity: 28
Merit: 0
December 15, 2013, 09:55:38 PM
#51
Instead of checkpoints, client could hard-code a MAIN_CHAIN_MIN_POW variable.  This would be the PoW of the main chain when that version of the client was released.  All clients wouldn't need to agree on a value.  It is just a spam protection value.

Clients should download headers first and only commit blocks to disk that are on a chain that has PoW higher than the hard coded minimum.

I like this idea - it doesn't contradict decentralized principle (as checkpoints do).
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
November 29, 2013, 06:34:21 PM
#50
Saying "it's already difficulty enough" is like saying it is already difficulty to walk through a wall due to quantum tunneling but just to be safe we should double up all walls in case someone gets "lucky".
Saved
full member
Activity: 391
Merit: 111
November 29, 2013, 06:25:13 PM
#49
No the opposite ofcourse, if he can find one, he can find two, or three or four, hence my suggestion to add as many hashes as possible.

So my suggestion is:

Check point hash 0 = Hash(block 0, block 1, block 2, block 3, etc up to block 2015)
Check point hash 1 = Hash(block 2016, block 2017, block 2018, etc up to block 2016+2016-1)
Check point hash 2 = Hash(block 2016 * Hash Number to (Block 2016 * (Hash Number+1))-1)
Check point hash 3 = etc

^ This will lead to many more hashes and best part is that all block hashes are included, not just a few, actually the entire block should be hashed, why stop at only block hashes ? Wink Yes it would lead to more computational effort but that's basically the point in general, however perhaps block hashes only would be enough, it's already difficulty enough to fake one, however including all could give a bit more security because it adds dates, times, transactions, etc, but maybe could also lead to less security because of easy adjusting comments or other bogus information, with a hash only that would be a bit more difficult to do it could throw off all input calcultions to try and fake such a hash.Blocks can probably fluctuate in size, while for now the hash is always same size, so gives some constant speed and also easy to implement reliably without all kinds of potential strange block size quircks).



The blockchain is already a chain of hashes.  The hash for block 2 uses the hash of block 1 as (part of) its input and the hash for block 3 uses the hash for block 2 and so on.

If you were to change a single bit for block 10, then the hashes for all blocks from 10 onwards would change.  Ofc, that would mean that blocks 11 onwards would no longer meet the proof of work (which is the whole point).  You can't change anything without destroying the chain entirely.

The SHA-256 function breaks large messages into pieces for processing anyway.  It uses the output from one piece as the input into the next piece.

There are two possibilities where this would not happen:

1. Either change enough bits in such a way that the hash stays the same. This is called a "hash collision".

2. Or perhaps insert a block which has the same hash, again a hash collission except it's doubled:  block 1.5 to be inserted has same hash as block 1, block 2 will happily accept block 1.5.


legendary
Activity: 1232
Merit: 1094
November 29, 2013, 06:21:58 AM
#48
No the opposite ofcourse, if he can find one, he can find two, or three or four, hence my suggestion to add as many hashes as possible.

So my suggestion is:

Check point hash 0 = Hash(block 0, block 1, block 2, block 3, etc up to block 2015)
Check point hash 1 = Hash(block 2016, block 2017, block 2018, etc up to block 2016+2016-1)
Check point hash 2 = Hash(block 2016 * Hash Number to (Block 2016 * (Hash Number+1))-1)
Check point hash 3 = etc

^ This will lead to many more hashes and best part is that all block hashes are included, not just a few, actually the entire block should be hashed, why stop at only block hashes ? Wink Yes it would lead to more computational effort but that's basically the point in general, however perhaps block hashes only would be enough, it's already difficulty enough to fake one, however including all could give a bit more security because it adds dates, times, transactions, etc, but maybe could also lead to less security because of easy adjusting comments or other bogus information, with a hash only that would be a bit more difficult to do it could throw off all input calcultions to try and fake such a hash.Blocks can probably fluctuate in size, while for now the hash is always same size, so gives some constant speed and also easy to implement reliably without all kinds of potential strange block size quircks).



The blockchain is already a chain of hashes.  The hash for block 2 uses the hash of block 1 as (part of) its input and the hash for block 3 uses the hash for block 2 and so on.

If you were to change a single bit for block 10, then the hashes for all blocks from 10 onwards would change.  Ofc, that would mean that blocks 11 onwards would no longer meet the proof of work (which is the whole point).  You can't change anything without destroying the chain entirely.

The SHA-256 function breaks large messages into pieces for processing anyway.  It uses the output from one piece as the input into the next piece.
donator
Activity: 1218
Merit: 1080
Gerald Davis
November 29, 2013, 01:05:52 AM
#47
It's more like placing each criminal in it's own cell. Currently if one wall is blown up many thousands of criminals can escape.

By placing more walls around the criminals less criminals can escape if one wall were to be broken.

More like moving each cell to their own universe so if they escape they have nowhere to go.  I think you vastly misunderstand the odds we are talking about.
full member
Activity: 391
Merit: 111
November 28, 2013, 01:28:57 PM
#46
It's more like placing each criminal in it's own cell. Currently if one wall is blown up many thousands of criminals can escape.

By placing more walls around the criminals less criminals can escape if one wall were to be broken.
donator
Activity: 1218
Merit: 1080
Gerald Davis
November 28, 2013, 01:09:29 AM
#45
No preimage attack against SHA-2 is possible. 

Saying "it's already difficulty enough" is like saying it is already difficulty to walk through a wall due to quantum tunneling but just to be safe we should double up all walls in case someone gets "lucky".
full member
Activity: 391
Merit: 111
November 27, 2013, 10:32:19 PM
#44
However perhaps that last part of my sentence is a bit hasty... I do wonder if it's possible to insert a block anywhere in the chain if a hash collission was found.

I am not sure what kind of protective measures bitcoin has to protect against block insertion.

If these checkpoints are truely based on single blocks then it won't protect against insertions.

Thus a smarter hash would be a hash computed over the entire blockchain.

Such a hash could be included to protect against insertions. However if the attacker can calculate a hash collission then this would only double his calculation efforts.

However the point is: the more checkpoints, the better.

I think the solution to make it a little bit more secure is simply calculate a hash over the entire blockchain every 2016 blocks and store it.

So, you are assuming that an attacker can find one has collision, but not two?  That doesn't make any sense.


No the opposite ofcourse, if he can find one, he can find two, or three or four, hence my suggestion to add as many hashes as possible.

So my suggestion is:

Check point hash 0 = Hash(block 0, block 1, block 2, block 3, etc up to block 2015)
Check point hash 1 = Hash(block 2016, block 2017, block 2018, etc up to block 2016+2016-1)
Check point hash 2 = Hash(block 2016 * Hash Number to (Block 2016 * (Hash Number+1))-1)
Check point hash 3 = etc

^ This will lead to many more hashes and best part is that all block hashes are included, not just a few, actually the entire block should be hashed, why stop at only block hashes ? Wink Yes it would lead to more computational effort but that's basically the point in general, however perhaps block hashes only would be enough, it's already difficulty enough to fake one, however including all could give a bit more security because it adds dates, times, transactions, etc, but maybe could also lead to less security because of easy adjusting comments or other bogus information, with a hash only that would be a bit more difficult to do it could throw off all input calcultions to try and fake such a hash.Blocks can probably fluctuate in size, while for now the hash is always same size, so gives some constant speed and also easy to implement reliably without all kinds of potential strange block size quircks).

kjj
legendary
Activity: 1302
Merit: 1026
November 27, 2013, 12:52:49 PM
#43
However perhaps that last part of my sentence is a bit hasty... I do wonder if it's possible to insert a block anywhere in the chain if a hash collission was found.

I am not sure what kind of protective measures bitcoin has to protect against block insertion.

If these checkpoints are truely based on single blocks then it won't protect against insertions.

Thus a smarter hash would be a hash computed over the entire blockchain.

Such a hash could be included to protect against insertions. However if the attacker can calculate a hash collission then this would only double his calculation efforts.

However the point is: the more checkpoints, the better.

I think the solution to make it a little bit more secure is simply calculate a hash over the entire blockchain every 2016 blocks and store it.

So, you are assuming that an attacker can find one has collision, but not two?  That doesn't make any sense.

The way the chain headers are hashed and linked makes bitcoin insanely strong against preimage attacks.  MD5 is considered to be totally broken, and preimage attacks on MD5 are rampant.  However, if we used MD5 (not even double MD5) as our blockheader hashing mechanism, we would still be totally safe.

P.S.  I didn't read much past the part that I quoted.  I hope you don't take any offense at that.  If you had other important things to say, please try to organize your thoughts better.
full member
Activity: 391
Merit: 111
November 27, 2013, 10:52:02 AM
#42
P.S.  No one particularly likes the checkpoints, the devs least of all.  There has been much discussion about removing them, or switching to a soft system (config file, etc).  So far, no one has come up with a really good solution.
I can come out with a really god solution, if you want Wink

Just set a dynamic limit in that the client would not accept any forks deeper than N blocks back from its currently known top.
Set N to whatever you want, but I think more than a week time would be exaggerating.


the fact is, if we've introduced a form of consensus OUTSIDE of proof-of-work, that overrides Proof-Of-Work, and that's precisely what checkpoints are- why do we have proof of work at all?

can we remove proof of work, and have a block chain that is based on consensus between N parties?  Yes!  https://docs.google.com/file/d/0BwUFHE6KYsM0ZkxLVmFwbXQ3ck0/edit?usp=sharing

-bm

Satoshi answers your question in the original document:

"
The proof-of-work also solves the problem of determining representation in majority decision
making. If the majority were based on one-IP-address-one-vote, it could be subverted by anyone
able to allocate many IPs.
"

Currently bitcoin seems to be a system that uses both concepts: "confidence" and "proof of work".

The checkpoints can be considered a dirty hack to make bitcoin more secure, it's an admission that bitcoin in it's original concept/design was flawed and pretty much still is if it werent for this Wink

However perhaps that last part of my sentence is a bit hasty... I do wonder if it's possible to insert a block anywhere in the chain if a hash collission was found.

I am not sure what kind of protective measures bitcoin has to protect against block insertion.

If these checkpoints are truely based on single blocks then it won't protect against insertions.

Thus a smarter hash would be a hash computed over the entire blockchain.

Such a hash could be included to protect against insertions. However if the attacker can calculate a hash collission then this would only double his calculation efforts.

However the point is: the more checkpoints, the better.

I think the solution to make it a little bit more secure is simply calculate a hash over the entire blockchain every 2016 blocks and store it.

At least this will increase computational resources needed to produce any fake chains and also makes insertion problematic.

However I am not so sure how easy it would be to create a "fake chain" that would be accepted by a bitcoin client if it did not have these checkpoints.

Perhaps the bitcoin client also calculates "difficulty" each 2016 blocks and would then detect that the difficulty on the fake block chain was not properly increased... (<- note flaw in logic, it can also decrease, fluctuate wildly, no rules govern it, explained and examined further below).

If the bitcoin client does not yet currently do this then it could start doing that to prevent fake chains in the future... this will make it harder for attackers to properly construct fake chains, since they will also have to increase the difficult and thus consume more hashing power.

However difficulty can be manipulated by simply pretending bitcoin was not popular at the time and there were little transactions and it took days and months to find a block, so ultimately it would probably get accepted Wink unless some measurements based on history would be used but this could hamper future wild changes.

Biggest change in difficult was probably around 10 july 2010 when bitcoin was announced on slashdot... resulting in the slashdot effect, a jump in difficulty of 300%.

However using difficulty as a way to detect fake chains could have merit.

The idea for a fake block chain would be to "out race" the real chain.

This implies either:

1. The fake block chain has more blocks, and thus the blocks were found faster <- indicating something fishy might be going on with the difficulty, this could indicate the difficult was not properly increased each 2016 blocks.

2. The real block chain fell out of use, bitcoin became impopulair... difficulty was too high... not enough hashing power.... fake chain starts to over take it.

Option 2 could imply that bitcoin could be at risk as soon as it becomes impopular... it's difficult will start to drop... but at a slower pace then a fake chain.

A possible attack to create a fake blockchain could be:

1. Determine current ammount of blocks in the real chain.

2. Divide current ammount of blocks by 2016.

3. This indicates how many difficulty changes must be calculated.

4. Perhaps use a rollcoaster tactic:

5. Calculate as many blocks as possible with minimum difficulty.

6. This will cause the difficulty to shoot up to insanity.

7. Then stop calculating blocks for the next 2016 blocks.

^ Problem, cannot stop calculating, thus algorithm must be changed:

Spread difficulty over as many groups of 2016 as possible.

Possible attack vector:

Difficulty at start of chain was low, replace low difficulty with high difficulty to try and produce a constant difficulty.

Having a constant difficulty might be exactly what the attack would need, no more, no less, if this is better than the roller coaster approach is uncertain.

Perhaps the roller coaster approach has merit too I think so:

Roller coaster approach version 2:

Calculate as many blocks as possible without raising the difficulty to an unrecoverable state, keep it sane so that the next 2016 blocks can still be calculated.

Or other attack vector:

Spread the 2016 blocks over an enormous ammount of time... weeks, moths, years or so...

This will drop the difficulty back to minimum.

Then produce an enormous ammount of blocks.

So I think the roller coaster approach might be possible as long as it's not over done too much Wink

So two possible attack vectors:

1. Roller coaster approach within reasonable difficulty recoverment/crash.
2. Constant difficulty approach.

However I assumes the roller coaster approach would be capable of generating limitless ammount of blocks within 2016. This is not the case. After 2016 blocks were produced it would recalculate the difficulty.

So now ask yourself one question: what would happen to the difficulty is 2016 blocks were generated in 1 second ?

What would happen to difficulty if 2016 blocks were generated in one month ?

Perhaps there is a possibility to roller coaster it in such a way that it would end up producing blocks faster than the real block chain... with less computation power needed... not sure...

I guess the answer lies in the "computation power" that is required at different difficulties relating to the hash itself.

If the computation power scales linearly with the difficulty.... then this attack may not work.

However if it's somehow possible to gain an adventage at lower difficulty then perhaps a netto sum effect is achieved, perhaps it will profit from the lower difficulty/lower computation power needed once it crashes.

Also perhaps other security checks are in place, such as checking the date/time for each block. Thus generating 2016 blocks in 1 second might not be possible/accepted by the clients ? Not sure about that...

Theoretically it might be desireable to still allow it, nothing prevents anybody from suddenly adding insane ammounts of computer power to the bitcoin network... if the bitcoin network could not scale up beyond a certain point that would be a bit strange Wink I guess it's all about certain assumptions/sanity checks... difficult to predict the popularity of bitcoin... thus such sanity checks might hamper suddenly super popularity.

Such an event already happened with the slashdot effect: a 300% increased, as if 2 or 3 earths were added ? Wink which could be precisely why these checks were not implace... it would have hampered it...

Time for some fun numbers:

There are currently: 271789 blocks.

Number of difficulty changes:

271789 / 2016 = 134.81597222222222222222222222222

Close to 135 difficulty changes.

That's a surprisingly low number of changes.

Let's assume a 2016 block can be generated in 1 second with minimum difficulty.

After it's generated some unknown ammount of time is needed to drop it back lower.

So 50% we can try and do in 1 second which gives:

134/2 = 67 difficulty changes.

These can be spread out over the entire time that bitcoin was running. Block 0 started at 2009-01-03 18:15:05

It's now 27/11/2013 17:38

That's a whole lot of years to spread 67 over...

Now I need to plugin the difficulty algorithm or code in bitcoin, I am not sure what it is but for now I will take this:

difficulty=((Time for a block to be found in seconds)*(hashes per second))/2^32

difficulty = 1/10.000 * ? / 2^32

not sure what hashes per second is supposed to be, perhaps the total estimated hashes per second. Perhaps 4 gigahash should be taken.

However all of this might not matter.

There seems to be a hard limit of 1/4x or 4x of what it previously took.

If true then we golden.

We might be able to produce a fake blockchain pretty easily.

1 second, 4 seconds, 16 seconds, 64 seconds, and so forth.

Ofcourse this is exponential...

But to reset the algorithm, we simply mine the next 2016 in 4 or 8 seconds to crash it back to 1.

Thus creating a fake blockchain would seem very easy as long as these minimum and maximum multiplication factors are in place.

Hence the need for these checkpoints... it's the only thing prevent a fake block chain from taking over ? Wink
legendary
Activity: 1232
Merit: 1094
August 26, 2013, 03:25:30 AM
#41
Haven't there been periods where the difficulty went down?

It doesn't happen that often.

However, I meant total PoW for the chain.  This is the sum of the PoW for all blocks from the genesis block to the last block in the chain.  That always increases and even if a new main chain takes over, by definition, it has more PoW.

The spam DoS attack was to create 2015 difficulty 1 blocks that are 1MB each.    You can create as many of those as you want and they are valid forks of the chain, so are stored.

If only forks with lots of total PoW are stored, then that is less of a problem, since those blocks require high PoW.

With a 51% attack, you could drop the difficulty back to 1, so there is still some risk.  However, by dropping checkpoints, you are inherently assuming that is no possible.

Yup, I just mentally corrected TierNolan's proposal to match ones made by many people before— have a minimum total chain work checkpoint (e.g. any valid chain will have at least 2^70 work by height XXX). That allows the same protection from spamming as the current stuff.

That is what I meant by MAIN_CHAIN_MIN_POW, it would be the minimum total work before a chain can be called the main chain. 
legendary
Activity: 1400
Merit: 1013
August 26, 2013, 12:48:05 AM
#40
Checkpoints as a cognitive security blanket against doomsday reorgs will likely stay, but we could update them less frequently, with a more regimented process, and perhaps change how nodes respond to them (e.g. a conflicting chain becoming longer making all nodes go into a safemode where they regard everything new as unconfirmed, process no transactions, and discourage any new blocks that process transactions allowing for a public resolution of the "impossible event", rather than directly coercing the consensus).
I think it would be cool for checkpoints to be distributed periodically in dead tree format.
staff
Activity: 4326
Merit: 8951
August 26, 2013, 12:25:18 AM
#39
Uhhhhhh. Or just run with the checkpoints=0 command-line/config option.
Well he seemed to think the fact that they are included at all = the death of Bitcoin.  I was just providing a way for him to "save" Bitcoin from the ebil developers.  
Fair enough— for whatever it's worth, I'm no fan of them either. If nothing else they really create a hard time for people reasoning about the security model of Bitcoin: There are a lot of people who have a hard time getting how the POW consensus works and then they hear about the checkpoints and say "Ah ha! this is how its secure!", after all people are familiar with centralized security so this is just a lot easier to understand.

The big damage from that comes because we're then subjected to a non-stop stream of IDEAS and IMPROVEMENTS from people who's understanding of the security model was broken by the mere existence of checkpoints, even though checkpoints do nothing relative to consensus. These people propose things which depend on a centralized security model and don't have the benefit of the checkpoints being set thousands of block in the past so they are never a practical influence on the consensus, and don't spend the mental cycles trying to fit their ideas into the real, primarily zero trust, Bitcoin security model. As a cautionary sign of where that could be going: There altcoins which user developer controlled checkpoints broadcast to checkpoint blocks in real time, and more altcoins being added that do this... as if this were an acceptable way to construct a decentralized cryptocurrency!

When headers first syncing is merged, just by adding a "must be this tall" minimum sum difficulty check we'll be able to remove checkpoints for all DOS purposes, and we'll also be able to remove them for syncing acceleration (using random sampling for ECDSA in the deeply burried chain).

Checkpoints as a cognitive security blanket against doomsday reorgs will likely stay, but we could update them less frequently, with a more regimented process, and perhaps change how nodes respond to them (e.g. a conflicting chain becoming longer making all nodes go into a safemode where they regard everything new as unconfirmed, process no transactions, and discourage any new blocks that process transactions allowing for a public resolution of the "impossible event", rather than directly coercing the consensus).
donator
Activity: 1218
Merit: 1080
Gerald Davis
August 25, 2013, 11:49:05 PM
#38
Uhhhhhh. Or just run with the checkpoints=0 command-line/config option.

Well he seemed to think the fact that they are included at all = the death of Bitcoin.  I was just providing a way for him to "save" Bitcoin from the ebil developers. 
staff
Activity: 4326
Merit: 8951
August 25, 2013, 11:47:26 PM
#37
Haven't there been periods where the difficulty went down?
Yup, I just mentally corrected TierNolan's proposal to match ones made by many people before— have a minimum total chain work checkpoint (e.g. any valid chain will have at least 2^70 work by height XXX). That allows the same protection from spamming as the current stuff.

You are free to use and distribute a fork of the client without any checkpoints.  Checkpoints aren't required. Assumming an attacker isn't attempting to DDOS your node by filling it with years worth of bogus blocks or try to perform a 51% attack months deep in the chain the lack of checkpoint will have absolutely no effect on your node.
Uhhhhhh. Or just run with the checkpoints=0 command-line/config option.
donator
Activity: 1218
Merit: 1080
Gerald Davis
August 25, 2013, 11:43:15 PM
#36
I think you don't understand.
Checkpoints are not there to fight proof of work - they are there to protect your node from DoS attacks.

Do you understand that if there were no checkpoints, anyone with a graphic card could just keep mining blocks that link to the genesis one, and this way fill up your hard disk?


Do you understand that checkpoints completely violate the entire purpose of Bitcoin?

What they do is introduce a form of approval(consensus) about the state of a chain.  This form of authority could certainly be abused, and it runs counter to practically every design principle of Bitcoin.

at the most fundamental level, the client code should not have ANYTHING to say about the block chain.  Whether this is required in order to operate is irrelevant.  The reason people use Bitcoin is *because* it's peer-to-peer.

You are free to use and distribute a fork of the client without any checkpoints.  Checkpoints aren't required. Assumming an attacker isn't attempting to DDOS your node by filling it with years worth of bogus blocks or try to perform a 51% attack months deep in the chain the lack of checkpoint will have absolutely no effect on your node.

So if you are worried then remove the checkpoints, compile it and use that node.  If you are really worried set up an online mirror and advertise your checkpoint free version.

See peer to peer at work.
legendary
Activity: 1400
Merit: 1013
August 25, 2013, 11:23:42 PM
#35
Instead of checkpoints, client could hard-code a MAIN_CHAIN_MIN_POW variable.  This would be the PoW of the main chain when that version of the client was released.  All clients wouldn't need to agree on a value.  It is just a spam protection value.
Haven't there been periods where the difficulty went down?
staff
Activity: 4326
Merit: 8951
August 25, 2013, 10:40:20 PM
#34
And then what if multiple chains are above this min pow?
Then you pick among them like normal, the point there is to close of the denial of service attack without undermining the consensus algorithm with an element of centralization.
newbie
Activity: 28
Merit: 0
August 25, 2013, 10:35:15 PM
#33
Instead of checkpoints, client could hard-code a MAIN_CHAIN_MIN_POW variable.  This would be the PoW of the main chain when that version of the client was released.  All clients wouldn't need to agree on a value.  It is just a spam protection value.

Clients should download headers first and only commit blocks to disk that are on a chain that has PoW higher than the hard coded minimum.

Clients should respond to "inv" messages containing unknown block hashes by sending a "getheaders" message rather than asking for the block.

If the block extends your main chain, you will be sent it.

Peer sends: "inv" containing unknown block
Send to peer: "getheaders" with standard block locator (send at most once per inv message received)
Peer sends: "headers" with new blocks on it's main chain
Add these headers to header tree
If the main chain is extended and the main chain has PoW greater than MAIN_CHAIN_MIN_POW, request those full-blocks
...
No matter what happens, the longest chain will always have more PoW than the longest one when the client was writen, so the best chain is guaranteed to have more PoW than MAIN_CHAIN_MIN_POW.

The client won't consider itself synced unless it is on a main chain with PoW that exceeds that value.

And then what if multiple chains are above this min pow?
legendary
Activity: 1232
Merit: 1094
August 25, 2013, 06:38:17 PM
#32
Thats not really what they're for— though that have the effect too. Most of their usefulness is that they prevent a dos attacker from filling up bitcoin node's disk space with long runs of low difficulty blocks forked off low in the chain.

e.g. you start off with difficulty 1 blocks at block 0, now mine-able by the millions by a single asic— _MAYBE_ a chain that starts off that way could eventually turn out to be the longest so absent the checkpoints a node would happily follow an endlessly long chain of them.

Instead of checkpoints, client could hard-code a MAIN_CHAIN_MIN_POW variable.  This would be the PoW of the main chain when that version of the client was released.  All clients wouldn't need to agree on a value.  It is just a spam protection value.

Clients should download headers first and only commit blocks to disk that are on a chain that has PoW higher than the hard coded minimum.

Clients should respond to "inv" messages containing unknown block hashes by sending a "getheaders" message rather than asking for the block.

If the block extends your main chain, you will be sent it.

Peer sends: "inv" containing unknown block
Send to peer: "getheaders" with standard block locator (send at most once per inv message received)
Peer sends: "headers" with new blocks on it's main chain
Add these headers to header tree
If the main chain is extended and the main chain has PoW greater than MAIN_CHAIN_MIN_POW, request those full-blocks

Quote
They also make is so that an attacker who has complete control of your network (and thus can prevent you from hearing the longest chain from the honest bitcoin network) from putting you on a fake (low difficulty) isolated chain unless they can also trick you into running replaced software. With the checkpoints such an attacker hast to have a ton of mining power in order to continue the chain.

No matter what happens, the longest chain will always have more PoW than the longest one when the client was writen, so the best chain is guaranteed to have more PoW than MAIN_CHAIN_MIN_POW.

The client won't consider itself synced unless it is on a main chain with PoW that exceeds that value.
kjj
legendary
Activity: 1302
Merit: 1026
June 17, 2013, 03:21:50 PM
#31
Your solution is indeed simple.  But it doesn't do the same job that checkpoints do.  Checkpoints are not about forks in the present or future, they are about helping clients avoid dead end forks in the past, while they are doing their initial sync.  Checkpoints help new nodes catch up to the network with minimal annoyance for the node operator, nothing more*.
So you are saying that checkpoints don't actually prevent my node from downloading, storing and routing an alternative block that would refer to the genesis?
Or are you saying that they do prevent it, but the important thing here is that I should care more about those who are just downloading the chain and dont know yet which branch to choose? Smiley

Well, the genesis hash was coded in from day one.  If you want an alternate chain, you need a new genesis hash, plus you'd have to clear out the checkpoints.  (My apologies if that wasn't what you meant, I'm not entirely sure that I understand you.)

The early blocks had very low difficulty.  If I wanted to, I could generate thousands of low difficulty blocks, with appropriate fake timestamps, and I could set my node to wait for new connections, then feed those bogus blocks to the noob.  They'd figure it out eventually, but I could keep them mired down for hours or days, working on my garbage.  The checkpoints give a handy shortcut to that "eventually".  If my chain doesn't include the checkpoint blocks, the new node won't waste their time on it.

The notion of "the correct chain" gets fuzzy.  If I have a lot of hashing power, like more than the rest of the world, and I start today making a new chain, but I keep my farm isolated from the rest of the network, is it "the correct chain"?  The only really hard rule is that the longer (more work, not necessarily more blocks) chain is correct.  My chain would be (work) longer, so in that sense, it is correct.  But no one knows about it but me, so the world would be working on a chain that they think is correct.

When I release my chain, it will overturn possibly thousands of blocks, possibly millions of transactions.  The hard rule says that it should happen, but almost no one would actually wants that outcome.  A checkpoint could invalidate my whole chain, if a big part of the network upgrades to a client that includes a checkpoint that happens to come after I started.

That situation is unrealistic, intentionally.  But it shows that the simple rule that we can easily write into our software is incomplete.  We humans want the rule to be "the longer chain is correct, except...", and the "except" part is hard to write.  We know that checkpoints aren't the right way to codify the exception.  If you've ever talked to Gavin, or even read his posts on the subject, you'll know that he absolutely hates that he could end up in the position of picking which chain wins.

So, we end up in the strange situation we are in.  The checkpoints are useful in the real world , but we can see that they also hold a power that no one actually wants to wield.  The devs advance them now and then, but always sorta grudgingly, and always months behind.  If someone released a 5000 block attack chain, we'd all be bitching that the checkpoint was too far behind.  Because no one has (and probably never will) hide a fork of that length, we are all bitching that checkpoints are contrary to the bitcoin design.
legendary
Activity: 2058
Merit: 1416
aka tonikt
June 17, 2013, 01:40:58 PM
#29
Your solution is indeed simple.  But it doesn't do the same job that checkpoints do.  Checkpoints are not about forks in the present or future, they are about helping clients avoid dead end forks in the past, while they are doing their initial sync.  Checkpoints help new nodes catch up to the network with minimal annoyance for the node operator, nothing more*.
So you are saying that checkpoints don't actually prevent my node from downloading, storing and routing an alternative block that would refer to the genesis?
Or are you saying that they do prevent it, but the important thing here is that I should care more about those who are just downloading the chain and dont know yet which branch to choose? Smiley
kjj
legendary
Activity: 1302
Merit: 1026
June 17, 2013, 01:35:06 PM
#28
I'm glad you managed to dig up and read my proposal for exponential difficulty reorgs, and that you find it superior.  Not surprising, considering that yours is a degenerate case of mine where the exponent is infinite.

But it really isn't a checkpoint system.  The checkpoint system is all about the past, while both your proposal and mine are useless in that domain.
I wish I did, but as you figured, I didn't. Smiley
I'm a man of simple solutions.
Checkpoints that are there now, in the bitcoin client, are stupid.
My idea - may be simple, but at least it would do what it has to do and close the problem once and for all. And it's surely much simpler.
Your idea - I believe it's impressive, but why to complicate things that are simple and do the job?

Your solution is indeed simple.  But it doesn't do the same job that checkpoints do.  Checkpoints are not about forks in the present or future, they are about helping clients avoid dead end forks in the past, while they are doing their initial sync.  Checkpoints help new nodes catch up to the network with minimal annoyance for the node operator, nothing more*.

The real replacement for checkpoints is a smarter sync system.  Greg is working on a smarter sync (see here), but I don't think it has been implemented or tested yet, so for now, we are stuck with the dumb downloader and checkpoints as a sanity check.

* They can also be used to rectify a fork in the network, but this is an extraordinary usage that requires a lot of manual intervention by a lot of node operators.  When a signed/unsigned bug was found in the value interpretation code and someone used it to give himself billions of bitcoins, a checkpoint was used to help the corrected chain overtake the errant chain that had grown for several hours before the fix could be applied.  It was also used to unroll the more recent BDB/blocksize fork.  But again, these were not checkpoints already built into the code, we just used the same mechanism as a manually override.
hero member
Activity: 490
Merit: 501
June 17, 2013, 01:22:38 PM
#27
if you disagree with the use of checkpoints the just fork 'em.
legendary
Activity: 2058
Merit: 1416
aka tonikt
June 17, 2013, 01:07:40 PM
#26
I'm glad you managed to dig up and read my proposal for exponential difficulty reorgs, and that you find it superior.  Not surprising, considering that yours is a degenerate case of mine where the exponent is infinite.

But it really isn't a checkpoint system.  The checkpoint system is all about the past, while both your proposal and mine are useless in that domain.
I wish I did, but as you figured, I didn't. Smiley
I'm a man of simple solutions.
Checkpoints that are there now, in the bitcoin client, are stupid.
My idea - may be simple, but at least it would do what it has to do and close the problem once and for all. And it's surely much simpler.
Your idea - I believe it's impressive, but why to complicate things that are simple and do the job?
kjj
legendary
Activity: 1302
Merit: 1026
June 17, 2013, 01:04:35 PM
#25
P.S.  No one particularly likes the checkpoints, the devs least of all.  There has been much discussion about removing them, or switching to a soft system (config file, etc).  So far, no one has come up with a really good solution.
I can come out with a really good solution, if you want Wink

Just make a rule that the client would not accept any forks deeper than N blocks back from its currently known top.
Set N to whatever constant you want, but I think more than a week time would be exaggerating.

No, that sucks.  Sorry.
Yeah, I'm sure your checkpoints idea is much better.
I'm actually even ashamed mentioning something such stupid Smiley

I'm glad you managed to dig up and read my proposal for exponential difficulty reorgs, and that you find it superior.  Not surprising, considering that yours is a degenerate case of mine where the exponent is infinite.

But it really isn't a checkpoint system.  The checkpoint system is all about the past, while both your proposal and mine are useless in that domain.
legendary
Activity: 2058
Merit: 1416
aka tonikt
June 17, 2013, 12:50:07 PM
#24
P.S.  No one particularly likes the checkpoints, the devs least of all.  There has been much discussion about removing them, or switching to a soft system (config file, etc).  So far, no one has come up with a really good solution.
I can come out with a really good solution, if you want Wink

Just make a rule that the client would not accept any forks deeper than N blocks back from its currently known top.
Set N to whatever constant you want, but I think more than a week time would be exaggerating.

No, that sucks.  Sorry.
Yeah, I'm sure your checkpoints idea is much better.
I'm actually even ashamed mentioning something such stupid Smiley
kjj
legendary
Activity: 1302
Merit: 1026
June 17, 2013, 12:48:57 PM
#23
P.S.  No one particularly likes the checkpoints, the devs least of all.  There has been much discussion about removing them, or switching to a soft system (config file, etc).  So far, no one has come up with a really good solution.
I can come out with a really good solution, if you want Wink

Just make a rule that the client would not accept any forks deeper than N blocks back from its currently known top.
Set N to whatever constant you want, but I think more than a week time would be exaggerating.

No, that sucks.  Sorry.
legendary
Activity: 2058
Merit: 1416
aka tonikt
June 17, 2013, 12:46:08 PM
#22
Do you understand that checkpoints completely violate the entire purpose of Bitcoin?
I understand that they violate some purpose of bitcoin.
But I am also a pragmatic person and so I prefer to have a system that violates some very unlikely to happen purposes, as long as it is a way to keep my resources away from spammers.

What they do is introduce a form of approval(consensus) about the state of a chain.  This form of authority could certainly be abused, and it runs counter to practically every design principle of Bitcoin.
But your concerns are 100% theoretical and it isn't really possible to start a fork like 2000 blocks back and get with it to the top.
And even if it was possible, would you really want it? Because I would not.

Quote
at the most fundamental level, the client code should not have ANYTHING to say about the block chain.  Whether this is required in order to operate is irrelevant.  The reason people use Bitcoin is *because* it's peer-to-peer.
Again: the node, and the network, must protect itself from DoS attacks.
What are you even trying to achieve forbidding people doing this?

If you one day manage to create a branch that would beat their chosen checkpoint - then I will agree with you.
But so far, I don't get your problem, though I appreciate your innocent ideas. Smiley
sr. member
Activity: 280
Merit: 257
bluemeanie
June 17, 2013, 12:33:02 PM
#21
I think you don't understand.
Checkpoints are not there to fight proof of work - they are there to protect your node from DoS attacks.

Do you understand that if there were no checkpoints, anyone with a graphic card could just keep mining blocks that link to the genesis one, and this way fill up your hard disk?


Do you understand that checkpoints completely violate the entire purpose of Bitcoin?

What they do is introduce a form of approval(consensus) about the state of a chain.  This form of authority could certainly be abused, and it runs counter to practically every design principle of Bitcoin.

at the most fundamental level, the client code should not have ANYTHING to say about the block chain.  Whether this is required in order to operate is irrelevant.  The reason people use Bitcoin is *because* it's peer-to-peer.
legendary
Activity: 2058
Merit: 1416
aka tonikt
June 17, 2013, 12:30:11 PM
#20
I think you don't understand.
Checkpoints are not there to fight proof of work - they are there to protect your node from attacks.

Do you understand that if there were no checkpoints, anyone with a graphic card could just keep mining blocks that link to the genesis one, and this way fill up your hard disk? Also stuffing the net with useless data.
sr. member
Activity: 280
Merit: 257
bluemeanie
June 17, 2013, 12:26:22 PM
#19
P.S.  No one particularly likes the checkpoints, the devs least of all.  There has been much discussion about removing them, or switching to a soft system (config file, etc).  So far, no one has come up with a really good solution.
I can come out with a really god solution, if you want Wink

Just set a dynamic limit in that the client would not accept any forks deeper than N blocks back from its currently known top.
Set N to whatever you want, but I think more than a week time would be exaggerating.


the fact is, if we've introduced a form of consensus OUTSIDE of proof-of-work, that overrides Proof-Of-Work, and that's precisely what checkpoints are- why do we have proof of work at all?

can we remove proof of work, and have a block chain that is based on consensus between N parties?  Yes!  https://docs.google.com/file/d/0BwUFHE6KYsM0ZkxLVmFwbXQ3ck0/edit?usp=sharing

-bm
legendary
Activity: 2058
Merit: 1416
aka tonikt
June 17, 2013, 12:22:04 PM
#18
P.S.  No one particularly likes the checkpoints, the devs least of all.  There has been much discussion about removing them, or switching to a soft system (config file, etc).  So far, no one has come up with a really good solution.
I can come out with a really good solution, if you want Wink

Just make a rule that the client would not accept any forks deeper than N blocks back from its currently known top.
Set N to whatever constant you want, but I think more than a week time would be exaggerating.
sr. member
Activity: 280
Merit: 257
bluemeanie
June 17, 2013, 12:20:21 PM
#17

 What do you think 'Peer To Peer' means?

 as in "A Peer-To-Peer Electronic Cash System"?  http://bitcoin.org/bitcoin.pdf
kjj
legendary
Activity: 1302
Merit: 1026
June 17, 2013, 12:17:41 PM
#16
who makes the checkpoints?
The bitcoin core devs
so ultimately, the state of the block chain depends entirely on them.
not really. they only put checkpoint for blocks that are buried at least few hundreds deep already - unlikely to be reverted by honest means.
but if you disagree with any checkpoint they add, just don't upgrade your node and you will be fine.

well that's a practical solution, but it violates the notion of 'peer-to-peer' or equality for all nodes in the network.

there is no indication of 'checkpoints' in the satoshi whitepaper.

furthermore, if we rely on such checkpoints for security, why do we even have proof of work at all?  Why don't we just rely on the checkpoints?

I'm having a hard time figuring out what you mean by "equality of all nodes".  The equality (or inequality) of nodes is not part of the system.  No one cares about nodes.  We care about the chain.  If a node has the correct chain and can give you a copy, it is "equal" to all of the other good nodes.  If it doesn't, or can't, then it equal at all, isn't even a node.

The checkpoints do not provide any security, nor were they ever intended to.  They just keep "unequal" nodes from wasting your time with bogus chains (whether by accident or malice).

Also, you are free to edit and recompile as needed.  You can strip them out entirely, or add your own, or change them.  Whatever you want.  The reference client is written for (and compiled for) working well for a wide audience.

Technically, a longer chain is the best chain, regardless of the checkpoints.  In practice, the checkpoints are far enough in the past that if a new chain showed up that overturned one, we'd almost universally consider it an attack, and roll back.

P.S.  No one particularly likes the checkpoints, the devs least of all.  There has been much discussion about removing them, or switching to a soft system (config file, etc).  So far, no one has come up with a really good solution.
legendary
Activity: 2058
Merit: 1416
aka tonikt
June 17, 2013, 10:34:12 AM
#15
yeah, I agree with you that it goes against an important principle, but as gmaxwell said, it does have some actual purpose, protecting your storage from being flooded by forks that would suddenly start to appear at low block numbers.
though, it does not make any sense to have multiple checkpoints (instead of i.e. a one that moves by itself), but well... who are we to argue with a solution chosen by the best bitcoin developers that satoshi left behind? Wink
sr. member
Activity: 280
Merit: 257
bluemeanie
June 17, 2013, 10:31:39 AM
#14
who makes the checkpoints?
The bitcoin core devs
so ultimately, the state of the block chain depends entirely on them.
not really. they only put checkpoint for blocks that are buried at least few hundreds deep already - unlikely to be reverted by honest means.
but if you disagree with any checkpoint they add, just don't upgrade your node and you will be fine.

well that's a practical solution, but it violates the notion of 'peer-to-peer' or equality for all nodes in the network.

there is no indication of 'checkpoints' in the satoshi whitepaper.

furthermore, if we rely on such checkpoints for security, why do we even have proof of work at all?  Why don't we just rely on the checkpoints?
legendary
Activity: 2058
Merit: 1416
aka tonikt
June 17, 2013, 10:25:24 AM
#13
who makes the checkpoints?
The bitcoin core devs
so ultimately, the state of the block chain depends entirely on them.
not really. they only put checkpoint for blocks that are buried at least few hundreds deep already - unlikely to be reverted by honest means.
but if you disagree with any checkpoint they add, just don't upgrade your node and you will be fine.
sr. member
Activity: 280
Merit: 257
bluemeanie
June 17, 2013, 10:18:58 AM
#12
who makes the checkpoints?
The bitcoin core devs
so ultimately, the state of the block chain depends entirely on them.
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
June 17, 2013, 10:01:39 AM
#11
who makes the checkpoints?
The bitcoin core devs
sr. member
Activity: 280
Merit: 257
bluemeanie
June 17, 2013, 09:58:53 AM
#10
who makes the checkpoints?
legendary
Activity: 2618
Merit: 1007
May 07, 2013, 12:20:44 PM
#9
Yeah, with "just mined" I thought you mean "mined the same day" or something like this - usually a block a (few) thousand blocks deep is selected.
legendary
Activity: 934
Merit: 1000
May 07, 2013, 09:14:26 AM
#8
Code:
    // What makes a good checkpoint block?
    // + Is surrounded by blocks with reasonable timestamps
    //   (no blocks before with a timestamp after, none after with
    //    timestamp before)
    // + Contains no strange transactions

This part?

I'm trying to understand the whole file, I'll give it another good read tonight since I'm at work now ;-) but what do u mean by not just mined? I meant there can never be checkpoints for blocks not yet in the blockchain..
legendary
Activity: 2618
Merit: 1007
May 07, 2013, 09:00:00 AM
#7
Not just mined, please read the comments in that file too. Generally yes though, a new client release usually also includes an updated checkpoint.
legendary
Activity: 934
Merit: 1000
May 07, 2013, 08:56:08 AM
#6
So the checkpoints are added afterwards? With every new version of the client a checkpoint of a block that was just mined is added?

Thanks
staff
Activity: 4326
Merit: 8951
May 03, 2013, 01:41:45 AM
#5
Yes, you are correct.  They are there so some quantum computing farm (doesn't exist, but...) can't come out of nowhere and roll back blocks by mining a long chain from far in the past.
Thats not really what they're for— though that have the effect too. Most of their usefulness is that they prevent a dos attacker from filling up bitcoin node's disk space with long runs of low difficulty blocks forked off low in the chain.

e.g. you start off with difficulty 1 blocks at block 0, now mine-able by the millions by a single asic— _MAYBE_ a chain that starts off that way could eventually turn out to be the longest so absent the checkpoints a node would happily follow an endlessly long chain of them.

They also make is so that an attacker who has complete control of your network (and thus can prevent you from hearing the longest chain from the honest bitcoin network) from putting you on a fake (low difficulty) isolated chain unless they can also trick you into running replaced software. With the checkpoints such an attacker hast to have a ton of mining power in order to continue the chain.
sr. member
Activity: 448
Merit: 254
May 03, 2013, 01:40:02 AM
#4
A powerful quantum computer couldn't automatically change the rules of the network such as 1k-coin blocks.  (If it could out-mine the entire network I guess it might also be capable of cracking everyone's ssh keys and passwords and hacking their system to replace bitcoin, but leaving that out, it can't change the rules.)
hero member
Activity: 766
Merit: 621
Own ONION
May 03, 2013, 01:23:51 AM
#3
So they are added gradually as we reach there, this can only protect tampering with the existing data, there's no way to prevent future data tampering. Am I right? If the quantum computer comes out, then it just need to take the current blockchain, then change code and make new executable, by doing something like each block generate 1k coins, for example, and attach the new ones in the chain. This will overwrite the existing chain, though no previous data (checked by checkpoints) will be changed.
sr. member
Activity: 448
Merit: 254
May 03, 2013, 01:11:50 AM
#2
Yes, you are correct.  They are there so some quantum computing farm (doesn't exist, but...) can't come out of nowhere and roll back blocks by mining a long chain from far in the past.

The whole point is to thoroughly check all the hashes from block 0 to today, that is how it's secure.  It only has to check all of them once though, and then trusts that nobody will tamper with the disk data to invalidate that check (safe assumption, I think.)
hero member
Activity: 766
Merit: 621
Own ONION
May 03, 2013, 01:00:50 AM
#1
I am reading bitcoin codes, and I don't quite get what are checkpoints in the bitcoin code:

Quote
        ( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"))
        ( 33333, uint256("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6"))
        ( 74000, uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20"))
        (105000, uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97"))
        (134444, uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"))
        (168000, uint256("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763"))
        (193000, uint256("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317"))
        (210000, uint256("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e"))
        (216116, uint256("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e"))
        (225430, uint256("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932"))

Are they hashes of the blocks at 11111,33333, etc positions? If so how can we precompute them, as going from 1 to block 225430 would take big amount of time of computations...
Jump to: