0

Proof of work in spam

I understand very well how proof of work is used to prevent email spam for example. Reasoning is since computing the right hash (e.g. with predefined number of zeros for example) for a single email is expensive, it will not be desirable for people sending spam to million recipients to compute that hash for each email. Now this reasoning makes perfect sense.

Proof of work in bitcoin

However, I don't know how the proof of work system is used in bitcoin, more precisely:

  • which problem does it try to solve
  • and more importantly how does it solve this

Can someone explain it (in layman terms)?

2

To have a useful payment system, if I have some asset the system supports, I have to be able to send it to Alice if she is a user of that system. And I also have to be able to send it to Bob if he is a user of that system. But if I can do both of these things, the system stops being useful. So, for bitcoin, somehow sending bitcoins to Alice must prevent me from sending them to Bob and vice versa.

Traditionally, this would be accomplished by a central authority. For example, my bank can process checks in the order it receives them, approving them if I have a sufficient balance and deducting that amount from my balance. The bank can prevent me from sending the same money in two places. But bitcoin has no central authority.

Bitcoin's solution has several pieces.

First, it groups transactions into blocks. Second, it chains blocks into a blockchain.

Third, it has rules for what is or is not a valid blockchain. For example, a chain that includes two conflicting transactions is not valid. So, in my example, either a blockchain can include my payment to Alice or my payment to Bob, but not both. This works because all transaction and state information is public, so nobody would ever accept any blockchain with conflicting transactions unless they chose to foolishly harm themselves.

But we still have one problem left -- how do we ever get everyone to agree on which blockchain is valid if there's one that includes the payment to Alice and one that includes the payment to Bob? That's where proof of work (mining) comes in.

It consists of two steps:

1) To add a block to the blockchain, you must do a very large amount of computational work.

2) You will be rewarded with bitcoins for doing this large amount of work, but only if the blockchain that contains the block you added becomes the one everyone agrees on.

And lastly, one more rule: We agree on that valid blockchain that has required the most computing power to generate.

Under reasonable conditions, this assures that everyone will eventually agree which of the two transactions is valid. Miners are incentivized to build on the longest, valid block chain they know of, because that gives them the best chance of being rewarded. Thus longer chains will tend to get longer and shorter chains will tend to be ignored. Eventually, one chain will be so much longer than every other chain that we everyone is mining on top of it and nobody is mining on top of the other and there is no chance the shorter chain will ever be longer.

Once that happens, and the longer chain contains one of my two transactions sufficiently deep in the chain, we can all agree which way my bitcoins go. And no central authority is needed.

  • I am sorry but I fail to see what problem POW solves from your answer and HOW it solves it? in spam it is very clear, please pay attention to it: since you have to compute POW for one email, then for spammers it is not worthy to compute POW for 100000 emails because it will take too long. Now here one can clearly see how POW prevents spam. I fail to see similar analogy in bitcoin. – user56231 Jul 27 '17 at 8:39
  • It's precisely the same thing. Say the longest blockchain contains the payment to Alice. If an attacker wants to make a longer blockchain with the payment to Bob, he has to compute lots of POW to make his blockchain longer (he has to start from a block before the one with the payment to Alice). And he'll be the only one doing that as everyone else in the world is working on the longest blockchain and he's the only one working on the shorter one. Meanwhile, any blocks he produces earn him nothing since they'll never be part of the longest blockchain. – David Schwartz Jul 27 '17 at 9:17
  • Or to put it more simply: You get paid for making the longest blockchain longer. Thus the longest blockchain will tend to get longer very, very quickly as everyone is making it longer. So a payment in a block will rapidly be buried deep in a blockchain that is clearly the longest and so can be reasonably assured to always be in the longest blockchain. We all agree to consider a transaction valid if it appears in the longest valid blockchain. – David Schwartz Jul 27 '17 at 9:20
  • Now this makes a little bit more sense but I am still fuzzy about it, maybe that is because I am not familiar with the rest of the bitcoin protocol? – user56231 Jul 27 '17 at 14:55
  • Maybe. One of the things that makes bitcoin particularly hard to wrap your head around is that every concept depends on every other concept. So you kind of have to get a rough idea of what everything is, then firm up concepts in rotation, and keep going until you get it all well. – David Schwartz Jul 27 '17 at 19:21
1

which problem does it try to solve?

Imagine a P2P system in which all nodes are connected. Now, any peer can propose a block(these set of transactions) and say that it is valid and should be added to blockchain(the ledger containing these blocks). Now, the question which peer proposes this new block? . If we randomly choose a peer to propose this block, it is vulnerable to sybil attack(create multiple nodes).

Enter PoW(Proof of Work): We approximate selecting a random node by instead selecting nodes in proportion to a resource that we hope that nobody can monopolize. What does that mean? Well, if that resource that we're talking about is computing power, then it's a proof-of-work system where we somehow select nodes in proportion to their computing power.

I would call PoW is a sybil-attack resistant method for choosing a block to propose the next block. Just like SPAM protection, it is SPAM protection from choosing a peer to propose the next blocks. Other parts such as block rewards, double-spend etc are related to game-theoritic incentives. I hope you can relate it with email spam protection

EDIT: In SPAM protection: you prevent sender from making a DOS attack on servers by forcing them to provide a valid PoW for every message. This prevents from DoS attacks of many sybils. Here, you choose only the valid messages which are to be processed by your server. You pick winners(valid messages) from spam you recieve.

In bitcoin: It is a method for deciding which block should be the next block. You choose winners(only 1, the first one to provide valid PoW) from the many blocks which peers may propose.

  • spam example is clear to me - this not – user56231 Jul 27 '17 at 7:02
  • In email spam, you prevent people from spaming by forcing them to provide PoW to each email. Here, to propose a block, you are forced to do PoW for a block. Without PoW, it is unclear how to choose the next block for blockchain in a sybil-resistant(en.wikipedia.org/wiki/Sybil_attack) way. In SPAM protection, you only accept emails which a valid PoW(preventing mails from meaningless peers) and in bitcoin, you only accept blocks which have valid PoW. – sanket1729 Jul 27 '17 at 7:11
  • @user200300, please have a look at updated answer – sanket1729 Jul 27 '17 at 7:18
  • in spam POW helps you because it is not worthy for spammers to compute pow for 1000000 of emails (takes too long). how does that apply in bitcoin? why POW prevents sybil? – user56231 Jul 27 '17 at 8:35
0

Proof of work enables distributed-trustless consensus and solve the doublespend problem.

After the transaction validation, all miners try to create a new block by finding a number that creates a hash with certain properties. It is nothing but a puzzle that is resource intensive so that only the "worthy" can add a new block to the block chain.

Why is it compute-intensive?

The reason why it is compute-intensive is, that not anybody could add that block. And let's say I want to double-spend my bitcoins, I could create that block myself. But anyone else with a higher hash-rate or "a better CPU" can say that the transaction added is invalid and would not promote the chain with invalid transactions, instead will add blocks with valid ones.

Now with enough miners on the network,

the proof of work helps to add the correct block. Anybody who wants to add an invalid block, should have a mining power of at least 51% of the network, and in doing that if possible the miner will spend resources that he wouldn't gain out of adding that invalid block, because he will have to keep adding blocks in competition of all the other miners to make his chain "the longer chain" indefinitely.

  • I am sorry but this is a terrible explanation. – user56231 Jul 27 '17 at 6:14
  • compare this explanation with the explanation I gave about SPAM filters. Is there a difference in terms of clarity? Which is easier to understand? – user56231 Jul 27 '17 at 6:15
0

And to add to 'how it works':

If a miner wants to create a new block, it has to find a hash as stated by nakulchawla09. The difficulty to find this hash is controlled by the bitcoin protocol in a way that a block is mined every 10 minutes.

The hash that needs to be found is based on hashcash puzzles, just like in spam protection. The difficulty is set by determining the amount of zero bits the hash needs to comply to.

Now, the first miner to find a correct hash gets a bitcoin reward (currenty 12,5 BTC). So there's an incentive to find a correct hash. Correct hashes can be verified fast by other nodes and don't require a lot of hashing/mining power.

So basically PoW helps to fuel a reward system for processing transactions at a controlled pace. Controlling this pace is desirable because nodes need time to process information.

  • i am not interested how it works rather how it solves the problem for which it wad employed – user56231 Jul 27 '17 at 7:03
0

Proof-of-work in Bitcoin limits the frequency with which the blocks are added. The target frequency is one block per 10 minutes. Without proof-of-work, computing a valid block would be almost instant. The difficulty (number of leading zeroes required for a block to be valid) is adjusted every 2016 blocks depending on how fast the last 2016 blocks were produced, therefore adjusting to changes in the hashing power of the network. Instead of having a block mined every 2 minutes should 5 times as much hashing power be employed, the difficulty will raise to limit the frequency to as close to 10 minutes as possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy