Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: jim618 on June 05, 2012, 08:00:27 PM



Title: Displaying coinbase transactions and their status in a UI
Post by: jim618 on June 05, 2012, 08:00:27 PM
Coming soon in the bitcoinj codebase is the '120 block maturation' for coinbase transactions. Previously each of the bitcoinj clients rolled their own coinbase solutions.

I was wondering how other clients and mining software depict these transactions as they mature and become available to spend. For MultiBit I would like to reuse the common UI vernacular if possible.

Presumably in the wallet balance you consider them 'unavailable to spend' for 119 blocks and then 'available to spend' at 120 but how are you depicting it ?

(I think in the Bitcoin protocol the unavailable to spend depth is actually 100 blocks but we have copied the Satoshi client 120 blocks).


Title: Re: Displaying coinbase transactions and their status in a UI
Post by: FreeMoney on June 05, 2012, 08:16:48 PM
I never heard an explanation of the 100/120 difference.


Title: Re: Displaying coinbase transactions and their status in a UI
Post by: blueadept on June 05, 2012, 10:30:17 PM
I believe 100 is enforced in the transaction and block verification code to prevent the client from forwarding transactions with coinbase inputs under 100 blocks old. 120 is used as a limit in the wallet code, to be on the safe side and prevent you from spending a coinbase transaction for at least 120 blocks.


Title: Re: Displaying coinbase transactions and their status in a UI
Post by: Gavin Andresen on June 06, 2012, 05:36:15 PM
RE: the 100/120 difference:

Check my work, but I think this is the scenario where it would matter and cause headaches:

You generate a block 100 blocks before a difficulty adjustment.

Then you spend the coinbase exactly 100 blocks later, in a block in the next difficulty period. And, let's say, whoever you send the bitcoins to spends that transaction again immediately.

Now imagine a really wacky scenario where you're reorganized onto a shorter-but-has-more-difficulty block chain.  That could happen if you were disconnected from the main bitcoin network for a while.

Your coinbase-spend transaction and any transactions that depend on it can't be included in the main chain because they're immature, so they get dropped from everybody's memory pool as "trying to spend an immature coinbase."  I'm not sure what then happens; I think you'd eventually retransmit them and get them into the main chain, but that could take a while.


Title: Re: Displaying coinbase transactions and their status in a UI
Post by: DeepBit on June 09, 2012, 04:10:57 PM
Your coinbase-spend transaction and any transactions that depend on it can't be included in the main chain because they're immature, so they get dropped from everybody's memory pool as "trying to spend an immature coinbase."  I'm not sure what then happens; I think you'd eventually retransmit them and get them into the main chain, but that could take a while.
I think it will be finally included a bit later.
Once I tried spending coinbase at 99-100 confirmations and the problem solved itself without any intervention.


Title: Re: Displaying coinbase transactions and their status in a UI
Post by: Jan on October 24, 2012, 07:57:54 AM
Coming soon in the bitcoinj codebase is the '120 block maturation' for coinbase transactions. Previously each of the bitcoinj clients rolled their own coinbase solutions.

I was wondering how other clients and mining software depict these transactions as they mature and become available to spend. For MultiBit I would like to reuse the common UI vernacular if possible.

Presumably in the wallet balance you consider them 'unavailable to spend' for 119 blocks and then 'available to spend' at 120 but how are you depicting it ?

(I think in the Bitcoin protocol the unavailable to spend depth is actually 100 blocks but we have copied the Satoshi client 120 blocks).

Having never mined a block I have no idea how bitcoin-qt depicts an immature coinbase transaction, but I would be interested in knowing how it handles it.
Does it count it against your total balance before it matures?
How does it display it in the transaction history?

@Deepbit: You happen to mine a lot, can you post a screenshot?


Title: Re: Displaying coinbase transactions and their status in a UI
Post by: wabber on October 24, 2012, 01:54:42 PM
Having never mined a block I have no idea how bitcoin-qt depicts an immature coinbase transaction, but I would be interested in knowing how it handles it.
Does it count it against your total balance before it matures?
How does it display it in the transaction history?

@Deepbit: You happen to mine a lot, can you post a screenshot?

Use the testnet, you can mine plenty of blocks there and see for yourself.


Title: Re: Displaying coinbase transactions and their status in a UI
Post by: Jan on October 24, 2012, 02:15:55 PM
Having never mined a block I have no idea how bitcoin-qt depicts an immature coinbase transaction, but I would be interested in knowing how it handles it.
Does it count it against your total balance before it matures?
How does it display it in the transaction history?

@Deepbit: You happen to mine a lot, can you post a screenshot?

Use the testnet, you can mine plenty of blocks there and see for yourself.
Why didn't I think of that? ;D


Title: Re: Displaying coinbase transactions and their status in a UI
Post by: DeepBit on October 28, 2012, 09:56:09 AM
@Deepbit: You happen to mine a lot, can you post a screenshot?
Sorry, I don't have a screenshot, but I think everyone will believe me that almost 30 000 blocks were found under my supervision, so I had many opportunities to play with them.


Title: Re: Displaying coinbase transactions and their status in a UI
Post by: etotheipi on October 28, 2012, 02:16:14 PM
I put coinbase transactions in Armory recently.  I didn't think it would ever matter, because there'd be so few people ever mining blocks directly... then P2Pool came along...

Feel free to plagiarize my pickaxe icon :)

http://dl.dropbox.com/u/1139081/MainWindowMining_small.png



Title: Re: Displaying coinbase transactions and their status in a UI
Post by: jim618 on October 28, 2012, 05:38:14 PM
I like it !

I presume you show the pickaxe icon for the whole 120 confirmations and then it changes to whatever you use for confirmed (Satoshi: a green tick).

Not really much point in trying to show 20/120, 40/120, 60/120 confirmations etc.


Title: Re: Displaying coinbase transactions and their status in a UI
Post by: etotheipi on October 28, 2012, 05:58:19 PM
I like it !

I presume you show the pickaxe icon for the whole 120 confirmations and then it changes to whatever you use for confirmed (Satoshi: a green tick).

Not really much point in trying to show 20/120, 40/120, 60/120 confirmations etc.

Well, the pickaxe is always shown, but the little checkboxes on the left are handled differently.  Usually it shows a partially-full bucket with the number of confirmations up to 5 (like on the screenshot on the main page (http://bitcoinarmory.com/)) and then just shows a checkmark.  For coinbase, I decided to just map the 6 bucket levels to 0/120, 20/120, etc, but not actually show the number except in the mouseover text.  Then it changes to the same as others once it hits 120 (as you can see for the coinbase on the bottom of the ledger).

It's one of those millions of polishing things that is useful for so few users, but worth doing it eventually.



Title: Re: Displaying coinbase transactions and their status in a UI
Post by: jim618 on October 28, 2012, 06:12:21 PM
Having a separate icon for the transaction type and the status is probably better than what I have in MultiBit - just the one.

I will probably just use a pickaxe and then put the confirmation count in the tooltip to keep it simple.