1

I had this working before (like a week ago) but now I am having issues with sending money to an account. I keep getting this error string "Error transferring https://horizon-testnet.stellar.org/transactions - server replied: Bad Request" but nothing in my code is different. Bellow is my Send Money function.

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

 AccountResponse* sourceAccount = server->accounts().account(source);
 QObject::connect(sourceAccount, &AccountResponse::ready, [sourceAccount, 
 source, dest, server]()
 {
  qint64 sequenceNumber = sourceAccount->getSequenceNumber();
  Account* account = new Account(source, sequenceNumber);

  // Start building the transaction.
  Transaction::Builder *builder = new Transaction::Builder(account);
  builder->addOperation(new PaymentOperation(dest, new AssetTypeNative(), "10"));
  builder->addMemo(Memo::text("Test"));
  Transaction * mTrans = builder->build();

  // Sign the transaction to prove you are actually the person sending it.
  mTrans->sign(source);
  server->submitTransaction(mTrans);

 });

EDIT: I was making a mistake creating accounts which meant creating the same account over and over. The bad request refer to the fact I was trying to transfer credit from one account to the same account. Anyway all fixed now.

  • Would you be able to post your solution as an answer below, and then accept it (click check mark)? That's the usual way to mark a question as resolved on a Stack Exchange site like this one (it stops it showing up in the unanswered questions list). – ire_and_curses Jul 15 at 18:55
0

Since it was working before, a couple of things to check are: - Does the source wallet have enough XLM remaining to complete the transaction? - It is possible congestion on the testnet caused a timeout (I ran into this recently). See https://www.stellar.org/developers/horizon/reference/errors/timeout.html

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.