1

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.

  • 1
    After a testnet reset, you have to recreate your accounts as they get lost with the reset. Have you tried refunding your accounts using friendbot? – kolten Jul 29 at 17:32
0

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.