Author

Topic: Bitcoin branch - multiple blocks (Read 230 times)

jr. member
Activity: 60
Merit: 2
March 23, 2018, 04:31:56 PM
#14

maybe I didn't explain good enough... I meant that difficulty X is being adjust so that we have a block etc. every ten minutes... I understand that...  but when ALL bitcoins are mined.. blocks still need to be created so that miners can put transactions in them... those blocks, again, have to get a name...that "name" is the result of the mining process... but if "naming" of the block is still  "difficult" (costing too much energy or CPU cycles) then the price for transaction fees must be very high so that ex miners would still have incentive to "package" transactions... right or wrong?

1.) Reducing the difficulty exponentially makes it easier to find blocks. Ironically that actually increases the probability of forks since with a lowered difficulty it is easier to find blocks.

2.). The high difficulty of the bitcoin blockchain is a result of its massive hashrate.
This actually secures the network by making it hard for an attacker to rewrite the chain.

So if the difficulty is consistently low (compared to what it is now) it means that the hashrate of the network isn't nearly as high which means it'll be easier to attack the blockchain.

3.) There are plans for secondary off chain solutions like the Lightning Network which removes many transactions from the base layer so there are less transaction fees overall.

4.) The distribution of bitcoin supply is not expected to end until 2140, so there's still more than a hundred years to figure something out. A lot will have changed by then.


1 & 2 was exactly what I was "thinking"... but as you said, who know what will happen by 2140.

thank you once again!  i will check the impact of lightning network now...
sr. member
Activity: 322
Merit: 363
39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD
March 23, 2018, 04:00:36 PM
#13

maybe I didn't explain good enough... I meant that difficulty X is being adjust so that we have a block etc. every ten minutes... I understand that...  but when ALL bitcoins are mined.. blocks still need to be created so that miners can put transactions in them... those blocks, again, have to get a name...that "name" is the result of the mining process... but if "naming" of the block is still  "difficult" (costing too much energy or CPU cycles) then the price for transaction fees must be very high so that ex miners would still have incentive to "package" transactions... right or wrong?

1.) Reducing the difficulty exponentially makes it easier to find blocks. Ironically that actually increases the probability of forks since with a lowered difficulty it is easier to find blocks.

2.). The high difficulty of the bitcoin blockchain is a result of its massive hashrate.
This actually secures the network by making it hard for an attacker to rewrite the chain.

So if the difficulty is consistently low (compared to what it is now) it means that the hashrate of the network isn't nearly as high which means it'll be easier to attack the blockchain.

3.) There are plans for secondary off chain solutions like the Lightning Network which removes many transactions from the base layer so there are less transaction fees overall.

4.) The distribution of bitcoin supply is not expected to end until 2140, so there's still more than a hundred years to figure something out. A lot will have changed by then.
jr. member
Activity: 60
Merit: 2
March 23, 2018, 03:05:22 PM
#12

Quote
The Coinbase transaction includes the transaction fees for all the transactions in the block, plus the block subsidy.
However, if a miner mines an empty block (a block without any other transactions apart from the Coinbase transaction -- for a block to be valid, the Coinbase transaction must always be present), then the Coinbase transaction contains only the block subsidy.
For example in this block you can see that the block had fees of 0.4739BTC and if you check the Coinbase transaction you can see that the output of the transaction is 12.9739BTC which is the block subsidy of 12.5BTC + the total transaction fees of ~0.4739BTC
Compare it to the first block that Satoshi mined that had no other transactions.
You can clearly see that the Coinbase transaction only has an output of 50BTC (which was the block subsidy at that time)

Thank you for a very precise answer Smiley so, the part I was missing was that coinbase includes the transaction fees, and the miner will receive that fee after "maturity" time expires.

Is there a crypto technoogy that solved the problem of waiting such a long time to be "sure" the transaction is "safe?

Also, when all of the blocks were mined, and miners will have to make a business model based only on transaction fees (currently as I see it it is all/monstly about block reward).... how will the miners pack the transactions - will the "dificulty" be set to a very high number so basically each "try" will generate a new block (he will not get the reward), and the coinbase transaction will only include fees? If this is the way it will happen, then there will be a higher possibility of forking (because every miner would generate a block very quickly) - right?

The difficulty can't be left as it is, because no-one wold spend a lot of energy/cpu just to collect small amount of fees....

tnx!



There are few alternatives such as Uncle block in Ethereum where miners who mine orphaned block still can get reward and miners who give info about orphaned block also get smaller reward. But it comes with risk more coins mined, might increase maximum coin cap and can be abused by miners.

Oh, tnx!


The "difficultly" is automatically adjust every 2016 blocks (or about 2 weeks) based on network/total mining hasharete, so it won't any different with today since and even if multiple miners mine a block at similar time, the block with "longest" chain will be confirmed and others treated as orphan block and fork/chain-split won't happen.

I explained my question in previous comment (I guess I didn't explain my question good enough)...Smiley check my comment please and let me know what is wrong in my "thinking"...
jr. member
Activity: 60
Merit: 2
March 23, 2018, 03:03:40 PM
#11



Is there a crypto technoogy that solved the problem of waiting such a long time to be "sure" the transaction is "safe?
It's not a "problem" per se.
It's a feature, not a bug.
Like I said earlier, transaction confirmation/finalisation in POW coins is probabilistic, not deterministic.
Each confirmation increases the probability that a block that includes a transaction will not be overwritten by another due to a double spend, 51% attack or blockchain reorganisation.

Quote
Also, when all of the blocks were mined, and miners will have to make a business model based only on transaction fees (currently as I see it it is all/monstly about block reward).... how will the miners pack the transactions
I reckon it will still be the same on the protocol level.
In this case, the Coinbase transaction will only include the transaction fees.

Quote
will the "dificulty" be set to a very high number so basically each "try" will generate a new block (he will not get the reward), and the coinbase transaction will only include fees? If this is the way it will happen, then there will be a higher possibility of forking (because every miner would generate a block very quickly) - right?
That's not how mining works.
The difficulty has nothing to do with the block reward but adjusts itself every 2016 blocks to the median hashrate of the network.
Also, not every "try" generates a block, which is why (bitcoin) mining is competitive.
The bitcoin network has a collective hashrate of 24,785,843,885 GigaHashes per second.
1 GH/s =  1 000 000 000 hashes per second
Do the math to see how many trials to create a block goes on in the bitcoin blockchain every second.



maybe I didn't explain good enough... I meant that difficulty X is being adjust so that we have a block etc. every ten minutes... I understand that...  but when ALL bitcoins are mined.. blocks still need to be created so that miners can put transactions in them... those blocks, again, have to get a name...that "name" is the result of the mining process... but if "naming" of the block is still  "difficult" (costing too much energy or CPU cycles) then the price for transaction fees must be very high so that ex miners would still have incentive to "package" transactions... right or wrong?
sr. member
Activity: 322
Merit: 363
39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD
March 23, 2018, 12:16:03 PM
#10



Is there a crypto technoogy that solved the problem of waiting such a long time to be "sure" the transaction is "safe?
It's not a "problem" per se.
It's a feature, not a bug.
Like I said earlier, transaction confirmation/finalisation in POW coins is probabilistic, not deterministic.
Each confirmation increases the probability that a block that includes a transaction will not be overwritten by another due to a double spend, 51% attack or blockchain reorganisation.

Quote
Also, when all of the blocks were mined, and miners will have to make a business model based only on transaction fees (currently as I see it it is all/monstly about block reward).... how will the miners pack the transactions
I reckon it will still be the same on the protocol level.
In this case, the Coinbase transaction will only include the transaction fees.

Quote
will the "dificulty" be set to a very high number so basically each "try" will generate a new block (he will not get the reward), and the coinbase transaction will only include fees? If this is the way it will happen, then there will be a higher possibility of forking (because every miner would generate a block very quickly) - right?
That's not how mining works.
The difficulty has nothing to do with the block reward but adjusts itself every 2016 blocks to the median hashrate of the network.
Also, not every "try" generates a block, which is why (bitcoin) mining is competitive.
The bitcoin network has a collective hashrate of 24,785,843,885 GigaHashes per second.
1 GH/s =  1 000 000 000 hashes per second
Do the math to see how many trials to create a block goes on in the bitcoin blockchain every second.

jr. member
Activity: 60
Merit: 2
March 23, 2018, 11:19:05 AM
#9

[/quote]
The Coinbase transaction includes the transaction fees for all the transactions in the block, plus the block subsidy.
However, if a miner mines an empty block (a block without any other transactions apart from the Coinbase transaction -- for a block to be valid, the Coinbase transaction must always be present), then the Coinbase transaction contains only the block subsidy.
For example in this block you can see that the block had fees of 0.4739BTC and if you check the Coinbase transaction you can see that the output of the transaction is 12.9739BTC which is the block subsidy of 12.5BTC + the total transaction fees of ~0.4739BTC
Compare it to the first block that Satoshi mined that had no other transactions.
You can clearly see that the Coinbase transaction only has an output of 50BTC (which was the block subsidy at that time)
[/quote]

Thank you for a very precise answer Smiley so, the part I was missing was that coinbase includes the transaction fees, and the miner will receive that fee after "maturity" time expires.

Is there a crypto technoogy that solved the problem of waiting such a long time to be "sure" the transaction is "safe?

Also, when all of the blocks were mined, and miners will have to make a business model based only on transaction fees (currently as I see it it is all/monstly about block reward).... how will the miners pack the transactions - will the "dificulty" be set to a very high number so basically each "try" will generate a new block (he will not get the reward), and the coinbase transaction will only include fees? If this is the way it will happen, then there will be a higher possibility of forking (because every miner would generate a block very quickly) - right?

The difficulty can't be left as it is, because no-one wold spend a lot of energy/cpu just to collect small amount of fees....

tnx!

sr. member
Activity: 322
Merit: 363
39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD
March 23, 2018, 10:30:48 AM
#8

1) Both miners included the same transaction from their mempool, both mind the block in the same time, both blocks are on blockchain (until one block "dies").
So basically, I can create two transactions, one that references "first" duplicate transaction, and the second that references the "second"? (in theory of course)
It's called a block CHAIN: there can only be ONE valid chain.
The other chain will become orphaned (the chain with less proof of work)
That's why you're told to wait for x confirmations (usually 6),
A "confirmation" means that a miner has built upon the tip of that particular block, and the more confirmations a transaction has, the more secure it is.
After a few confirmations you can be rest assured that there was no double spend.
Quote
2) I could "spend" first transaction, and that block could be cancelled (because it ends up in the "dead chain) and my transaction "terminated" - but I already received goods for that transaction and the "retailer" lost his money? Right or wrong?
That's the thing though; you can't know which block will be orphaned unless you're the miner that mined (both) the transaction.
When a block is orphaned, its transactions will be anulled and added back to "the" mempool of unconfirmed transactions, and since there's a conflicting UTXO that has been spent, that transaction will never make it into a block.
So it's equally possible that in the event of a reorg, that your payment to the merchant will be in the valid block, and your double spend attempt will be orphaned.

But theoretically, if your double spend transaction was included in the valid block and the other transaction that paid the retailer was in the orphaned block and the retailer already released the goods, then yes, the retailer lost the bitcoin you were supposed to pay.

Which is why you're required to wait for a certain amount of confirmations before you accept a transaction as valid, depending on your risk exposure -- or aversion.
The higher the risk, the more confirmations you need to wait for.
A merchant selling gift cards or so can even accept 0 confirmations even though it isn't secure because his risk isn't high.
However, someone selling a house worth millions of dollars can choose to wait for 144 blocks (~ 1 day) because the probability of a chain reorg that deep is negligible.
Although there isn't deterministic finality in bitcoin transactions, the probability of a chain reorg or rewrite reduces exponentially as the number of confirmations increase.
Quote
3) When does the miner get the fees for including transactions in the block (output-input)? Is there a different "maturity" for transactions or it is the same as for Block?
I am asking in regards if he collects the fee right away, and that block gets "killed" and transactions returned back into "pool", someone has to pay the second miner who will include that transaction again in his pool.
The maturation time applies to the block reward; the block reward includes the block subsidy(the newly minted coins) and transaction fees.
Quote
One other thing I missed on google (nobody shows that example), where is the transaction for "fee"? Is it included in the coinbase transaction (reward for block + sum of all fees for transactions in the block) or are transactions fee separate? If they are separate who will create a "record" about that fee (it has to be written as a transaction so that the miner can reference it when he wants to spend it)

Big thank you once again for all your efforts to go in this border line cases with me Smiley

KR
The Coinbase transaction includes the transaction fees for all the transactions in the block, plus the block subsidy.
However, if a miner mines an empty block (a block without any other transactions apart from the Coinbase transaction -- for a block to be valid, the Coinbase transaction must always be present), then the Coinbase transaction contains only the block subsidy.
For example in this block you can see that the block had fees of 0.4739BTC and if you check the Coinbase transaction you can see that the output of the transaction is 12.9739BTC which is the block subsidy of 12.5BTC + the total transaction fees of ~0.4739BTC
Compare it to the first block that Satoshi mined that had no other transactions.
You can clearly see that the Coinbase transaction only has an output of 50BTC (which was the block subsidy at that time)
jr. member
Activity: 60
Merit: 2
March 23, 2018, 09:44:02 AM
#7
Thank you.

So, if we assume that everything is OK with the block... then at the same time we have two blocks with the same "parent" (previous block). And possible those two branches could go like that for a couple of more blocks (the probability of that decreases exponentially). So until this situation is resolved, everything is OK... some nodes are using one branch, and some nodes are using other branch...  And when the "problem" gets resolved, all of the transactions that were in the loosing chain get thrown back into the "unconfirmed" pool... where some other miner can pick them and try to include them in their block...
Yes.

tnx!

Until the the problem is resolved the miner could "spend" the fee he received for including the transaction in his block. After that the block chain decides to eliminate his block (because it was in the loosing team). What happens now?
He is not receiving the reward for his block because it was discarded?
The transactions that were included in his block need to be resent (by him or some other miner).
What happens with the fee he already spent (the one he received for including the transactions in the first place)?
He can't. The maturity for the block reward is 100 blocks. The miner cannot spend any UTXO (unspent transaction output) created by the coinbase transaction until the chain is
has at least 100 other blocks mined on top of that. This should counter any possible block reorgs unless it goes to 101+ and that is unlikely.

Oh, this information about maturity was the "missing" part:) tnx!

Also, I don't see why isn't it possible that two miners are trying to include the same transaction in their blocks? transaction is in the unconfirmed pool, both want to add it in their block (it is needed because the transactions in the block also have impact on calculating/mining the block), and possible both succeed at the same time... this of-course seem wrong so again, I am missing some info or got something mixed up Smiley
It is possible and probably is happening. If they mine a block at the same time, they could include the same transaction that is in their respective mempool since its not in a block already.

If this is possible, then if I had a private key to the bitcoins that are in those two duplicate transaction, I could double spend them? Right or wrong?
1) Both miners included the same transaction from their mempool, both mind the block in the same time, both blocks are on blockchain (until one block "dies").
So basically, I can create two transactions, one that references "first" duplicate transaction, and the second that references the "second"? (in theory of course)

2) I could "spend" first transaction, and that block could be cancelled (because it ends up in the "dead chain) and my transaction "terminated" - but I already received goods for that transaction and the "retailer" lost his money? Right or wrong?

3) When does the miner get the fees for including transactions in the block (output-input)? Is there a different "maturity" for transactions or it is the same as for Block?
I am asking in regards if he collects the fee right away, and that block gets "killed" and transactions returned back into "pool", someone has to pay the second miner who will include that transaction again in his pool.

One other thing I missed on google (nobody shows that example), where is the transaction for "fee"? Is it included in the coinbase transaction (reward for block + sum of all fees for transactions in the block) or are transactions fee separate? If they are separate who will create a "record" about that fee (it has to be written as a transaction so that the miner can reference it when he wants to spend it)

Big thank you once again for all your efforts to go in this border line cases with me Smiley

KR
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
March 22, 2018, 06:32:59 PM
#6
Thank you.

So, if we assume that everything is OK with the block... then at the same time we have two blocks with the same "parent" (previous block). And possible those two branches could go like that for a couple of more blocks (the probability of that decreases exponentially). So until this situation is resolved, everything is OK... some nodes are using one branch, and some nodes are using other branch...  And when the "problem" gets resolved, all of the transactions that were in the loosing chain get thrown back into the "unconfirmed" pool... where some other miner can pick them and try to include them in their block...
Yes.
Until the the problem is resolved the miner could "spend" the fee he received for including the transaction in his block. After that the block chain decides to eliminate his block (because it was in the loosing team). What happens now?
He is not receiving the reward for his block because it was discarded?
The transactions that were included in his block need to be resent (by him or some other miner).
What happens with the fee he already spent (the one he received for including the transactions in the first place)?
He can't. The maturity for the block reward is 100 blocks. The miner cannot spend any UTXO (unspent transaction output) created by the coinbase transaction until the chain is has at least 100 other blocks mined on top of that. This should counter any possible block reorgs unless it goes to 101+ and that is unlikely.
Also, I don't see why isn't it possible that two miners are trying to include the same transaction in their blocks? transaction is in the unconfirmed pool, both want to add it in their block (it is needed because the transactions in the block also have impact on calculating/mining the block), and possible both succeed at the same time... this of-course seem wrong so again, I am missing some info or got something mixed up Smiley
It is possible and probably is happening. If they mine a block at the same time, they could include the same transaction that is in their respective mempool since its not in a block already.
jr. member
Activity: 60
Merit: 2
March 22, 2018, 05:59:01 PM
#5
I must have gotten something mixed up... isn't a coinbase a fee that the miner gets payed just for mining the block? He could really mine a block with only his coinbase transactions... basically he can decide not to include any additional transactions?
Yes. There is only one coinbase transaction per block. The coinbase transaction includes the payout for the block subsidy and the sum of the transaction fees in the block.

If so, then any other transaction he includes in his new generated block can make him money OUTPUT_1_amount - OUTPUT_2_change = transaction fee.
The transaction fee is the input amount - output amount.

So by mining a block he gets a coinbase amount (reward) + all of the transaction fees. So he broadcasts the message that he mined it... block is on the blockchain...transactions are considered valid...
The miner broadcasts the block itself. He doesn't just say that a block was mined. Miners also do not dictate what transactions are valid; a miner could include an invalid transaction in a block and the block would be rejected by all other full nodes on the network.


Thank you.

So, if we assume that everything is OK with the block... then at the same time we have two blocks with the same "parent" (previous block). And possible those two branches could go like that for a couple of more blocks (the probability of that decreases exponentially). So until this situation is resolved, everything is OK... some nodes are using one branch, and some nodes are using other branch...  And when the "problem" gets resolved, all of the transactions that were in the loosing chain get thrown back into the "unconfirmed" pool... where some other miner can pick them and try to include them in their block...

Did I get this right? Until the the problem is resolved the miner could "spend" the fee he received for including the transaction in his block. After that the block chain decides to eliminate his block (because it was in the loosing team). What happens now?
He is not receiving the reward for his block because it was discarded?
The transactions that were included in his block need to be resent (by him or some other miner).
What happens with the fee he already spent (the one he received for including the transactions in the first place)?


I am obviously missing some information...I am trying to find info on google, but I can't seem to find the "right" site that explains this process in details...

Also, I don't see why isn't it possible that two miners are trying to include the same transaction in their blocks? transaction is in the unconfirmed pool, both want to add it in their block (it is needed because the transactions in the block also have impact on calculating/mining the block), and possible both succeed at the same time... this of-course seem wrong so again, I am missing some info or got something mixed up Smiley

tnx!
staff
Activity: 3458
Merit: 6793
Just writing some code
March 22, 2018, 05:40:06 PM
#4
I must have gotten something mixed up... isn't a coinbase a fee that the miner gets payed just for mining the block? He could really mine a block with only his coinbase transactions... basically he can decide not to include any additional transactions?
Yes. There is only one coinbase transaction per block. The coinbase transaction includes the payout for the block subsidy and the sum of the transaction fees in the block.

If so, then any other transaction he includes in his new generated block can make him money OUTPUT_1_amount - OUTPUT_2_change = transaction fee.
The transaction fee is the input amount - output amount.

So by mining a block he gets a coinbase amount (reward) + all of the transaction fees. So he broadcasts the message that he mined it... block is on the blockchain...transactions are considered valid...
The miner broadcasts the block itself. He doesn't just say that a block was mined. Miners also do not dictate what transactions are valid; a miner could include an invalid transaction in a block and the block would be rejected by all other full nodes on the network.
jr. member
Activity: 60
Merit: 2
March 22, 2018, 05:36:57 PM
#3
Now, if this scenario happens, does this mean that two transaction fees will be payed for the same transaction? First time it entered the block (that ended up in the "shorter" chain) and second time when that transaction was once again pulled from unconfirmed transaction pool and put in the new block (that hopefully ends up on the  "correct" chain)

From miners point of view, the second transaction fee should be necessary because it is not the second miners problem that the block from the "first" miner ended up in the "short" chain. But then again, who is paying for the second fee?
No.

Transaction fees are collected by the miner, not really actively paid to the miner. They are the difference between the value of the inputs and the value of the outputs. Transaction fees are collected by the miner when they mine a block including the transaction. The fee is paid to the miner via the coinbase output which the miner generates. It is the same output that also pays the block subsidy (the 12.5 BTC reward a miner gets for mining a block).

In a situation for an orphan block, the miner whose block is orphaned receives no payment at all; he does not receive any transaction fees nor does he receive the block reward. This is because the transaction that contains that payment is the coinbase transaction of the orphaned block and so it does not become part of the main blockchain.

Because of this, your second question is invalid.

Thank you for a speedy response...this is very interesting topic for me so I will trouble you with a couple of more questions (maybe stupid ones Smiley )

I must have gotten something mixed up... isn't a coinbase a fee that the miner gets payed just for mining the block? He could really mine a block with only his coinbase transactions... basically he can decide not to include any additional transactions?

If so, then any other transaction he includes in his new generated block can make him money OUTPUT_1_amount - OUTPUT_2_change = transaction fee.
So he gets the difference between those two numbers...). So by mining a block he gets a coinbase amount (reward) + all of the transaction fees. So he broadcasts the message that he mined it... block is on the blockchain...transactions are considered valid... Did I get this part wrong?

staff
Activity: 3458
Merit: 6793
Just writing some code
March 22, 2018, 05:06:54 PM
#2
Now, if this scenario happens, does this mean that two transaction fees will be payed for the same transaction? First time it entered the block (that ended up in the "shorter" chain) and second time when that transaction was once again pulled from unconfirmed transaction pool and put in the new block (that hopefully ends up on the  "correct" chain)

From miners point of view, the second transaction fee should be necessary because it is not the second miners problem that the block from the "first" miner ended up in the "short" chain. But then again, who is paying for the second fee?
No.

Transaction fees are collected by the miner, not really actively paid to the miner. They are the difference between the value of the inputs and the value of the outputs. Transaction fees are collected by the miner when they mine a block including the transaction. The fee is paid to the miner via the coinbase output which the miner generates. It is the same output that also pays the block subsidy (the 12.5 BTC reward a miner gets for mining a block).

In a situation for an orphan block, the miner whose block is orphaned receives no payment at all; he does not receive any transaction fees nor does he receive the block reward. This is because the transaction that contains that payment is the coinbase transaction of the orphaned block and so it does not become part of the main blockchain.

Because of this, your second question is invalid.
jr. member
Activity: 60
Merit: 2
March 22, 2018, 04:53:13 PM
#1
Hi,

I have two questions regarding the bitcoin mining - technical side.

1) If multiple blocks are mined at the same time, branching occurs. Since there is a "rule" that new blocks should be added to the longest chain, the blockhain "stabilizes" that situation. Transactions  that were in the blocks that were in "smaller" chain get put  back to the unconfirmed transaction pool and have to be included in future blocks.

Now, if this scenario happens, does this mean that two transaction fees will be payed for the same transaction? First time it entered the block (that ended up in the "shorter" chain) and second time when that transaction was once again pulled from unconfirmed transaction pool and put in the new block (that hopefully ends up on the  "correct" chain)

From miners point of view, the second transaction fee should be necessary because it is not the second miners problem that the block from the "first" miner ended up in the "short" chain. But then again, who is paying for the second fee?

2) Is it possible that two miners are trying to put the same unconfirmed transaction in their block? If yes, then they could possible both succeed in creating a new block, and both expect to get the fee... what happens with those transactions and fees in this specific scenario?

I know these are border cases...still...I would like to know Smiley

tnx!
Jump to: