Bitcoin Forum
May 22, 2024, 09:28:10 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Understanding bitcoin mining  (Read 222 times)
tom22022 (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 8


View Profile
March 28, 2021, 06:19:37 PM
Merited by DdmrDdmr (2), Daniel91 (1), Welsh (1)
 #1

3 newb questions on bitcoin mining.

First, do all bitcoin miners, regardless of what pool they are attached to, mine the same single block?  For example, if a miner is solo or several miners are in a pool and the block is solved, do all miners everywhere in the world stop work and then start mining a new block (next in sequence), ie one block at a time?  Or can miners choose from a variety of blocks to mine?

Second, my layman's understanding of mining says that the input to create the hash is somewhat random? and largely based on the preceding attempts output hash.  For example, an output hash is generated and that output is then used as input for the next attempt by the miner.  Is this essentially correct?

Third, is the difficulty level based on the amount of leading zeros in the output hash?  For example if the bitcoin algorithm is calling for a high difficulty level, then the amount of preceding zeros required in the output hash is much higher, but if the algorithm is calling for a lower difficulty then the amount of preceding zeros in the output has is lower?

Thanks, just trying to understand how it works.
kano
Legendary
*
Offline Offline

Activity: 4508
Merit: 1819


Linux since 1997 RedHat 4


View Profile
March 28, 2021, 10:58:18 PM
Merited by hugeblack (2), DdmrDdmr (2), nc50lc (1)
 #2

First, do all bitcoin miners, regardless of what pool they are attached to, mine the same single block?  For example, if a miner is solo or several miners are in a pool and the block is solved, do all miners everywhere in the world stop work and then start mining a new block (next in sequence), ie one block at a time?  Or can miners choose from a variety of blocks to mine?
All miners mine the same block - though this is a problem that most don't understand - that you must indeed switch blocks as quickly as possible, when someone finds a block.
Running a home bitcoin and a home miner pointed at it, is much more likely to lose the block, than mining to a high performance pool.

Quote
Second, my layman's understanding of mining says that the input to create the hash is somewhat random? and largely based on the preceding attempts output hash.  For example, an output hash is generated and that output is then used as input for the next attempt by the miner.  Is this essentially correct?
https://kano.is/index.php?k=minedet

Quote
Third, is the difficulty level based on the amount of leading zeros in the output hash?  For example if the bitcoin algorithm is calling for a high difficulty level, then the amount of preceding zeros required in the output hash is much higher, but if the algorithm is calling for a lower difficulty then the amount of preceding zeros in the output has is lower?
Yes
See the bottom of the page I linked.

Pool: https://kano.is - low 0.5% fee PPLNS 3 Days - Most reliable Solo with ONLY 0.5% fee   Bitcointalk thread: Forum
Discord support invite at https://kano.is/ Majority developer of the ckpool code - k for kano
The ONLY active original developer of cgminer. Original master git: https://github.com/kanoi/cgminer
tom22022 (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 8


View Profile
March 28, 2021, 11:24:29 PM
 #3

First, do all bitcoin miners, regardless of what pool they are attached to, mine the same single block?  For example, if a miner is solo or several miners are in a pool and the block is solved, do all miners everywhere in the world stop work and then start mining a new block (next in sequence), ie one block at a time?  Or can miners choose from a variety of blocks to mine?
All miners mine the same block - though this is a problem that most don't understand - that you must indeed switch blocks as quickly as possible, when someone finds a block.
Running a home bitcoin and a home miner pointed at it, is much more likely to lose the block, than mining to a high performance pool.

Quote
Second, my layman's understanding of mining says that the input to create the hash is somewhat random? and largely based on the preceding attempts output hash.  For example, an output hash is generated and that output is then used as input for the next attempt by the miner.  Is this essentially correct?
https://kano.is/index.php?k=minedet

Quote
Third, is the difficulty level based on the amount of leading zeros in the output hash?  For example if the bitcoin algorithm is calling for a high difficulty level, then the amount of preceding zeros required in the output hash is much higher, but if the algorithm is calling for a lower difficulty then the amount of preceding zeros in the output has is lower?
Yes
See the bottom of the page I linked.

Thank you, will try and absorb that Smiley
tom22022 (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 8


View Profile
March 31, 2021, 01:36:01 PM
 #4

One more question regarding the block header.

Of all the 6 elements, is it the Block Time alone that guarantees everyone is working on a random hash?  To ask another way, if Block Time wasn't part of the header, would everyone be working on the same hash making it a contest of which miner is the fastest?
odolvlobo
Legendary
*
Offline Offline

Activity: 4326
Merit: 3234



View Profile
March 31, 2021, 03:08:44 PM
Merited by Welsh (6), DdmrDdmr (2)
 #5

First, do all bitcoin miners, regardless of what pool they are attached to, mine the same single block?  For example, if a miner is solo or several miners are in a pool and the block is solved, do all miners everywhere in the world stop work and then start mining a new block (next in sequence), ie one block at a time?  Or can miners choose from a variety of blocks to mine?

Every miner works on the next block, but the contents of the next block is different for each miner. Miners are free to choose which transactions to include and exclude from a block. Miners race to make their block the next block.

Second, my layman's understanding of mining says that the input to create the hash is somewhat random? and largely based on the preceding attempts output hash.  For example, an output hash is generated and that output is then used as input for the next attempt by the miner.  Is this essentially correct?

The input for the hash is the block "header", which contains information about the block. The header also contains the previous block's hash. This chain of hashes determines the sequence of the blocks and also is why it is called a block chain.

Third, is the difficulty level based on the amount of leading zeros in the output hash?  For example if the bitcoin algorithm is calling for a high difficulty level, then the amount of preceding zeros required in the output hash is much higher, but if the algorithm is calling for a lower difficulty then the amount of preceding zeros in the output has is lower?

No, that is a common misconception. While counting the number of leading zeros was mentioned in the whitepaper, Bitcoin was never implemented using that. In the actual implementation, the block's hash must be less than a "target" hash (compared as numbers) in order to qualify. The difficulty is computed from the target hash value (it is the inverse). It is used as a metric by people but it is not used by the protocol.

Of all the 6 elements, is it the Block Time alone that guarantees everyone is working on a random hash?  To ask another way, if Block Time wasn't part of the header, would everyone be working on the same hash making it a contest of which miner is the fastest?

The nonce field is also used for varying the hash. In fact, that is its only function.

In addition, the merkle root can be varied by modifying the contents of the block. Since the coinbase transaction pays a different address for each miner, its hash will be different for each miner, and thus the merkle root will be different for each miner, and the block's hash will be different for each miner even if everything else is the same.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
tom22022 (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 8


View Profile
March 31, 2021, 06:43:10 PM
 #6

Thanks everyone.

How many transactions can fit into a single block?  How does the miner decide which transactions will go into his mined block, is it automatic like an auction where the highest fees get in first?
pooya87
Legendary
*
Offline Offline

Activity: 3458
Merit: 10578



View Profile
April 01, 2021, 06:07:14 AM
Merited by DdmrDdmr (2)
 #7

One more question regarding the block header.

Of all the 6 elements, is it the Block Time alone that guarantees everyone is working on a random hash?  To ask another way, if Block Time wasn't part of the header, would everyone be working on the same hash making it a contest of which miner is the fastest?
Code:
Version --> has to be bigger than a certain value (currently >=4) but can be anything up to 4.2 billion
Previous Block Hash --> same for everyone
Merkle Root --> different for each miner depending on transactions in that block
Block Time --> different for each miner depending on miner's computers time and how often it is updated in header
Target --> same for everyone
Nonce --> different for each miner

How many transactions can fit into a single block?
There isn't exactly any tx count limit, the actual limit is the size (or weight) of the block (sum of all transactions' weight). So the block can contain a single transaction that fills its entire size (1 MB) or 2 with a total of 4MB weight, or it can have thousands of smaller ones each taking smaller space to a total of 4 MB weight. Usually blocks are full and contain around 2000 transactions.

Quote
How does the miner decide which transactions will go into his mined block, is it automatic like an auction where the highest fees get in first?
Mostly based on fees, meaning they prefer transactions that pay them more so they can increase their profit.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
tom22022 (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 8


View Profile
April 01, 2021, 06:18:42 PM
 #8

3 newb questions on bitcoin mining.

First, do all bitcoin miners, regardless of what pool they are attached to, mine the same single block?

Nope, each pool is free to include into candidate block any unconfirmed  transaction from its mempool. At any time the content of candidate block   which miners  mine depends on the pool. There is competition between miners attached to   different  pool in solving cryptographic puzzle for their own  candidate blocks.

Thank you!  You uncovered 3 more questions lol, hope you don't mind Smiley

The amount in mempool is manually adjustable?

10 minutes later when the next block is mined, are outstanding transactions prohibited from going into the previous block if there is still room?

How will transactions be recorded after the last block is mined in 2140?
pooya87
Legendary
*
Offline Offline

Activity: 3458
Merit: 10578



View Profile
April 02, 2021, 03:24:52 AM
 #9

The amount in mempool is manually adjustable?
Mempool is the pool of transaction in each bitcoin full node's memory (RAM). Depending on how much memory they have available or want to dedicate to their full node the size of it can be different. Normally they set it to a value that can contain all transactions most of the time, but it can change to bigger or smaller value. When it is smaller they usually drop low fee transactions and only keep the high paying ones that have a higher chance of being confirmed.

Quote
10 minutes later when the next block is mined, are outstanding transactions prohibited from going into the previous block if there is still room?
When the block is found it can no longer be modified otherwise it will change the third field called "Merkle Root" and make the block invalid.

Quote
How will transactions be recorded after the last block is mined in 2140?
The same way they are today assuming Bitcoin protocol doesn't change in 100 years from now.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
odolvlobo
Legendary
*
Offline Offline

Activity: 4326
Merit: 3234



View Profile
April 02, 2021, 09:35:41 AM
 #10

How will transactions be recorded after the last block is mined in 2140?

That is another common misconception. Mining does not stop in 2140. The subsidy is reduced to by half every 4 years approximately (the "halving"), and it will be reduced to 0 by the year 2140, and block rewards after that will consist of only transaction fees.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
tom22022 (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 8


View Profile
April 02, 2021, 04:54:47 PM
 #11

This is all good stuff, thank you everyone!
Minajx
Newbie
*
Offline Offline

Activity: 16
Merit: 2


View Profile
April 03, 2021, 07:33:23 AM
 #12

Please what are this basis for bitcoin mining, what is it all about
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!