1

I'm really new to the whole concept of blockchain.

I do understand how consensus protects from changing past blocks and allows to keep a clear and valid blockchain, but I am having a hard time trying to wrap my head around fake transactions.

Let me explain. As I understand it :

  • Nodes in the network produce transactions.
  • They are repeated all across the network
  • At the same time, some nodes try to mine a block.
  • When someone resolves the hash, they can create their block.
  • The block is accepted by everybody on the network as they can immediately check Proof of Work (via the hash + the data)

Ok so this basically means that everybody follows the consensus (otherwise, everything said by anybody else would be garbage to a Node, and the other way round : we would have an isolated node). But how do they know that the transactions themselves written in the new block are correct ?

For instance, let A and B be two accounts. What prevents a node from randomly saying "B gave n bitcoins to A", and that information being completely false ? B would obviously benefit from doing that.

Maybe I don't understand how consensus is enforced in nodes themselves as well... is everybody running the same "program" ? Is it something in the protocol itself ? Does the consensus "know" when a transaction cannot be made for some reason ?

Thanks for your help

0

Does the consensus "know" when a transaction cannot be made for some reason ?

Yes, this is done by utilizing public key cryptography to cryptographically sign transactions in a way that proves ownership of an unspent output.

Nodes keep a copy of the blockchain, which they know to be an accurate account of what addresses all the bitcoins in existence currently reside in. When a node hears about a new transaction, they will check to make sure the signature is valid. Public key cryptography allows a node to check that a signature is created using the right private key, without actually learning what that private key is (which is pretty neat). This is done by cryptographically verifying that the public address and the transaction signature were created by the same private key.

So if you tried to make a false transaction, to move coins you don't own, or don't exist, then network nodes would easily identify your tx as invalid, and not accept it, or relay it on.

The 'consensus layer' of the protocol strictly defines these sort of rules. All clients must adhere to the consensus layer rules in order to be a part of the network.

  • Thanks ! It makes sense now, the whole assymetric encryption – Max Dec 11 '17 at 14:14
2

You can think of a bitcoin address like a machine that produces locks and a bitcoin wallet like a machine that produces unforgeable, labeled keys.

Say Alice received 1 bitcoin from Bob and wants to send it to Charlie. If Alice has 1 bitcoin to send, that means there is 1 bitcoin that is locked with a lock from her lock-making machine.

When Alice wants to send that 1 bitcoin to Charlie, she must have his address. She uses his address as a lock-making machine and makes a lock that only Charlie can unlock. She feeds this to her key-making machine and makes a key to the lock that only she can make a key to but labels it with the lock she got from Charlie's lock making machine.

This new key only opens the 1 bitcoin Alice will send to Charlie, and only Alice could make it. The attached new lock can only be opened by Charlie, since only he has the matching key-making machine.

You consider someone to have "sent you a bitcoin" if they locked it with a lock that only you can open.

So, a block that contains invalid transactions is itself invalid and ignored. You can only form valid transactions that transfer bitcoins with the appropriate keys or the transactions are invalid.

This might make you wonder what you need consensus for at all. And the problem is that Alice could maliciously make multiple keys that open the same lock, transferring the same 1 bitcoin to both Charlie and Dave. We need consensus to agree which of a set of conflicting transaction, each individually valid, we can rely on.

  • Thanks for the explanation. But where does the PoW comes in (for those systems that rely on it)? Would it be fair to say that it is to "slow" things down a little, to at least not make it free for malicious agents to submit blocks? – DPM May 5 at 19:50

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.