Validate transaction, signature, tx hash

Hello,

I’m working on adding Aeternity blockchain to Trust Wallet.
I copied implementation from aeternity go sdk and now testing the functionality.
I tried to validate the data with https://goggles.aepps.com/.
But it always returns “Invalid input”, regardless if I copy data I produced or data produced running aeternity go sdk integration test (aepp-sdk-go/integration_test at develop · aeternity/aepp-sdk-go · GitHub).

So the questions are following:

  1. If this tool known to be broken?
  2. If not, then if go sdk known to be broken
  3. How can I validate transaction, signature, tx hash produced by my code?

Thank you.

Googgles indeed seems to be not working. But I found another way, run this test github .com/aeternity/aepp-sdk-go/blob/develop/cmd/tx_test.go#L20 with my signed transaction.
So far it’s failing, this line throws an exception:

txSignature := txRLP[2].([]interface{})[0].([]byte)

txRLP[2] gets signature part from the rlp encoded data, what is the rest of the statement does I don’k know. Can Someone explain me?

Hey, Goggles is up and running again, we had some minor issue and we are sorry for that.
Can you please test again.

Best,
Martin

Thank you very much. It works most of the time.
But for this one it stucks loading:

tx_+KkLAfiluEALBOo/4sCcw0qjEOSrgW45DwtW17gSNi46sKdta0JERTD5YypqlUaIv1XoI70X3eBwi31g16GZh2ZwHdcn2lIBuGH4XwwBoQHOp63kcMn5nZ1OQAiAqG8dSbtES2LxGp67ZLvP63P+86EBHxOjsIvwAUAGYqaLadh194A87EwIZH9u1dhMeJe9UKMKhhIwnOVAAIMBQ0Uxi0hlbGxvIFdvcmxkMbZ3hw==

There is an issue with this transaction, decoding it. We will investigate more on it. Can you share some info about it? Is this a spend tx, or a contract call, is it generated with the GO-SDK ?

Martin

Martin,

This is actually invalid tx that I was getting before fixing RLP encoding part of signing.
That assembled with following data:

std::string sender_id = "ak_2a1j2Mk9YSmC1gioUq4PWRm3bsv887MbuRVwyv4KaUGoR1eiKi";
std::string recipient_id = "ak_Egp9yVdpxmvAfQ7vsXGvpnyfNq71msbdUpkMNYGTeTe8kPL3v";
uint64_t amount = 10;
double fee = 2e13;
std::string payload = "Hello World";
uint64_t ttl = 82757;
uint64_t nonce = 49;

privateKeyHex = "4646464646464646464646464646464646464646464646464646464646464646";

Apparently RLP encodes array of signatures, but I was passing only one signature. Fixed it now.
Google works fine for valid tx though.

1 Like

@pegah.chain is looking for your answer

This was a bug where it was looking for an environment variable for the network_id (since the signature includes the network_id). If the network_id is unset, the code takes it as ‘blank’, and doesn’t use the default.

I just fixed it a few days ago in this commit: fix: tx verify was using blank env variable as a default instead of t… · aeternity/aepp-sdk-go@2ccd333 · GitHub, and will make a release out of it later today.

2 Likes