How can I get the block number of given transaction? For a given transaction, I have its incoming transactions and I am trying to get the number of the block of those transactions. This seems like something that cannot achieve directly.

I am working on python with Json RPC and I want to work directly on the block-chain on my computer and not to use online API such as blockchain.info.

How can I get efficiently the block number of a given transaction?
According to the Wiki, the gettransaction &lt;txid&gt; call return a JSON object with the following information

"amount" : total amount of the transaction
"confirmations" : number of confirmations of the transaction
"txid" : the transaction ID
"time" : time associated with the transaction[1].
"details" - An array of objects containing:
"account"
"address"
"category"
"amount"
"fee"


Now just use getblockcount and subtract "confirmations" of the JSON object.