Is it possible to calculate the transaction size from the transaction id ?
Asked
Active
Viewed 265 times
0
-
I think [this](https://bitcoin.stackexchange.com/questions/1195/how-to-calculate-transaction-size-before-sending-legacy-non-segwit-p2pkh-p2sh) should answer to your question more than exhaustively. If yes this can be marked as duplicate, I suppose. – AG23 Jan 15 '19 at 11:05
1 Answers
1
No. That's not possible.
A transaction id is calculated from the raw transaction. More specifically the raw transaction is hashed twice with sha256: sha256(sha256(rawtransaction)).
That means, that the id is always 256 bits long (64 characters). Because sha256 and hashing in general is a one-way-operation, it's not possible to calculate the size of the rawtransaction just from the transaction id.
if you need more information about a transaction, you have to fetch that from a client. In bitcoin core you can use gettransaction or getrawtransaction. (getrawtransaction only works if the transaction belongs to one of your addresses or you have txindex enabled in your wallet.)
Jack O'Neill
- 266
- 1
- 11
-
TXID is `dsha256` +`endian swap` of the over-the-wire transaction serialisation. – James C. Jan 15 '19 at 10:28
-
That is part of the p2p protocol, not implementation, as this is how txids / prevouts are referenced in overthewire tx serialisations. – James C. Jan 15 '19 at 10:40