1
donuts
3y

What does a bitcoin mining puzzle have to do with verifying transactions/driving consensus across nodes?

The winner just gets to write? The next block but doesn't that mean he is like admin, he can make up all the transactions he wants?

Comments
  • 1
    The target is that one actor cannot get 50%+1 of the mining volume and that the "coins" are generated over time so that there isnt too much money in little time generates. The common method is to use an limited resource like RAM, space or computing power.
  • 1
    @stop but what does mining volume have to do with writing the next block and making sure all the transactions are correct?
  • 2
    @donuts the other are verifying the transactions by building ontop the chain. An example:
    I buy a a Notebook with bitcoin. After the Notebook is in delivery i can create a new chain where my transaction never happened. So i have the notebook and my bitcoins. That way i can also manipulate the chain so that my Rival cannot receive or send any of his coins.
  • 3
    Each crypto block contains the following:
    - a set of transactions signed by their authors
    - hash of the last confirmed block(s)
    - identity of the "miner"
    - verification number

    The goal of "mining" is to find a verification number which is easy to verify but hard to obtain. For bitcoin, you need to find some random number such that the hash of the whole block contains a specific number of zeros. Therefore if any data in the block changes, the hash of the block changes as well and the old verification number no longer works. So there's no way for the "winner" to change the contents of the block after they "win".

    And even if the winner somehow started with a bunch of fake transactions and got lucky, other miners still need to agree that this block with fake transactions is in fact "the last confirmed block" before those fake transactions are actually approved.
  • 1
    @stop but the mining puzzle that needs to be solved has no relationship to the transaction though? Or does it?

    If the writer says A give B $10... who can argue with that?
  • 1
    @hitko so how does the order work?

    Txn 1, 2, 3
    Winner write block for 1,2,3?

    But then where are the actually transactions recorded?

    And who determines the verification #?
  • 6
    Suppose you have a group of people in a room and no one trusts anyone, your task is to tell them to write something on a piece of paper, but you can never trust if they will honest, you need some mechanism to believe their honesty, you tell them all to solve some equation which takes a lot of time, once they solve the equation they can submit their work, the beauty of this computation is that it's extremely easy to verify it's legitimacy, so, the winner gets a chance to distribute his solution to everyone, he isn't any admin, if his solution is wrong, no one will accept it, he just got the chance. If however, majority of them are malicious and agree on some malicious solution, that's a problem.

    This method is quite well except it wastes lot of power.
  • 4
    @donuts Each block contains a reference to some previous (parent) block. Let's say we have blocks A -> B -> C; I can create block D and specify C as the last confirmed block (parent), or I can decide that block C contains some invalid transactions and instead take B as the last confirmed block (parent), creating a branch in the blockchain. Then it's up to other miners to decide whether they agree with me and continue building the chain from D, or they disagree and want to keep C. As a rule, the longer chain wins, so even if the community is divided, eventually one branch will grow more and everyone will focus on that branch.
  • 4
    The security of transactions is linked with Cryptography and has nothing to do with Blockchain, nobody can create a transaction on behalf of someone else.

    Blockchain is a list of transactions and everyone has one copy, without these puzzles, people could write hundreds of transactions and broadcast it, and it will become inefficient to verify legitimacy, you need to slow down this, that's why these complex puzzles, this also makes it impossible for hacker to recreate the entire Blockchain as he will always be behind original Blockchain.

    The goal is to slow it down, trust me, it can exist without these puzzles, it will be a mess, hacker with high computation power will recreate the list and will dominate.
  • 1
    @hitko but as a miner how do you know if a Block has invalid transactions? And where do the transactions come from? Crypto exchange != Miner?

    Also who decides what the problem that everyone needs to solve is?
  • 2
    @theabbie so how does a txn get added to the list? Ask noises somehow need to agree that it happened?
  • 4
    @donuts A valid transaction will have a valid signature, and that's pretty easy to verify,

    When you want to create a transaction, you need to be a node, Either you invest in a node or you use services which have a BTC node on server, That Node will broadcast your transaction to 8 other nodes, and the other nodes do the same, the pending list of transactions is called transaction pool and it's miner's choice which one he wants to include, This is where transaction fees comes into play, if you pay higher fees, Miner will give you more priority.

    After successful Mining, it will again broadcast it, till all nodes get the fresh copy, and your transaction will be successful.
  • 2
    @donuts There are two mechanisms for that. First, each account is identified by its public key, and a transaction is only valid when it's signed by the account's private key. If the signature doesn't match, the transaction is invalid. Second, each block has a parent block, and all blocks are public, therefore a miner can always calculate how much money each account has and whether they can afford that transaction.

    The problem that everyone needs to solve is defined by the protocol, just like the protocol defines how the blocks need to be structured or how transactions are signed.
  • 1
    @hitko for the problem though, who determines what the right answer is in the first place?

    Found this but still can't figure it out.. just saws this: miners put all the info into a "machine" until it outputs a hashing with a specific requirement.

    But who owns this machine and well generated the problem to be solved?
    https://vpnmentor.com/blog/...
  • 2
    One block contains the previous block hash, all block transactions in the block and a random number.

    Then this block is hashed and if the hash starts with the required number of zeroes you send it to the chain for verification.

    The block that first gets 50% approval among all miners wins and this voting ensures that half of the network promises the block is correct.

    If the hash does not have the required number of zeroes you generate a new random number and hash again.

    This hashing can require billions of tries to get a hash that qualifies and that is the “work”.
  • 1
    @Voxera so new block
    -last hash
    -transactions that the miner picked from the pool?
    -random #

    Generate hash from the data
    -whats the hashing algo?
    -who sets the required # of zeros/difficulty of the puzzle?
  • 3
    @donuts the required number are increased as more coins are created to preserve the amount of work required to create one coin.

    The algorithm is sha256.
  • 1
    @donuts @Voxera the current difficulty is around 20T(20.6 * 10^12) that means that staistically that many hashes need to be generated. Currently an average miner generates a coin in 7 Minutes. Every 2016 Blocks the difficulty is recalculated.
  • 1
    @stop but still who sets the difficulty? Someone has to?

    I read also the difficulty is determined by # of miners, which changes?
  • 3
    @donuts its defined by the spec.

    And as long as most miners agree to keep the spec it will stay that way.

    Thats the point, there are no central authority, just common consensus among miners.

    Thats also why it must be many miners, if one group would control more than half they will literally be the currency but it most likely would end it as all others would abandon it long before.

    So when bitcoin was invented, there was a set of rules.

    And the only way to change them is if at least half the miners agree.

    And since the value depends on having many miners, every one with money invested will want it to stay that way.

    Money talks and the currency is designed so its in every ones interest to keep a good set of rules.
  • 2
    @donuts it is calculated by how fast bitcoins where mined. It tries to have a block to be calculated in a specific time. If i modify my bitcoin core software to work not like the others, they wont accept my coins. Most things are hardcoded into the software. The software has solved the byzantinic error in a p2p way.
  • 0
    Can we all stop there is no value behind currency talk it's stupid, why do you care what backs your money anyway?

    Wanna know the value behind currency it's you and me money doesn't have to be backed by anything but people i mean i give you a note you give me a loaf of bread we agree it was a fair exchange that's enough backing for me
Add Comment