Author

Topic: What is mining? My understanding! (Read 227 times)

legendary
Activity: 3584
Merit: 5248
https://merel.mobi => buy facemasks with BTC/LTC
September 26, 2018, 08:13:02 AM
#8
OK, time to set the record straight (again).

As usual, it seems like a thread about mining has been derailed, and the amount of misinformation is starting to grow. I'm not going to point fingers here, i'm just going to try to give a newbie-friendly explanation about mining, omitting a lot of technicality's that would make it hard for somebody to understand what's going on.

Bitcoin is built on top of the blockchain technology. A blockchain is basically a chain of "blocks". You can see each block as a datafile. This datafile contains a number of transactions. In bitcoin, the size of the datafile is limited.
A block also has a header. This header is built like this:
version - previous block header hash - merkle root hash - time - nbits - nonce

Some of these fields in the block header aren't interesting for my story... But the following fields are:

previous block header hash => because the header of a new valid block contains the hash of the header of a the previous block, the blocks actually make a "chain" (the blockchain). You can't just remove a block from the blockchain, because the next block actually uses the hash of this removed block in it's own header... So throwing away a block would make the next blocks invalid.

merkle root hash => i won't go into detail about merkle trees, but basically if you change any transaction in a block, the hash of the merkle root will change, so there is no way to meddle with transactions in a block without changing the block header

nonce => an increment... Important for mining.

Now, what is mining? A miner runs a normal node, this node builds an utxo set of all unspent outputs that can be spent in new transactions. It also fills it's mempool with all new transactions that are being broadcasted.
When a miner receives a new block, he immediately checks this block for errors, and if everything is ok, he removes all spent unspent outputs from it's utxo set, adds all new unspent outputs to his utxo set and removes all transactions in the valid block from his mempool.
He now puts together transactions from his mempool to form a new block, and creates a new  block header... Then, his ASIC starts to increment the nonce, leaving the rest of the block header static.
For each nonce increment, the ASIC takes the sha256 hash of the sha256 hash of the new block header. IF the miner finds a nonce for which the sha256d hash is UNDER the current target, he found a valid block, and he can broadcast this block to all other nodes.
At this point, all miners will re-start the process of utxo and mempool manipulations, building a new block, incrementing nonce,...

A miner can add a coinbase reward of 12,5 BTC (halving every 210.000 blocks). He can also add the sum of the fees of the transactions he has added to the block he's trying to solve. So the more fee per byte of transaction data (limited blocksize, remember), the more interesting it is to add a certain transaction.

The target is changed when the difficulty is changed. Every 2016 blocks, the algorithm calculates how much the average time between 2 valid blocks was. If the time between two blocks was bigger than 10 minutes, the difficulty gets adjusted downwards (and the target goes upwards making it easyer to find a valid block) and vice versa. This mechanism makes sure the average time between 2 blocks is ~10 minutes.
At the moment, the difficulty is soooooo high (and the target is soooooo low), the odds of you finding a valid block by yourself is allmost nonexistent (especially if you don't own hardware that was built for the sole purpose of bitcoin mining => this hardware is called an ASIC). People have joined together in pools. A pool is a way for many (sometimes thousands) of small miners trying to solve a block together. If a member of the pool solves a block, the coinbase reward gets distributed fairly amongst all members of the pool.

If you have other questions, try the forum's search function.... If you can't find your answer: don't hesistate to ask.
member
Activity: 276
Merit: 23
September 26, 2018, 07:55:16 AM
#7
... it is basically a process through which blocks (that contains information about transactions) are verified. For that miners has to perform simple calculations Nodes (Computers) does that for miners. The one who performs it the first gets the reward .Thats how all the blocks got mined!
...

To understand mining I suggest you consider two different aspects:
a) Why is mining necessary at all. What is the purpose of mining.
b) What is the process of mining.

The (b) part is only relevant for developers or people who need to actually act on the technical level. As you say, it is related to solving a computer intensive problem with the best result (the one with more "work") for a given block.

The most interesting part is actually (a). Mining is a process that secures the Bitcoin network. It is mainly designed to avoid any malicious actor to be able to tamper with the network and it is IMO the greatest achievement of Blockchain.
full member
Activity: 308
Merit: 102
September 26, 2018, 06:52:08 AM
#6
As far as I understood, it is basically a process through which blocks (that contains information about transactions) are verified.

Not quite. Every node in the system, not just a mining node, can verify a bock. To verify a block is not computationally expensive. However, mining is needed for creation of new blocks, to extend the blockchain.

For that miners has to perform simple calculations Nodes (Computers) does that for miners. The one who performs it the first gets the reward .
Each individual calculation is indeed relatively simple, but it takes an incredibly huge number of them to find the right solution. The miner who finds it first, gets the right to write the new block and collect the reward.



I have to say I'm far from the topic of bitcoin mining. But I have a question for you. You say the reward is for blocks. I. e. miners try to create one or several blocks from several computers so that the reward for the calculation is the same?
Or do I misunderstand?
Also, the question is, if my one computer (ASIC) is in a chain of other blocks, then how will I be rewarded?
jr. member
Activity: 182
Merit: 7
No noise. No hustle. Quiet as whisper. Comino.
September 26, 2018, 05:01:43 AM
#5
When I entered in the world of Bitcoin, the most difficult term I faced was mining. As far as I understood, it is basically a process through which blocks (that contains information about transactions) are verified. For that miners has to perform simple calculations Nodes (Computers) does that for miners. The one who performs it the first gets the reward .Thats how all the blocks got mined!
Correct me if I am wrong! And add for my further help



Dear friend! What is the main goal of your question? Do you want to understand the process and the basics? Or do you want to go deeper and start mining yourself?

Bitcoin has a digitally signed transactions record from a very scratch.. The block is an encrypted hash proof of work in a computer-intensive process. Miners use certain software that accesses their processing capacity to solve transaction-related algorithms. Algorithms are different for different crypto currencies.  In return, they are awarded a certain number of Bitcoins per block. The blockchain prevents attempts to spend a Bitcoin more than once - so that it can’t  be counterfeited by copy and paste.

To start mining yourself you will have to ask other questions and it is a different story.
member
Activity: 364
Merit: 10
September 25, 2018, 08:58:35 PM
#4
I understand mining is the actions you use your computer power (GPU or CPU computing power) to maintain operations of a blockchain and get back rewards in coins. The bigger power you have, the bigger rewards you receive.
full member
Activity: 434
Merit: 246
September 25, 2018, 11:44:18 AM
#3
As far as I understood, it is basically a process through which blocks (that contains information about transactions) are verified.

Not quite. Every node in the system, not just a mining node, can verify a bock. To verify a block is not computationally expensive. However, mining is needed for creation of new blocks, to extend the blockchain.

For that miners has to perform simple calculations Nodes (Computers) does that for miners. The one who performs it the first gets the reward .
Each individual calculation is indeed relatively simple, but it takes an incredibly huge number of them to find the right solution. The miner who finds it first, gets the right to write the new block and collect the reward.


sr. member
Activity: 490
Merit: 275
jr. member
Activity: 98
Merit: 2
September 25, 2018, 05:51:07 AM
#1
When I entered in the world of Bitcoin, the most difficult term I faced was mining. As far as I understood, it is basically a process through which blocks (that contains information about transactions) are verified. For that miners has to perform simple calculations Nodes (Computers) does that for miners. The one who performs it the first gets the reward .Thats how all the blocks got mined!
Correct me if I am wrong! And add for my further help

Jump to: