Author

Topic: A basic question about how a Node finds a block (Read 153 times)

newbie
Activity: 7
Merit: 0
I was wondering what a miner does during the Ming process,
1. This is preceded by a small random number from the network target, transmitted to other nodes, and then a transaction from Pool or
2. is added. Broadcast a hash and other nodes smaller than the network target?
newbie
Activity: 7
Merit: 0
I just want to add that if the miners increased the transaction after getting the correct hash then the block will not be considered irreversible and in future anyone could change the transaction in this block and bitcoin like this Was not safe
The whole point of mining (proof of work) is that after doing "expensive work" the end result will not change.
legendary
Activity: 4466
Merit: 3391
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.
legendary
Activity: 2352
Merit: 6089
bitcoindata.science
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://bitcointalksearch.org/topic/summary-of-proof-of-work-3317586

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/
legendary
Activity: 2128
Merit: 1293
There is trouble abrewing
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.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
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.
member
Activity: 100
Merit: 30
Stay humble, be cool, make world better place.
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?
Jump to: