Unable to submit transactions to API due to genesis hash error

I’m getting a strange (to me) error regarding the genesis hash value when I try to use the Testnet API from the shell.

I am including the code and output, but sadly I am having to edit it because the system says I can’t post so many links (and urls are contained in the code).

I’m trying to do a send transaction. So, first I obtain the parameter data with this command:

curl -s [URI]://node.testnet.algoexplorerapi.io/v2/transactions/params

The output from the server is in the expected JSON format:


My script parses this and gets the genesis hash and places it in my JSON transaction file:


You can see that it is taking the exact base 64 hash value of the genesis hash and placing it into the transaction. The transaction is then converted to the msgpack format and signed with algokey, no problem there.

I then send the signed transaction in the format indicated by Algorand Explorer on its API page for testnet:

curl -X POST ‘https://node.testnet.algoexplorerapi.io/v2/transactions’ -H ‘accept: application/json’ -H ‘Content-Type: application/x-binary’ --data-binary ‘@/path/to/transaction.stxn’

Here’s the error message:

{“message”:“TransactionPool.Remember: tx.GenesisHash \u003cKNDU6MKHJNJXU6KFG5EUKUCJORKHQQ2CPF3TS6BYIZWW44SDIRSQ\u003e does not match expected \u003cJBR3KGFEWPEE5SAQ6IWU6EEBZMHXD4CZU6WCBXWGF57XBZIJHIRA\u003e”}

What is confusing about this in particular is that it seems that the base 64 hash is being converted to base 32 and then this prefix and suffix of \u003 is being added. In any case, the specs we are given on Algorand.org tell us to include the hash as it is published, in base 64, in our transaction file. It seems I am doing that correctly here.

Can someone explain to me what is happening here? Thanks in advance!

EDIT: I am wondering if something is wrong with the genesis-id value I’m getting back from the API. It says it is “testnet-v.10” but the API address has “v2” in it. Perhaps the API is sending back the wrong genesis-id value?

Duplicate of Genesis Hash Error while using Testnet API