Hi guys,
I'm watching this fascinating video about what's really happening under the hood of Bitcoin (
https://www.youtube.com/watch?v=bBC-nXj3Ng4 ).
Please correct me if any of my details are wrong they are probably a little murky, I'm just as of recent trying to understand the premise behind btc.
At the start(of the video) he explains how everyone keeps a ledger, this ledger contains every transaction. Such as Alice plays Bob 0.005 btc but how do we know this is a legitimate payment? Maybe Bob added this line to the ledger, A way around this is to add a digital signature to the end of the transaction. Each person has a private and public key pair. If Alice really does want to pay Bob 0.005 btc she will run the transaction and her private key through a function that will create a digital signature, this signature can be verified by putting the message,signature and Alice's public key into a function, if the function returns true then we know that Alice does really intend to pay Bob 0.005 btc. But what prevents Bob from just copying and pasting this line multiple times? Well each transaction will have a unique ID, so the signature will actually consist of the transaction ID, the transaction and Alice's private key (this obviously done by Alice). Each person on the network verifies this transaction with Alice's public key, the transaction ID, the transaction (message) and the signature. The transaction is added to the individual ledgers if the function that verifies the transaction returns true. No ledger can have the same digital signature twice.
Okay so that isn't exactly what happens, it's a precursor if anything. What's really happening is each participant on the bitcoin network has a thing called a blockchain, this blockchain is a chain of ledgers, each block obviously containing transactions that are confirmed. Blocks are created by miners, blocks are created containing a number of transactions, each block's hash/digest must begin with a certain amount of zeroes (it alternates but let's just pretend it's 30 for simplicity). By hashing a block of transactions with the hash of the previous block and also a special number it then looks for a hash that starts with 30 zeroes, the miner hashes the previous blocks hash and transactions with a number, if the hash starts with 30 consecutive zeroes that means we have found the correct number and the block gets broadcasted to every node on the network. The minor also gets rewarded.
The chances of finding that special number that gives a hash that starts with 30 zeroes is 1/(2^30), so each miner is basically playing a lottery to try solve that computation first( It probably does help to have high end GPUs etc). When the block is found it is broadcasted to all the participants on the bitcoin network who then add it to their respective chains.
So my questions that follow are.
How many transactions are in one block?
When a transaction is made does the person who is sending bitcoin to another participant broadcast the transaction to the miners? And how does the miner(s) verify the transaction that it/they received is legitimate? (I'm guessing it has something to do with the digital signatures I prefaced in the beginning)
From what I can tell the transaction fee will give the miner more incentive to include that transaction in a block, so if a person decided to pay a higher transaction fee that means they have more chances of being included in that block hence taking quicker for their transaction to be processes, right?
To expand on the above question, does each miner receive all the transactions? Is it possible one miner may not receive a certain transaction ( a high priority one ) and solve the computation not including that transaction in the block? and will that transaction be lost??
And to again expand above, how are transactions queued? I mean how does the blockchain ensure that no transaction gets lost?
So yeah this may be a long thread :)
Thanks