Bitcoin Forum
November 09, 2024, 07:56:25 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Who creates a block?  (Read 549 times)
Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1030


give me your cryptos


View Profile
December 06, 2015, 11:01:21 AM
 #1

Hey guys, I'm kind of puzzled with how bitcoin works. I know how mining works, by computers guessing numbers until they get the right one, but who creates the block, the 'problem' to solve? And if one person makes it, are they allowed to nine the block? How does the bitcoin system prevent this guy from doing so?

looking for a signature campaign, dm me for that
Meuh6879
Legendary
*
Offline Offline

Activity: 1512
Merit: 1012



View Profile
December 06, 2015, 11:21:15 AM
 #2

Miners.


Like here : http://p2pool.in/ ( http://minefast.coincadence.com/p2pool-stats.php )
ranochigo
Legendary
*
Offline Offline

Activity: 3038
Merit: 4420


Crypto Swap Exchange


View Profile
December 06, 2015, 01:15:36 PM
 #3

Hey guys, I'm kind of puzzled with how bitcoin works. I know how mining works, by computers guessing numbers until they get the right one, but who creates the block, the 'problem' to solve?
Miners solve the blocks.

Bitcoin or a mining pool assembles the transaction in a random order and calculates the merkle root to be used in the block header. The miners can choose to not include any transaction and hence the merkle root would only be the coinbase(reward) transaction, currently 25BTC. The rest of the header is added with the block version, previous block header hash, time, nbits and nonce. It is then repeatedly hashed. The nonce is increased for every attempt till the hash of header is lower than or equal to the target or if someone else have mined a block or you have exhausted your nonce and haven't found a block. You then need to change some variables in the block header.
And if one person makes it, are they allowed to nine the block?
Yes. As long as the block follows the rules, the honest nodes would accept it as valid unless a longer chain is accepted in the future which does not include that particular block. It would then be orphaned.
How does the bitcoin system prevent this guy from doing so?
In pool mining, the miner is assigned a work to do. If the miner finds a block and broadcast, the reward would still go to the pool itself. The address is already specified in the coinbase. If the miner changes it, the block would be invalid since the entire hash would change.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
teukon
Legendary
*
Offline Offline

Activity: 1246
Merit: 1011



View Profile
December 06, 2015, 01:32:17 PM
 #4

Hey guys, I'm kind of puzzled with how bitcoin works. I know how mining works, by computers guessing numbers until they get the right one, but who creates the block, the 'problem' to solve? And if one person makes it, are they allowed to nine the block? How does the bitcoin system prevent this guy from doing so?

In rough terms:
The guy that solves one problem gets to set the next problem.  In fact, his solution is the next problem and he's free to try and build on it.  Each block is both a problem and a solution and they naturally form a chain.   Satoshi set the first problem on Jan 3rd, 2009.
Amph
Legendary
*
Offline Offline

Activity: 3248
Merit: 1070



View Profile
December 06, 2015, 02:30:11 PM
 #5

it must be said that the first block, the genesis block was different, was there since the beginning, was not created by the same procedure of the other block, injected from the client, hardcoded in it
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4832



View Profile
December 06, 2015, 04:14:14 PM
 #6

Miners.

Correct.  Or mining pool operators.

More specifically the software that is being run by solo miners and mining pool operators.

ranchigo is pretty close with his explanation.

Each solo miner, and each mining pool operator builds their own block to work on.  The block is has to meet certain requirements or the rest of the network will simply ignore it.  As long as it meets all the necessary requirements, anyone can create their own block and then work on solving it.

The order of the transactions in a block isn't entirely random, but the solo miners and mining pool operators are allowed to select whichever unconfirmed transactions they would like to include in the block as long as the inputs to the transactions are either already confirmed or are included earlier in their list.  The total size of the block is not allowed to exceed 1 megabyte.  The block MUST include at least 1 transaction (the generation transaction that pays the newly created bitcoins as a block reward, sometimes known as a "coinbase" transaction).

As ranchigo stated, the software being run by the solo miner (or mining pool operator) chooses an order for the transactions and builds a merkle tree. The merkle root is unique for that specific selection and order of transactions.  Any other selection or any other order (or any different generation transaction) will result in a completely different merkle root.

Then the software run by the solo miner (or mining pool operator) builds an 80 byte block header.  The header consists of:

  • A 4 byte block version number
  • The 32 byte double-SHA256 hash of the previous header
  • The 32 byte SHA256 merkle root of the transaction list
  • A 4 byte timestamp
  • 4 bytes representing the current mining difficulty
  • A 4 byte nonce

As you can hopefully see, since each solo miner (or mining pool operator) will pay the block reward to themselves, they will each have a different generation transaction.  This means that they will each have a different merkle root, and therefore they are each working on completely different blocks.

They each repeatedly hash their 80 byte block header and check to see if the resulting hash value is lower than the current difficulty target.  If it is, they broadcast their block to all their peers.  Each peer validates that the block they just received meets all the consensus requirements and then relays the block to their peers.  The block continues to be validated and then relayed by every node that that receives it until the entire network is aware of the new block.

If the hash of the block is NOT lower than the current difficulty target, then the miner increments the nonce and tries again.  They keep doing this until they either find a low enough hash value or they run out of nonce values (a 4 byte nonce has 4,294,967,295 possible values. If they run out of nonce values, then the software run by the solo miner (or mining pool operator) needs to find some other way to modify the 80 byte header.  Since the version number, previous block hash, and difficulty can't be changed without ending up with an invalid block, the software will typically either modify the timestamp or modify the transaction list and generate a new merkle root.

Eventually someone somewhere ends up with a valid block header that hashes to a value lower than the current target.  When any solo miner (or mining pool operator) receives a block from a peer, they verify that the entire block is valid.  If it is, then they add it to their own blockchain and relay it to all their peers. Then they remove from their own list of unconfirmed transactions any transactions that were in that block that they received. They then build a new transaction list, a new merkle root, and a new block header with the new hash from the block that they just received and they start the whole solving process all over again.
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!