What happens when a miner does not claim all fees/generated coins?

Suppose that a miner for some reason has the generation transaction of their blocks not take all the possible coins. This can happen for a variety of reasons, almost all of which are bugs:

  • An off-by-one error makes them think that their block should generate only 25 BTC when we’re still at 50 BTC per block
  • Some bug prevents them from noticing a transaction fee; perhaps they were mining and updating the block in parallel using non-thread-safe code.
  • Depending on the answer to this question, they may actually decide to do this on purpose (though I can’t think of an answer that would cause this in the vast majority of cases)

I can think of a few possible ways the network would respond, and none really seem ideal.

  • The block could be rejected, just as it would be if it had too much generated.
  • The block could be accepted and the extra coins available for whoever mines the next block (in which case, somebody may do this on purpose to encourage others to mine).
  • The block could be accepted and the extra coins lost.

What actually happens?

After sending some bitcoins, why do I have zero available to spend when I clearly didn’t send my entire balance?

With some of the clients I use regularly (Multibit, Bitcoin for Android), I’ve noticed that, after I send bitcoins to an address, I have 0 BTC available to spend despite having perhaps a several bitcoin balance.

Looking more closely at the transaction details on Blockchain.info or Blockexplorer.com, I observe that the client sent my entire balance back to myself in the same transaction.

For example, my balance in my wallet before the transaction is 1 BTC. I send 0.5 BTC to address C from my wallet, plus 0.0005 BTC for transaction fees. I should have 0.4995 available immediately to spend on another transaction. However, the clients show 0 BTC available, but a balance of 0.4995 BTC.

When I look at the transaction, I see two input addresses, addresses A and B. The outputs are 0.5 BTC to address C, the destination of my payment, and 0.4995 to address B.

Why then do I have 0 BTC available when I clearly should have 0.4995 BTC available?

how to monitor +20,000 addresses for new received transactions?

I have around 20000 generated addresses which I want to monitor for new transactions. More addresses should probably come. Customers should use every address only once but I would like to monitor already used addresses if some of them decide to transfer coins to “used” addresses.

These addresses are not in the online wallet, I have only addresses in the databases. Private keys are held offline.

That means that I do not want to monitor addresses from the local wallet but the addresses from databases.

A command should executed after a transaction is received (with enough confirmations). There are some monitor services which can send an email or call url after receiving a transaction for an address on the watchlist.

I would like to implement the same feature for my application without depending on external service.

I saw some questions and answers like:

How to know there is a new transaction? or
Monitor all transactions on bitcoin network – API

But what would be the most efficient way to do this? Is there a perl/php compatible way to do that?

One of topics from above links to https://bitcointalk.org/index.php?topic=89725.0 where Gavin is talking about some new features but I did not get how could I or whether I can use anything of this to monitor a high number of addresses. Sending every minute a batch RPC call with a few thousands addresses to bitcoind is probably not a solution :-(.

I hope that there is a elegant way to monitor the whole information stream (all incoming transactions and other incoming information) and react if it matches what I need.

Why is downloading blocks taking longer and longer?

First off, this really needs to get fixed. I’m downloading blocks for at least 8 hours now, and it’s still not done. I know the problem of having to download the entire block chain is being worked on, but I feel it’s already out of hand. Setting up an application should take something you would measure in minutes, not hours or days. (After spending the entire night, it’s now 4:15am, I would estimate the setup time to be two days.)

Also downloading can be much optimized as it is. It’s far from using my maximum download speed, and being connected to one peer is as fast as being connected to 8+ (yup, also tried port forwarding).

Now, ontopic.

Is it normal that downloading blocks goes slower, the further you progress? The first half (out of 194.000) went in the blink of an eye, after that it became less and less fast. Now at 20.000 blocks remaining, progress comes in bursts, but there can easily be 20 seconds of inactivity and when it bursts it’s like 10 blocks.

Is this normal behavior? And also, why doesn’t the number of connections make any difference for the speed at all? If it works like Bittorrent, which some describe it to work like, it should get faster with more people who can upload to you (more connections).

I’ve Googled, but all I’ve found is that it takes a few hours and that it may get stuck. It’s not stuck and taking as long as people describe it to be, but I just wonder if it’s normal that it’s going slower and slower, and why it doesn’t saturate my download capacity (like BitTorrent) no matter how many connections.

Thanks