Bitcoin Forum
April 26, 2024, 05:06:04 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Questions behind mining  (Read 1078 times)
BarsMonster (OP)
Newbie
*
Offline Offline

Activity: 39
Merit: 0



View Profile
June 16, 2011, 05:53:13 PM
 #1

As far as I see, the basic idea of mining, is that we get piece of data, where we need to try all variants of 4 specific bytes = 2^32 variants, we hash this data using SHA256 and if we get value meeting our difficulty requirements we "win"(?)

I wonder how does this work on lower level:

1) How it's made that different clients does not work on the same variants?
2) How it is prevented that client who found solution would "steal" 50BTC, instead of submitting solution to the pool server?
3) How does pool software process this solution to get 50BTC and notify whole system that everyone (including other pools & individuals) need to work on next block?
4) Is that correct that all fees associated with newly generated solution are "payed" to the owner of this solution in the nearest minutes after it's generation?

Sorry for dumb questions, and thanks :-)
"If you don't want people to know you're a scumbag then don't be a scumbag." -- margaritahuyan
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714107964
Hero Member
*
Offline Offline

Posts: 1714107964

View Profile Personal Message (Offline)

Ignore
1714107964
Reply with quote  #2

1714107964
Report to moderator
Forp
Full Member
***
Offline Offline

Activity: 195
Merit: 100


View Profile
June 17, 2011, 08:12:18 PM
 #2

I wonder how does this work on lower level:

Me too. Lets try to help each other. Not sure if all my answers are correct, but I will try...

1) How it's made that different clients does not work on the same variants?

I think this depends on the pool server, handing out different shares to the miners. Maybe you get some info on this at the mining part of the forum or at some good pool.

2) How it is prevented that client who found solution would "steal" 50BTC, instead of submitting solution to the pool server?

To the extent I understand this: You only need an already prehashed part of the block to mine, but the entire block to claim the bounty. Pool server has the block; miner only has the prehashed part. This might be wrong; I am still trying to understand this myself.

3) How does pool software process this solution to get 50BTC and notify whole system that everyone (including other pools & individuals) need to work on next block?

The pool software gets the value of the nonce and then can complete the block, relaying it to all other nodes.

4) Is that correct that all fees associated with newly generated solution are "payed" to the owner of this solution in the nearest minutes after it's generation?

Payed? Actually by solving the block the block solver becomes already owner of the transaction which grants the money to him. It will take a while until other blocks are found and the chain becomes longer - and this can be trusted.

gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
June 17, 2011, 08:33:51 PM
 #3

As far as I see, the basic idea of mining, is that we get piece of data, where we need to try all variants of 4 specific bytes = 2^32 variants, we hash this data using SHA256 and if we get value meeting our difficulty requirements we "win"(?)

I wonder how does this work on lower level:

1) How it's made that different clients does not work on the same variants?
2) How it is prevented that client who found solution would "steal" 50BTC, instead of submitting solution to the pool server?
3) How does pool software process this solution to get 50BTC and notify whole system that everyone (including other pools & individuals) need to work on next block?
4) Is that correct that all fees associated with newly generated solution are "payed" to the owner of this solution in the nearest minutes after it's generation?

Sorry for dumb questions, and thanks :-)

(1) There are 640 bits of input— the whole block header. It includes a version number, a timestamp, the hash of the prior block, the hash of the hashes of the the transactions, and the 32bit part you sweep (the nonce).    Most work doesn't have any solutions at all. You can think of the whole process as throwing dice. (yes, the hash is deterministic, but no two throws will ever be the same).    Inside the coinbase txn there is an extra nonce value where the creator of the block header can increment some more (e.g. if it needs more candidate blocks than the timestamp resolution * nonce space would allow for).

(this is, e.g. why mining isn't a race, everyone is working on something completely different and someone else solving a block doesn't throw out the work you did, or prevent you from solving one)

(2) The solution is bound to the identity of the key that gets paid the 50btc via the included hash. Change the payment address and you'd invalidate your solution.

(3) Imagine you are throwing dice the pool has given you. The dice have the pools name written on them.  You throw and throw. A throw of 1 solves the block. The pool asks you to report any throws you get <=3, you do this and it proves you are working. Sometimes your <=3 throw is a 1 and the pool announces it to the world.   Everyone else can trivially see that the "throw" is the required value, so they treat that solution as good (by running the hash once) and continue building the next block in the chain after it.  They simply announce it to all the bitcoin nodes they're talking to, who announce it to all their peers, and so on.

