2

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
  • 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
    Commented Jul 29, 2020 at 17:32

1 Answer 1

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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