1

I'm still newbie on developing simple app using Stellar JS SDK(node.js) and I read their docs. I've created an asset using this code

var asset = new StellarSdk.Asset('USD', issuingKeys.publicKey());

and also I did issuing the account using this code

var issuingKeys = StellarSdk.Keypair.fromSecret('SCZANGBA5YHTNYVVV4C3U252E2B6P6F5T3U6MM63WBSBZATAQI3EBTQ4');
var receiverPublicKey = "GDZJ23GSEB4PNJD44T2RWTZDWE7KV7LBJQMBVL2MOPGOHRI4AK6CYGP4"
var transaction = new StellarSdk.TransactionBuilder(issuer)
          .addOperation(StellarSdk.Operation.payment({
            destination: receiverPublicKey,
            asset: "USD",
            amount: "1.0000000"
          }))
          .build();
        transaction.sign(issuingKeys);
        server.submitTransaction(transaction);

Now, is there a way that we can move the asset 'USD' from one Stellar account to another Stellar account ? Any inputs from you guys would greatly appreciated. Thanks.

  • It seems that you are trying to do a "payment" operation on the asset "USD" from "issuer" to "receiver", which looks totally fine. Do you mean your code not working or what do you mean? – cesarm Jun 25 '18 at 6:22
  • 1
    When you say payment operation that means we are moving or transferring the asset to another account? Additional specs of my app is that the responsible for handling the payment should use the "coinbase payment method" for some reasons. So I'm confused should we use the payment operation in Stellar? And at the same time also use the coinbase payment method, does it make sense? – Arman Ortega Jun 25 '18 at 6:37
  • 1
    "Payment" means "transfer" in Stellar, for both XLM and tokens (i.e. assets). Be reminded that the recipient must "trust" the token before someone sends it to him. – cesarm Jun 25 '18 at 7:00
0

What you did in the above code was actually transfer the USD assets using a payment operation. In stellar you can do payment using native and as well as assets. As you handling the payment in a different place you can use the transfer operation to handle the asset part.

(payment means there should be two things or services need to be involved. hear if you perform only payment operation that means actually your transferring not paying.)

Or if you want to still make the payment using stellar then you can use multi sign transaction or manage offer to make the payment in stellar chain.

1

Firstly the destination account needs to create trustline with the USD asset. You can read more about what is stellar trustline here

https://www.stellar.org/developers/guides/concepts/assets.html

After the destination has trustline then only you can send the USD asset.

In the above code, I don't see the id of USD asset issuer which is incorrect and your transaction will not succeed without it.

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.