Problems with creating transactions after testnet update

I have been trying to create transfer transactions on the testnet, but they fail with vm status: 2 (INVALID_AUTH_KEY) and I don’t understand what the problem is because the auth key is not a attribute in the transaction.

I created two accounts using the faucet api and after that I tried to submit the transaction. The transaction should be correctly serialized because I get different errors in case there’s something wrong.

Has anyone got the transaction working who could help? If you could post the contents of a working transaction I could compare mine to it.

You need add a auth_key_prefix param. The signature of peer_to_peer script is changed. A blank value like b’’ is ok:

fun main(payee: address, auth_key_prefix: vector<u8>, amount: u64)

BTW, I think the ‘auth_key_prefix’ is superfluous, it’s used only when create a new account.

Thanks, but I got the same result, even with an empty auth key prefix, would it be possible for you to send the contents of a sucessful transaction, for example as a hex string? I would really appreciate it.

I also started wondering if the problem could be related to the initial minting. Because in the new version announcement there’s the new way of creating the authentication key, but I used the old and it works, the money is in the account. So I’m a bit confused here, @yuan-xy (or anyone), how do you form the authentication key for minting? And are you able to transfer from an account that has been created through the faucet api.

Before latest update:

  address = sha3-256(public-key) //256 bits, 32 bytes
  auth_key = address

After latest testnet update:

  auth-key = sha3-256(public-key + 0/1) // 0 means ed25519; 1 means multi-ed25519
  auth-key-prefix = auth-key[:16]  // first half 16 bytes
  address = auth-key[16:]  // second half 16 bytes

If auth-key rotation happend, address is independent from auth-key.

2 Likes

I used the sha3-256(public-key) way to create the auth_key and successfully minted with the faucet api, the new way did not work (the money did not appear in the account). Is the faucet api working as it should?

1 Like

Faucet api has some changes too:

https://github.com/yuan-xy/libra-client/blob/87027eaf98b8197eb4ba9ae344049f1deb4f9561/libra_client/client.py#L283

url = "http://{}?amount={}&auth_key={}".format(self.faucet_host, micro_libra, auth_key)
resp = requests.post(url, timeout=self.timeout)
1 Like

I think the problem might be in the way I generate the address, because of course the minting will work with any 32 byte auth key and the address will be the last 16 bytes, but if I generate the address wrong from the public key, it will not work. I’ll try to fix it.

1 Like

Thanks @yuan-xy, I got it working after fixing the authentication key and address generation :+1:

1 Like