Is there a way to find the coinbase for a given block using only bitcoind commands? ASICMiner includes hex(Mined By ASICMiner) in the coinbase.

I'd like to generate weekly statistics that include ASICMiner' solo-mining efforts, but I don't want to have to rely on blockchain.info or blockexplorer.com. Is there a way to use bitcoind commands to return the coinbase for a block of given height (or hash)?
I think this is best answered by an example. Let's find the coinbase from a block on the Bitcoin testnet.

First we'll get the hash for a block we want to look at. We'll have a look at the (as I write this) latest block:

&gt; bitcoind getblockcount
81626
&gt; bitcoind getblockhash 81626
0000000000834f3933b50577b854692ed246728a17d10006ced1283a3fd8074c


Now we need to find the hash of the generation transaction from that block. It's always the first one listed. In this example there is only 1 transaction.

&gt; bitcoind getblock 0000000000834f3933b50577b854692ed246728a17d10006ced1283a3fd8074c
[...]
    "tx" : [
        "f1fdeb7ced28f697c97b6a3ed7cc1946e1fc5e062ad8c17d05c88b1767b91b2a"
    ],
[...]


And now we can grab the coinbase from the transaction. The getrawtransaction command's second parameter can be set to 1 to give us individual pieces of the transaction so we can easily find the coinbase. Alternatively we could leave that out and it would give us a single binary blob to navigate ourselves.

&gt; bitcoind getrawtransaction f1fdeb7ced28f697c97b6a3ed7cc1946e1fc5e062ad8c17d05c88b1767b91b2a 1
[...]
"coinbase" : "03da3e012cfabe6d6d18c47c97379852a93158528bb709355a0d38d05fedf072b610bb57442aad4e710400000000000000062f503253482f",
[...]


And there's the coinbase. Now we can check whether it contains pieces of ASCII text or whatever else we want to do with it.