The TXID can be calculated from the contents of the transaction and isn’t returned with the data, however using the SDKs you can calculate what the TXID is. Which language are you using?
For example in Python you can use get_txid() on a Transaction object.
It may also be required that you add the genesis ID and Hash of the network to the transaction data, but I can’t recall exactly where that’s required. Maybe in the GOSDK only.
Thanks for the code @PatrickB .
Actually, it’s even more subtle, you should copy the GenesisID only if the corresponding boolean in the transaction (hgi in JSON) is set to true.
In practice, almost all transactions set it to true.
Yeah, this is kind of ridiculous. All of the SDKs should provide a simple method to recreate a transaction id for a block retrieved from a node and it shouldn’t require such intimate knowledge to get it. The Transaction class itself could just provide a method to recreate it.
@FrankS Thanks for chiming in. So what i need is i have an archival Algorand node running with latest version which supports v2 apis . I am using the v2 apis using c# to query the block and get the transactions . But with v2 i see transactionId missing . So as per the above suggestions its is like we need to calculate the same .
So if there is any .Net sdk to do the same that would be really helpful , can you please guide on the .net algo sdk if this is achieveable.
Hi @debasish . Yes @funk already linked you the latest NET SDK above. It is available as a NuGet called Algorand2
Feel free to ask me questions in the Discord channel for Algorand developers. I don’t check here very much.
The main thing is that every transaction does have a TxID() property, but for those returned in a block the genesis fields [may] be missing. Because the TxID() property is a computed field, the transactions returned as elements of a block will compute a different TxID property. So you could simply do a foreach on the Block’s SignedTransaction property and update the txns according to the guidance specified above in this thread.
I ran into this issue myself at some point and found a TODO to remind a future me to add a helper function for this
Also, I am not sure what your use case is, but if you are running a full archival node purely for monitoring transactions, Algorand has a new feature out called Conduit, which offers a new type of light ‘follower’ node purely for that purpose.
@PatrickB The go code works absolutely fine . but when i point this to my node it throws error “exit with status code 1”. only line i changed in the entire process is
client, _ := algod.MakeClient(“http://:/v2”, “”)
I pointed to the node and passed the api key , do i need to do something different to point to my node.
Well, that doesn’t really give me enough info to work out what you might be experiencing.
A 404 is simply that your endpoint cannot be found. Try to put a trailing slash on the URL and see if it helps you. Beyond that, either
a) your sandbox is not running
b) the endpoint is behind a firewall
c) the endpoint is mistyped.
If you join the Algorand Discord server I can help you in the NET SDK channel. Post more complete code there.