Please Stop - eviltoast
  • excitingburp@lemmy.world
    link
    fedilink
    English
    arrow-up
    15
    arrow-down
    2
    ·
    edit-2
    8 months ago

    The cryptography has much simpler algebraic analogues - what we are looking for is a “one-way function”. This means a mathematical symbol that only works on the left side of the equals. The simplest one is the remainder of a division. For example if I told you that I had a remainder of 5 after dividing by 20, you wouldn’t know if the original numerator was 25, 45, 65, 85, and so on. This operator is called mod (modulus). Even if you don’t know what value I started with, It’s not hard to guess what possible numerators could be with modulus. That’s where the cryptography comes into play: a cryptographic hash is designed so that it’s practically impossible to guess the original numerator. We’ll stick with the modulus for explanatory purposes, but imagine that you can’t list off possible numerators like I did.

    Now we can invent a puzzle for a computer to solve. We’ll start off with the same values as before, but - again - we are disallowing easy guesses. This forces us to check 1 mod 20, 2 mod 20, 3 mod 20, 4 mod 20, 5 mod 20 and so on. Eventually we’ll hit 25 mod 20 giving us the solution to X mod 20 = 25. Now you can go back to the person that gave you the puzzle and prove that you’ve done 25 steps of work to arrive at a solution (or have made a lucky 1/25 guess). This is called “proof of work”. A cryptographic has consists of a certain number of bits, such as 256 bits - this means a series of 1’ s and 0’s 256 long. The puzzle presented to the computer is “find the numerator that results in the first 50 bits being zero” (the more bits are required to be zero, the longer it will take to find the answer). Because of the incredibly slim chance of guessing the correct numerator, it doesn’t really matter if the computer counts up (like we did with modulus) or guesses. So, in practice, everybody trying to find the solution starts at a random number and starts counting, or trying other random numbers, until someone wins the jackpot. It’s basically a lottery, but the correct numbers have to be discovered instead of being dropped out of a glass ball at the end of the week. Once a computer finds a solution, everybody else playing the game can check their numerator as [probabilistic] proof that they have done work.

    Now we can use this lottery to create a blockchain. We start with 5 things: a globally agreed on solution we are looking for (789), an initial block (which is just a number - lets say 12345), Bob’s account #5 of $100, and Sally’s account #6 of $200, and a huge amount of players of the above game. Sally wants to transfer $20 to Bob, so she says to all the players: “I’m #6 and want to give #5 $20. There’s a $1 prize for finding a new block for me.” All the players make a new denominator, by placing the numbers next to eachother - so 12345 6 200 5 100 20 1 - or just 1234562005100201. All the players start trying to find the number that will result in 789. Eventually someone finds 1234562005100990 after a lot of work/guesses. Everybody checks their work 1234562005100990 mod 1234562005100201 = 789. The winning player receives their prize, and now everybody has a new block to start from: 1234562005100201 1234562005100990. Next time someone wants to send some money they will use 12345620051002011234562005100990 as the initial block instead of 12345. Hence, we have set up a chain starting with:

    12345 -> 12345620051002011234562005100990 -> …

    There’s your block…chain. Anybody can independently verify that the work has been done by checking the answers. It’s incredibly elegant but, as we’ve seen, incredibly destructive.

    • daltotron@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      8 months ago

      Good explanation. I am extremely bad at math, I never made it past kind of, high school algebra, and I still can’t do basic math very well, but this explained it pretty well, thank you. So, someone has to start a transaction before mining can start, if that’s how it works?

      • excitingburp@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        8 months ago

        I’m Bitcoin there is a built-in reward to keep things moving forward even if there are no transactions. Different coins do different things.

    • Knock_Knock_Lemmy_In@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      8 months ago

      PoW is destructive. Blockchain doesn’t have to be PoW.

      Hash linked list part was good.

      You missed out public key cryptography which is also key to blockchain.