0

I initiated a small node js project in which I installed the sdk module in order to communicate with horizon and try out some things, I am following this page from the docs.

However I getting an error. As far as I understand it comes from this line:

const transactionResult = await server.submitTransaction(transaction);

Here is the error log(the log is too long so I will just copy paste the first lines:

An error has occured:
{ Error: Request failed with status code 400
    at createError (/home/ubuntu/workspace/docker_stellar/myserver/myapp/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/home/ubuntu/workspace/docker_stellar/myserver/myapp/node_modules/axios/lib/core/settle.js:18:12)
    at IncomingMessage.handleStreamEnd (/home/ubuntu/workspace/docker_stellar/myserver/myapp/node_modules/axios/lib/adapters/http.js:201:11)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (streamreadable.js:1064:12)
    at combinedTickCallback (internal/process/nexttick.js:139:11)
    at process.tickCallback (internal/process/nexttick.js:181:9)
  config:
   { adapter: [Function: httpAdapter],
     transformRequest: { '0': [Function: transformRequest] },
     transformResponse: { '0': [Function: transformResponse] },
     timeout: 60000,
     xsrfCookieName: 'XSRF-TOKEN',
     xsrfHeaderName: 'X-XSRF-TOKEN',
     maxContentLength: -1,
     validateStatus: [Function: validateStatus],
     headers:
      { Accept: 'application/json, text/plain, /',
        'Content-Type': 'application/x-www-form-urlencoded',
        'X-Client-Name': 'js-stellar-sdk',
        'X-Client-Version': '0.15.3',
        'User-Agent': 'axios/0.18.0',
        'Content-Length': 303 },
     method: 'post',
     url: 'https://horizon-testnet.stellar.org/transactions',
     data: 'tx=AAAAAMKEdM3SKNa%2BVS2IcCHh0hbJpC9eKFwi%2BzFTRdqph9JMAAAAZAAAQT0AAAADAAAAAQAAAAAAAAAAAAAAAFzBqDoAAAAAAAAAAQAAAAAAAAABAAAAACzn9ykXx%2FXpZb2ztFecMWAVIjl3oeMoMzNlQuq2igQ                                                                                           9AAAAAAAAAADQsJmHAAAAAAAAAAGph9JMAAAAQH1pa8aof1o81B7aUJ8XPIKBU%2BDuw%2F9DZLQ7HoS3ueS2RkGlm%2BkUoAQFAi0jmdIsC841ojzyOmMZyjZBo%2BTSEws%3D' },
  request:
   ClientRequest {
     ...

Please if anyone has any idea why i'm having this error I would really appreciate the help.

  • What does the response say? You've trimmed that part of the error response out, all of this is details about the request you made. Could you replace that with the portion under response? – Carl Vitullo Apr 25 at 16:09
  • you mean "error.response" ? here is the log : justpaste.it/4ebmj – user2219 Apr 26 at 7:48
0

Your transaction is a payment to the account GAWOP5... which does not exist. You have to create an account first before you can send payments to it. (In case you created that account more than a day ago, it's gone because testnet was reset yesterday.)

Error would have stated op_no_destination, you can get the relevant error response details like this:

try {
  await server.submitTransaction(...)
} catch (e) {
  console.log(e.response.data.extras);
}
  • the "error.response.data.extras" said : { envelope_xdr: 'AAAAAM8WkMKxiwXaRDFThxR/HF/EPoLIB605jlOOMcJ1DdrUAAAAZAAAeKsAAAACAAAAAQAAAAAAAAAAAAAAAFzCuoEAAAAAAAAAAQAAAAAAAAABAAAAAFLiXyPotSB1ZNc4r/n7EMYv/BDw/SgCClfRo/eDzVZjAAAAAAAAAADQsJmHAAAAAAAAAAF1DdrUAAAAQBPbIEPaaZJYHvv88S0woMWYHAB6gNYoUxbYDRTlVTvDJ76oE7+7hDGUERE559Uzbco97oMSVBbFJNPxRdyxoQ4=', result_codes: { transaction: 'tx_failed', operations: [ 'op_no_destination' ] }, result_xdr: 'AAAAAAAAAGT/////AAAAAQAAAAAAAAAB////+wAAAAA=' } But i still dnt understand cuz i recreated the accounts just now !!! – user2219 Apr 26 at 8:01
  • isn't this link for creating test accounts ! – user2219 Apr 26 at 8:08
  • Yeah, but again the recipient GBJOEXZD5C2SA5LE244K76P3CDDC77AQ6D6SQAQKK7I2H54DZVLGH3GX does not exist. You can't make a payment to an empty account. – sui Apr 26 at 8:15
  • You have to initially fund the recipient too. Either with the laboratory tool or by doing a createAccount instead of a payment operation. – sui Apr 26 at 8:18
  • thanks !!! i changed the StellarSdk.Operation.payment operation, to StellarSdk.Operation.createAccount, and the error is gone , but now i have a new error : error TypeError: startingBalance argument must be of type String, represent a positive number and have at most 7 digits after the decimal at Function.createAccount (/home/ubuntu/workspace/node_modules/stellar-base/lib/operations/create_account.js:34:11) at main (/home/ubuntu/workspace/users.js:35:40) at <anonymous> at process._tickCallback (internal/process/next_tick.js:189:7) , you why i'm having this one ?? – user2219 Apr 26 at 8:26

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.