TransWikia.com

`tx_bad_auth` when submit transaction to TestNet

Stellar Asked by pizi on January 1, 2021

I submit a transaction to the TestNet by using the official horizon API (https://horizon-testnet.stellar.org/), and it returns tx_bad_auth.

This is my code:

        Server server = new Server("https://horizon-testnet.stellar.org");

        final KeyPair keyPair = KeyPair.fromSecretSeed("xxx...");
        String toAddress = "xxx...";
        final String accountId = keyPair.getAccountId();
        System.out.println(accountId);

        final AccountResponse account = server.accounts().account(keyPair.getAccountId());

        Transaction.Builder builder = new Transaction.Builder(account, Network.TESTNET);

        Transaction transaction = builder.setBaseFee(100)
                .addOperation(new PaymentOperation.Builder(toAddress, new AssetTypeNative(), "100.0").build())
                .setTimeout(3600).build();

        final SubmitTransactionResponse submitTransactionResponse = server.submitTransaction(transaction);
        System.out.println(submitTransactionResponse.isSuccess());
      
        System.out.println(submitTransactionResponse.getExtras().getResultCodes().getTransactionResultCode());
        final String hash = submitTransactionResponse.getHash();
        System.out.println(hash);

output:

GCLYWR7FETXXX...
false
tx_bad_auth
null

Before the TestNet restart today, this code works.

One Answer

After I create another account using my account, I can submit a payment transaction with my account. It's strange.

Answered by pizi on January 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP