It seems like getrawtransaction is meant to do this.
However, it just fails at some transactions. Say I want this transaction
https://blockchain.info/tx/6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4http://blockexplorer.com/tx/6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4http://blockchain.info/rawtx/6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4The transaction ID is 6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4 . If I try
./bitcoind getrawtransaction '6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4'
I get
error: {"code":-5,"message":"No information available about transaction"}
However, if I try
./bitcoind getblock '000000000003ba27aa200b1cecaad478d2b00432346c3f1f3986da1afd33e506'
I got
{
"hash" : "000000000003ba27aa200b1cecaad478d2b00432346c3f1f3986da1afd33e506",
"confirmations" : 82622,
"size" : 957,
"height" : 100000,
"version" : 1,
"merkleroot" : "f3e94742aca4b5ef85488dc37c06c3282295ffec960994b2c0d5ac2a25a95766",
"tx" : [
"8c14f0db3df150123e6f3dbbf30f8b955a8249b62ac1d1ff16284aefa3d06d87",
"fff2525b8931402dd09222c50775608f75787bd2b87e56995a7bdd30f79702c4",
"6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4",
"e9a66845e05d5abc0ad04ec80f774a7e585c6e8db975962d069a522137b80c1d"
],
"time" : 1293623863,
"nonce" : 274148111,
"bits" : "1b04864c",
"difficulty" : 14484.16236123,
"previousblockhash" : "000000000002d01c1fccc21636b607dfd930d31d01c3a62104612a1719011250",
"nextblockhash" : "00000000000080b66c911bd5ba14a74260057311eaeb1982802f7010f1a9f090"
}
So the blockchaind
knows about the transaction. It just doesn't tell me about it.