Bitcoin Forum
April 25, 2024, 01:42:27 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: A basic question about how a Node finds a block  (Read 128 times)
10_sjdovn_10 (OP)
Member
**
Offline Offline

Activity: 100
Merit: 30

Stay humble, be cool, make world better place.


View Profile
April 07, 2021, 02:31:55 PM
Merited by bitmover (1)
 #1

Hello, i had a question, it's about work process of a miner,
I was wondering what does a miner do during minig process,  1. It first finds a random number smaller than network target, broadcast it's wining to other nodes then adds transactions from pool or 2. It first adds transactions to the block until finds a valid hash smaller than network target and broadcast ot other nodes ?
Which information is neede as input of hash function (specially Nonce) ?
What other miners do in the next 10 minute until finding new hash puzzel?
1714009348
Hero Member
*
Offline Offline

Posts: 1714009348

View Profile Personal Message (Offline)

Ignore
1714009348
Reply with quote  #2

1714009348
Report to moderator
1714009348
Hero Member
*
Offline Offline

Posts: 1714009348

View Profile Personal Message (Offline)

Ignore
1714009348
Reply with quote  #2

1714009348
Report to moderator
BitcoinCleanup.com: Learn why Bitcoin isn't bad for the environment
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714009348
Hero Member
*
Offline Offline

Posts: 1714009348

View Profile Personal Message (Offline)

Ignore
1714009348
Reply with quote  #2

1714009348
Report to moderator
ranochigo
Legendary
*
Offline Offline

Activity: 2954
Merit: 4163


View Profile
April 07, 2021, 03:22:07 PM
Merited by o_e_l_e_o (2), NeuroticFish (1), ABCbits (1), bitmover (1), BrewMaster (1)
 #2

A node doesn't find a block, miners do but miners can be using a node as a source for the information and to propagate their blocks.

Generally, mining involves double hashing the block headers to find a hash the satisfies the target. The block header contains a few elements (block version, previous block hash,  merkle root hash, nonce, timestamp, target, etc) and they are concatenated together to form a string which is then hashed twice, SHA256(SHA256(Blockheader)). The miners will determine the coinbase transaction as well as the transactions that they wish to include and create the merkle root. Afterwards, they'll hash it to form the hash of the block header and check if it satisfies the target. If it doesn't they will increment the nonce/extranonce and try again until they're able to generate a block header hash that meets the target.


Transactions that are included in a block are determined prior to the hashing, they cannot be added after the block is found.

The nonce is an arbitrary variable that is changed in order to be able to generate a different hash every time. It doesn't have to be determined as the user.

The miners are always mining, when a new block is found and propagated, they will reassemble a set of transactions (as some of the transactions may have already been included in the block) and change the previous block hash as well. Bitcoin mining is not a puzzle, despite what people make it out to be.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
BrewMaster
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
April 07, 2021, 04:34:47 PM
 #3

i just want to add that if miners could add transactions after they found the correct hash then the block would not be considered immutable and in the future anyone could change the transactions in that block and bitcoin wouldn't have been safe that way.
the whole point of mining (proof of work) is that after the "expensive work" was performed the final result wouldn't be changeable.

There is a FOMO brewing...
bitmover
Legendary
*
Online Online

Activity: 2282
Merit: 5883


bitcoindata.science


View Profile WWW
April 07, 2021, 04:56:44 PM
 #4

Hello, i had a question, it's about work process of a miner,
I was wondering what does a miner do during minig process,  1. It first finds a random number smaller than network target, broadcast it's wining to other nodes then adds transactions from pool or 2. It first adds transactions to the block until finds a valid hash smaller than network target and broadcast ot other nodes ?
Which information is neede as input of hash function (specially Nonce) ?
What other miners do in the next 10 minute until finding new hash puzzel?
Just to complement previous answers
You are basically asking how proof of work(pow) work.

I made a brief summary about it here:

https://bitcointalk.org/index.php?topic=3317586.0

Blockchain

The idea proposed by Satoshi is to register transactions on a block. When the proof of work solution for that block is found, it is hashed. Each block includes the previous block’s hash, forming a chain of blocks (blockchain), and each additional block reinforcing the ones before it.



Because of that process, if any transaction in a past block is changed the output hash will be different.
When you make a Bitcoin transaction and you see that you have 5 confirmations, that means that 5 blocks were mined after that transaction. A transaction with 6 confirmations is considered irreversible.

Proof of Work

In the Blockchain, all transactions are publicly announced to all nodes, as there is no central authority who validate transactions.

Proof of Work is an algorithm that rewards participants who solve a cryptographic puzzle in order to validate transactions and create new blocks (this process in known as mining).
This puzzle consists in scanning for a value (called Nonce) that when hashed together with thr block data, the hash begins with a number of zeros.



In this website you can see how this process works. You can try to find a Nonce that when hashed generates a hash that start with 0000 on your own. You will see that it is hard, unless you are very lucky. And you are going to be lucky twice in row, if you do go to a casino or something like that lol.

The difficult in finding that nonce increases exponentially as more zeros are required by the block. Difficult is adjusted every 2016 blocks, based on the average hashrate of those past 2016 blocks, so that 2016 blocks are mined every two weeks. (So a block is mined every 10 minutes)

Miners only get their reward if they are mining the longest chain, as it has the greatest processing power invested. If the honest nodes control the majority processing power, the honest chain will always be the longest and will outpace attacker’s chain.

To modify a past transaction the attacker would have to redo the PoW of the block and all subsequent blocks, and outpace the honest chain. For this to happen, the attacker’s would need more processing power than the honest chain, also known as 51% attack.

Quote from: Satoshi in Bitcoin whipepaper
The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power. 


Source: bitcoin whitepaper. Images from: https://nakamotoinstitute.org/bitcoin/

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

Activity: 4298
Merit: 3208



View Profile
April 12, 2021, 03:54:58 AM
 #5

Hello, i had a question, it's about work process of a miner,
I was wondering what does a miner do during minig process,  1. It first finds a random number smaller than network target, broadcast it's wining to other nodes then adds transactions from pool or 2. It first adds transactions to the block until finds a valid hash smaller than network target and broadcast ot other nodes ?
Which information is neede as input of hash function (specially Nonce) ?
What other miners do in the next 10 minute until finding new hash puzzel?

It is essentially #2.

The block "header" is hashed. The header contains information about the transactions in the block and other information, including a nonce.

The miner constructs a block and then hashes the block header, changing the nonce and other information in the header, until a hash is found that is less than the target. When none of the direct changes to the header result in a winning hash, the block is modified so the header is changed, and hashing continues as before.

All miners are doing the same thing at the same time, but the contents of their blocks, and thus their block headers, and thus their hashes are guaranteed to be different.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
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!