Hi, as far as I understand, there is no way with the Python SDK to “decode” a block in msgpack format. Is this accurate? It looks like the “go SDK” has some additional encoding/decoding capabilities to properly handle msgpack. Can anyone confirm this?
I’d like to use the block_info function to retrieve a block and process all transactions (load them into a Transaction object) and calculate the tx id. I’ve tried with both json and msgpack with no luck.
Has anyone been able to solve this?
I’ve also tried to manually recreate the transaction but “reusing” the dictify code, passing the data I got from the block. It works for 98% of the time, but there are still some application transactions for which I get a wrong transaction ID generated.
Not sure why this is so hard to implement in Python, getting the transaction ID of all the transactions in a block should be straight forward. The indexer (written in go) can do this.
Any help would be greatly appreciated.
Can you provide your code as well as an example of block for which your code does not work?
Also, have you looked at How can I decode bytes in ledger fields ledger? - #6 by fabrice
My code is basically the same as the one you posted and I can get a decoded block. I was finally able to generate a transaction ID by manually parsing each transaction inside the block. The biggest problem is that all “keys” inside the transactions of the returned block are encoded as “bytes” instead of “string”, and they need to be converted back to properly calculate a transaction id (using the code in the SDK). I was hoping there was a more “efficient” way to get the transactions back with keys already decoded as strings (where needed). Here is an example of the first transaction inside block 18417631, all keys are bytes:
Unfortunately Python SDK isn’t very helpful regarding this process, thus would it be possible to share a gist with the code you use for parsing? I am trying to do the same, but the transaction ID I get is not valid.
Looking forward to your feedback!