Bitcoin Forum
April 19, 2024, 10:07:45 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Validating Blocks and 51% Attacks  (Read 1291 times)
mitchong (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 4


View Profile
June 30, 2017, 07:42:54 PM
Merited by ABCbits (2)
 #1

Hi, I'm new to Bitcoin and had a couple questions that I've tried to research, but haven't been able to find a good answer that I could understand and accept.

1. What's the incentive for peers to validate blocks? I figured miners wouldn't want to validate other miners' blocks in hopes they can get their own block validated instead and collect the reward.

2. I don't understand why you would need 51% or more mining power to alter a transaction? Why is it more secure for more than 50% of the nodes to be independent?

3. Why is the blockchain more secure each time a new block is mined? Why does hacking the blockchain require tremendous speed?

Also, does anyone know a Bitcoin expert who is willing to discuss more about some of these questions in detail over the phone perhaps?

Thanks in advance for any input you can provide.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
ranochigo
Legendary
*
Offline Offline

Activity: 2954
Merit: 4161


View Profile
July 01, 2017, 02:36:23 AM
Merited by ABCbits (3)
 #2

Hi, I'm new to Bitcoin and had a couple questions that I've tried to research, but haven't been able to find a good answer that I could understand and accept.

1. What's the incentive for peers to validate blocks? I figured miners wouldn't want to validate other miners' blocks in hopes they can get their own block validated instead and collect the reward.
If miners don't validate and accept valid blocks from other miners, the nodes in the network will. If they don't do that, they would be building on their own chain and no one would follow them since their own chain will not have as high of a weight as others. Since no one follows their chain, their blocks will not be seen as valid and they are on the losing end.
2. I don't understand why you would need 51% or more mining power to alter a transaction?
When someone has 51% of the network hashpower, they can double spend. Double spend means that someone spends a coin twice. I'll describe a scenario for this:
I have 51% of the attack, the network has 49% and I can generate blocks faster than them.
I send a transaction and it gets confirmed at block 50012.
I script another transaction and generate another block at block height of 50012 with my new transaction and so on.
The network has miners generating blocks till 50015 and I transferred my coins into fiat.
At this point, I'm at block height of 50016. I publish my own blocks.
Since my chain has a higher weightage than any other chain, nodes will disregard all previous block mined from 50012 to 50015 and follow my chain from 50012 to 50016 with my new replaced transaction inside it. I have effectively spent the coins twice.
Why is it more secure for more than 50% of the nodes to be independent?
If 50% of the nodes are controlled by a single entity, it is very possible for them to execute a sybil attack. A possible repercussion of this is the loss of privacy since they can in theory estimate which IP broadcasted which transaction with a decent amount of certainty. Also, if you end up connecting to all the nodes they control, they can disconnect you from the main blockchain and you will not receive any blocks from the rest of the network.

3. Why is the blockchain more secure each time a new block is mined? Why does hacking the blockchain require tremendous speed?
Hacking the blockchain really just refers to 51% attack. When a block is mined, it gets harder for miners without 51% of the hashpower to double spend. The more blocks that gets generated after the block which your transaction is included in, the harder it gets for an attacker to mine more blocks to replace their transaction.

Also, does anyone know a Bitcoin expert who is willing to discuss more about some of these questions in detail over the phone perhaps?

Thanks in advance for any input you can provide.
I'm by no means a Bitcoin expert, these are just something I've learnt throughout my time here. People like Shorena, achow101 and dannyhamilton have way deeper understanding as compared to me. I doubt they would discuss this over the phone, just publish your questions here and the community would try to address them.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
DannyHamilton
Legendary
*
Offline Offline

Activity: 3360
Merit: 4570



View Profile
July 01, 2017, 12:44:27 PM
Last edit: July 02, 2017, 08:03:10 PM by DannyHamilton
 #3

If you really want to talk on the phone, I'm willing to do so.  However, you'll learn more and get better answers if you post your questions on this forum.  That way you can receive well thought out answers from multiple "experts".  If one "expert" isn't 100% certain about something you ask, then some other "expert" can assist with answering the question.  Also responding to posted questions allows the responder to research the answer a bit and to include links for further reading and specific technical details.  Perhaps most importantly, by responding here in writing, others that have the same question as you will find the answers in the future when they search, which means more people will benefit from the effort the "expert" is making.
-ck
Legendary
*
Offline Offline

Activity: 4088
Merit: 1630


Ruu \o/


View Profile WWW
July 02, 2017, 03:09:36 AM
 #4

Perhaps most importantly, by responding here in writing, others that have the same question as you will find the answers in the future when the search, which means more people will benefit from the effort the "expert" is making.

Though almost no one ever searches and every new person asks the same questions billions of times over.

Developer/maintainer for cgminer, ckpool/ckproxy, and the -ck kernel
2% Fee Solo mining at solo.ckpool.org
-ck
monsterer2
Full Member
***
Offline Offline

Activity: 351
Merit: 134


View Profile
July 02, 2017, 06:56:31 AM
 #5

Hi, I'm new to Bitcoin and had a couple questions that I've tried to research, but haven't been able to find a good answer that I could understand and accept.

1. What's the incentive for peers to validate blocks? I figured miners wouldn't want to validate other miners' blocks in hopes they can get their own block validated instead and collect the reward.

2. I don't understand why you would need 51% or more mining power to alter a transaction? Why is it more secure for more than 50% of the nodes to be independent?

3. Why is the blockchain more secure each time a new block is mined? Why does hacking the blockchain require tremendous speed?

Also, does anyone know a Bitcoin expert who is willing to discuss more about some of these questions in detail over the phone perhaps?

Thanks in advance for any input you can provide.

Satoshi's genius is in solving the problem of trustless anonymous voting. When a miner produces a block, he will only get paid if that block is on the longest branch (most number of blocks) at the head of the blockchain (yes, it's not a chain, but a tree, with pruned branches), so all miners are compelled to make sure they're mining on the longest branch. Miners are essentially voting for their preferred branch when they place their newly mined block there.

Each block has a reference to the previous block in the chain, so to replace a block which is 3 blocks back, you need to redo the work in all those previous blocks, which is 3 times the work.

When an attacking miner wants to double spend, they face this problem - they must send their transaction to the victim, wait for them to accept it (it appears in a block) and deliver the goods/service. Then, the attacker must generate a new branch where he sends the money somewhere else, thus defrauding the victim, but this new branch will only be valid if it is longer in length than the main branch in which the victim's transaction lives. Thus he must now acquire enough hashing power to outpace the rest of the entire network in the competition to produce blocks on the longest chain.

This is expensive because producing a block (on average) costs the network the same in electricity costs as they get back in the block reward, so the double spend needs to be sizable enough to compensate the attacker.  This is why you should wait longer (for more blocks to bury your transaction) to accept transactions of bigger value n BTC.

Hope that helps.

Cheers, Paul.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3360
Merit: 4570



View Profile
July 02, 2017, 08:04:26 PM
 #6

Perhaps most importantly, by responding here in writing, others that have the same question as you will find the answers in the future when the search, which means more people will benefit from the effort the "expert" is making.
Though almost no one ever searches and every new person asks the same questions billions of times over.

Can you be sure?

Obviously those that ask the same questions didn't search, but it's possible that thousands or millions of others searched and got the answer they were looking for, and therefore never asked.  How would you know?
-ck
Legendary
*
Offline Offline

Activity: 4088
Merit: 1630


Ruu \o/


View Profile WWW
July 02, 2017, 10:24:46 PM
 #7

Perhaps most importantly, by responding here in writing, others that have the same question as you will find the answers in the future when the search, which means more people will benefit from the effort the "expert" is making.
Though almost no one ever searches and every new person asks the same questions billions of times over.

Can you be sure?

Obviously those that ask the same questions didn't search, but it's possible that thousands or millions of others searched and got the answer they were looking for, and therefore never asked.  How would you know?
At least in mining which I monitor virtually every new thread as the only active mod, I can tell you the repeat questions constitute more than 80% of new threads. As for the rest, I can only extrapolate.

Developer/maintainer for cgminer, ckpool/ckproxy, and the -ck kernel
2% Fee Solo mining at solo.ckpool.org
-ck
DannyHamilton
Legendary
*
Offline Offline

Activity: 3360
Merit: 4570



View Profile
July 02, 2017, 10:34:32 PM
Merited by ABCbits (1)
 #8

At least in mining which I monitor virtually every new thread as the only active mod, I can tell you the repeat questions constitute more than 80% of new threads. As for the rest, I can only extrapolate.

I prefer to think of that as a matter of confirmation bias.

If someone searches, they get their answers and they never bother posting.

As such, the vast majority of posts you'll ever see are from those that don't make any effort to figure anything out themselves.

The important thing to keep in mind is that the things being posted don't tell you ANYTHING about the people that don't post.

There are over 7.5 billion people on this planet.  If you get posts from literally a million people all asking the same question, that means that 7.499 billion people are NOT posting and asking that same question.  What's unknown is how many of those 7.499 billion got their answer by searching, and how many just didn't have a question in the first place.
mitchong (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 4


View Profile
July 06, 2017, 02:45:54 PM
Merited by ABCbits (1)
 #9

Thanks @ranochigo and @monsterer2 for the replies to my question. @DannyHamilton, also thank you for offering to talk on the phone. I will try to ask my questions here so that hopefully everyone can benefit.

In regards to the first question I asked, here's a scenario I was thinking of that might better illustrate my question:  

Let's say a miner solves a block and sends it to 5 other nearest nodes (all of which are miners or mining pools) in the network. Those 5 nodes would have to validate the solved block in order for it to propagate through the network. Why would any of those 5 nodes validate another miner's solved block? Wouldn't they want the reward for themselves and choose not to validate the solved block at all? That way, they can solve the block themselves and send their solution to the network instead to get the reward for themselves.


On a related note, @DannyHamilton, I saw a post on the forum you made here: https://bitcointalk.org/index.php?topic=1734235.0

You mentioned that not all nodes are miners or mining pools. Do you have an idea of what percentage of the nodes on the network are non-miners or volunteers whose only job is to validate transactions and blocks and relay the block to other nodes? Also, is there something in the consensus rules that require full nodes (miners and non-miners) to validate solved blocks that they receive?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3360
Merit: 4570



View Profile
July 06, 2017, 03:44:16 PM
Merited by ABCbits (4)
 #10

@DannyHamilton, also thank you for offering to talk on the phone.

No problem.

I will try to ask my questions here so that hopefully everyone can benefit.

Good idea.  Allows me to take my time in answering to make sure I get it right, and to correct my mistakes before I post so that I'm lesss likely to cause confusion.


In regards to the first question I asked, here's a scenario I was thinking of that might better illustrate my question:  

Let's say a miner solves a block and sends it to 5 other nearest nodes (all of which are miners or mining pools) in the network. Those 5 nodes would have to validate the solved block in order for it to propagate through the network. Why would any of those 5 nodes validate another miner's solved block? Wouldn't they want the reward for themselves and choose not to validate the solved block at all? That way, they can solve the block themselves and send their solution to the network instead to get the reward for themselves.

The miner doesn't gain anything by refusing to relay a block.  He can still work on solving a block (and can still get a block reward if/when he finally does solve one) even if he relays the one he receives.  Since everyone else is going to relay the block anyhow, the block will become part of the longest chain IF IT IS A VALID block.  The miner will need to know whether it is a valid block or not, so he knows if he should build on top of it or not.  Therefore, the miner has an incentive to validate the block before he builds on top of it so that he doesn't waste hashpower building on top of an invalid block.

If that doesn't clear it up for you, then (based on years of answering similar questions) I'm guessing you're making some mistaken assumptions about how bitcoin mining works.

On a related note, @DannyHamilton, I saw a post on the forum you made here: https://bitcointalk.org/index.php?topic=1734235.0

You mentioned that not all nodes are miners or mining pools. Do you have an idea of what percentage of the nodes on the network are non-miners or volunteers whose only job is to validate transactions and blocks and relay the block to other nodes? Also, is there something in the consensus rules that require full nodes (miners and non-miners) to validate solved blocks that they receive?

Because bitcoin is a decentralized peer-to-peer system, it is practically impossible to know for certain exactly how many nodes, or miners, or wallets there are.  There is no central repository of that information. The best we can do is make reasonable guesses and estimates.

That VAST MAJORITY (more than 99% of all mining) of all bitcoin mining is currently handled by less than 30 mining pools.  Each of those pools will be running at least 1 full node.

I've seen many different estimates of how many full nodes are running from as few as 1,000 to as many as 100,000.  I'd say a reasonable estimate is 10,000, but that's just a guess.

Lets assume that each mining pool just runs one node, and that there are an additional 10 mining farms that are realistically solo-mining.

Given those numbers, my estimate of the number of nodes that are mining are:
40 "mining nodes" / 10,000 total nodes = 0.4% of nodes are mining nodes.

That means that 99.6% of nodes are not mining nodes.
mitchong (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 4


View Profile
July 06, 2017, 04:48:56 PM
Merited by ABCbits (1)
 #11

@DannyHamilton, thanks for your quick response.

When you say "everyone else is going to relay the block anyhow" and "the miner doesn't gain anything by refusing to relay the block," what is this assumption based on? I think this is the sticking point I'm having trouble understanding.

From your answer to my second question, my thoughts are that since most of the nodes are not mining nodes on the network and their only job is to validate blocks and transactions, they don't have anything at stake by validating the block and relaying it to other nodes. Therefore, refusing to relay the block becomes pointless. If this is the case, then the comments you made make sense to me. Is this correct?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3360
Merit: 4570



View Profile
July 06, 2017, 06:37:57 PM
Merited by ABCbits (3)
 #12

@DannyHamilton, thanks for your quick response.

When you say "everyone else is going to relay the block anyhow" and "the miner doesn't gain anything by refusing to relay the block," what is this assumption based on?

It's based on two things.

First, the miner can't reliably assume that NOBODY will relay the block.  So refusing to relay it won't keep others from finding out about it.  As such, refusing to relay the block doesn't gain any benefit.

Second, the fact that some other miner has solved a block has no bearing on whether you as a miner will solve a block.  If you validate and relay that block, then you can continue mining and will hopefully eventually solve a block and get paid.  If you don't validate, relay, or accept that block, then you can continue mining and will hopefully solve a block in the next few fractions of a second and be able to get it to more people than that competing block gets to in that amount of time.  Either way you get paid when you solve and successfully broadcast a block, but by building on top of the block you just received you significantly increase the odds that you'll actually get paid when you solve your block.

I think this is the sticking point I'm having trouble understanding.

I don't know for certain, but I'm assuming that you're getting stuck on a point that people commonly get confused about.

There is never any progress made when working on a block.  If you've spent a lot of time on a block, your odds of solving it are not any better or worse than if you abandon it and start a whole new block.

You are probably (maybe?) thinking that, as a miner, by abandoning the block that you are working on when you get a new block you need to start all over and all that previous effort has been wasted, or that by continuing on the block you are already working on you have a better chance of solving it sooner.  This is not true.

From your answer to my second question, my thoughts are that since most of the nodes are not mining nodes on the network and their only job is to validate blocks and transactions, they don't have anything at stake by validating the block and relaying it to other nodes. Therefore, refusing to relay the block becomes pointless. If this is the case, then the comments you made make sense to me. Is this correct?

Correct.  Non-mining nodes are going to relay the block.  There are enough non-mining nodes that the block is quickly going to get to everyone regardless of whether or not the mining node relays the block.  However, even if there were no non-mining nodes, any individual miner (or pool) has no way of being certain that all the other miners will also refuse to relay the block. As such, he has to assume that the block is going to make it into the blockchain of the majority of the hashpower in the next second or so.  As such, he needs to validate it before mining on top of it, and at that point since he's mining on top of it, he's going to want as many other miners to know about it as well (so he isn't stuck mining on a block that will get orphaned by the rest of the network).
MySeriousFaceIsOn
Newbie
*
Offline Offline

Activity: 57
Merit: 0


View Profile
July 06, 2017, 10:14:53 PM
 #13

I'm only posting because I'm one of those people that normally reads and leaves - thanks for looking out for us Danny Smiley

And it's not always a case of searching, reading and leaving - sometimes just, oh, someone is asking that question, if anyone that knows what they're talking about weighs in, I'll be sure to check what I believe to be true against their thoughts.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!