(4)  No. It's not award minutes after, it's 'awarded'  either "instantly" or "after several hours" depending on how you want to look at it.  When the block is formed all the transactions are groomed up, any time the inputs to a TXN are greater than their outputs in value the excess is the fee.   The miner adds this fee to the 50BTC the network rules allow them to create out of thin air, and specify it in the coinbase transaction (called 'generated' in most software) that transaction specifies that the funds be paid to a key they hold.   So it's an instant thing.    Alternatively,  the network won't let you spend from a generated txn until it is at least 100 blocks old— this is to avoid massive drama should their be a long chain split an the block not end up as part of the longest chain. If block ends up being excluded from the longest chain all spends originating in the coin made in that block would be invalidated. So the fees (and the reward) are only paid, or at least only available to be spent, until many hours later.











lmontrose
Full Member
***
Offline Offline

Activity: 168
Merit: 100


View Profile
June 19, 2013, 01:07:15 AM
 #4

As far as I see, the basic idea of mining, is that we get piece of data, where we need to try all variants of 4 specific bytes = 2^32 variants, we hash this data using SHA256 and if we get value meeting our difficulty requirements we "win"(?)

I wonder how does this work on lower level:

1) How it's made that different clients does not work on the same variants?
2) How it is prevented that client who found solution would "steal" 50BTC, instead of submitting solution to the pool server?
3) How does pool software process this solution to get 50BTC and notify whole system that everyone (including other pools & individuals) need to work on next block?
4) Is that correct that all fees associated with newly generated solution are "payed" to the owner of this solution in the nearest minutes after it's generation?

Sorry for dumb questions, and thanks :-)

I hope we get more input into this as I am also interested in finding out.
wabber
Member
**
Offline Offline

Activity: 85
Merit: 10


View Profile
June 20, 2013, 07:59:55 AM
 #5

As far as I see, the basic idea of mining, is that we get piece of data, where we need to try all variants of 4 specific bytes = 2^32 variants, we hash this data using SHA256 and if we get value meeting our difficulty requirements we "win"(?)

The basic idea of mining is that you proof that you did something. Actually you don't do anything useful while mining you don't solve any problems or anything. You are just doing something where you may get result which others can verify and see how difficult it was to get (on average). That's needed because if we didn't have that mechanism anyone could create thousands of blocks per second and the blockchain would be useless.

That's accomplished by hashing data. Hashing functions are rather complicated. Just think of it as a machine that will take data and give you a fixed length result. If you give the machine the same input again it will give you the same output again. We are unable to compute the input from the output  of a hashing function (at least if it's a good one like SHA256).

Let's say a block only contains some transactions, the bitcoin address of the one that gets paid the block reward and some random data for the sake of simplicity.

A block is considered a valid block if it's hash is lower than a certain value determined by the current difficulty.

Now let's get back to your understanding:

We don't need to try all variants of 4 specific bytes. We can change as much data in the block as we want, and we don't have to go through everything. No need to try 1 then 2 then 3 then 4 etc.
You can change the nonce, the extra nonce you can add more transactions or you could change the payout address to change the hash since that's all part of the input that goes to the hash function. Usually the nonce/extra nonce are increased until a solution is found, but you don't have to do it like that.

1) How it's made that different clients does not work on the same variants?

Well if you're solo mining you don't mind, since you are using your very own payout address so other people are giving another input to the hashing function even if they use the same nonce.
But what if someone tried that very combination already somehow?
That's so unlikely that we don't consider it as a possibility. Think about you going out of your home with your shovel and you teleport yourself to a random planet in the universe to a random spot on that planet. How likely is it that someone else dug there already? It's pretty much the same with your bitcoin block.

If you are mining in a pool the pool gives you the work and it can give you a certain nonce range or it could give every member another payout address (which is still owned by the pool) or it could add extra transactions to every member. Get creative Smiley

2) How it is prevented that client who found solution would "steal" 50BTC, instead of submitting solution to the pool server?

Imagine you found a solution a solution. Now you change the payout address in the block to get the btcs for yourself. Now you have changed the block and therefore the input of the hash function -> you're solution doesn't fit to that input anymore -> it's an invalid block

3) How does pool software process this solution to get 50BTC and notify whole system that everyone (including other pools & individuals) need to work on next block?

You submit solutions to a pool which aren't real ones. They are easier to get but you still give them to the pool to proof that you are working. Actually they are useless it's only to proof that you should get something if anyone else finds a real block.
If someone finds a real block (it contains the payout address of the pool and the user is unable to change it see question 2) he can send it directly to the bitcoin network or the pool which will send it to the network. That block will earn the pool a reward which it will distribute to all the pool members according to how much easier shares the pool got from every member (that's why those shares are needed, they don't have any value but to show the pool that a member deserves something)

4) Is that correct that all fees associated with newly generated solution are "payed" to the owner of this solution in the nearest minutes after it's generation?

It's payed to the payout address contained in the block. That address doesn't have to be the address of the solver it could also be your grandma's or some address you found on the internet. If that sounds stupid to you, that's exactly how the reward in pooled mining goes to the pool see question 3.

I have to go now so I'm unable to check my post for typos etc.
srry Shocked

I hope it's useful to you though.
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!