Given an operation ID, I would like the raw transaction as it appears on the blockchain, as a hex string. can I get the raw transaction from the Tezos node or Tezos CLI? How?
1 Answer
First you need to know what level (block height) to look at based on the provided operation hash (operation id). You have public indexer API's like tzkt or tzstats that can make this very easy for you. Then you can get the parsed operation(s) directly from the RPC API. After that you can forge it locally with for example Taquito to get it as a hex string. Lastly, you can calculate the operation hash from the op bytes if you need to verify that the responses from indexer API and RPC API were correct/honest.
-
1This is a great answer. But it would be a lot simpler and nicer if I could just get the unparsed transaction hex directly from the node. I guess it has it in memory since it can provide a parsed version of the transaction, so it shouldn't be too hard to add it as a field in the response. Sep 19, 2020 at 20:59
-
Also: Not all libraries are good enough to be able to do this. Sure Taquito is excellent, but the Java library, especially, and the C# probably can't do this. Sep 19, 2020 at 21:00
-
1You can also forge it remotely (doc.tzalpha.net/api/…). That would be equivalent to getting the raw hex directly from the node.– KlassareSep 19, 2020 at 21:14
-
1Can't be hard to add something like that to the node. But I suspect no one have requested that feature before.– KlassareSep 19, 2020 at 21:31
-
2Added this as a feature request for the Tezos node gitlab.com/tezos/tezos/-/issues/934 please vote up :) Sep 19, 2020 at 22:06