6

If two non-issuing accounts, x and y, want to share an asset, must they trust the asset issuing account, a? Or can a trust line be created between x, y and a distribution account, b?

My (current) architecture allows for any account to issue an asset and, therefore, become a in the scenario above. As per suggestion of the Stellar docs, that issuing account then gives the total supply of the asset to a distribution account, b. If no more of that asset needs issuing, then account a is locked; effectively, I want to throw away a - hence, in my architecture, I'd like to create trust lines between x, y and b, and not necessarily between x, y and a. Is that possible?

2 Answers 2

4

If you want x and y to trust the same asset (not issued by either x or y) then you will need an account a to serve as the issuer account.

If you want to continue to distribute tokens issued by the issuer account a after the issuer account has been locked then you will need a fourth account b to serve as the distributor account, which initially holds all the tokens before distribution. This locks the total amount of tokens available.

In this case, x, y, and b will need to trust the asset issued by a. It does not make sense for x and y to trust b since b only holds the tokens, but has not issued them.

6
  • Hmmmm - I can't get this working! I have it so that x, and b trust the asset issued by a, but when b tries to distribute to x, the transaction fails with the error "op_no_trust", "tx_failed". That seems to suggest that x needs to trust b!
    – glowkeeper
    Jun 6, 2018 at 9:24
  • Note that I trying to send ANG to GCITKXYYIQ3TMCBSBJGYPA5AKM4TJIKUEMC6NRSF2OP7AMZN25EML2K3 from GDFNDXPVUH2A35M5BJVTTS3ABE67ACE5IIMIHM35FZS7VXN2762QC454 on the Horizon testnet. You can confirm that they both trust the issuing account (GDCKOCW5CNPRQUNEHR3WNCLVWNBB2XXZLFNZBHD4SIPSTEJVAB7LW3D2) through the following URLs: horizon-testnet.stellar.org/accounts/… and horizon-testnet.stellar.org/accounts/…. What am I missing?
    – glowkeeper
    Jun 6, 2018 at 9:39
  • you are not missing anything, it should work. Are you setting up the transaction correctly? Can you share the XDR of the transaction you are trying to submit?
    – nikhils
    Jun 11, 2018 at 20:15
  • Hey - thanks for chipping in. So I did this: const xdr = transaction.toEnvelope().toXDR().toString("base64"), then console.log('Transaction XDR: ', xdr). It produced this: Transaction XDR: AAAAAMrR3fWh9A31nQprOctgCT3wCJ1CGIOzfS5l+t26/7UBAAAAZAB73jEAAAAwAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAkTVfGEQ3NggyCk2Hg6BTOTShVCMF5sZF05/wMy3XSMUAAAABQU5HAAAAAADK0d31ofQN9Z0KaznLYAk98AidQhiDs30uZfrduv+1AQAAAAAU3JOAAAAAAAAAAAG6/7UBAAAAQHk1FhtO08ffJCwWQrwLoK7p3m4ramNn5c+5mywlc/D3LnFkHmfy8UDaCKck8In2ZS5nmVGG9TFzYXeoFC57BQY=. I hope that's helpful!
    – glowkeeper
    Jun 13, 2018 at 8:53
  • Looking closer at my code, to get the asset for the payment transaction, I issue a new asset with the token code and payer as parameters: asset = new StellarSDK.Asset(_token, _senderPublicKey). Is that wrong? Should it be something like asset = new StellarSDK.Asset(_token, _issuerPublicKey)?
    – glowkeeper
    Jun 13, 2018 at 9:12
3

The distribution account (b in your case) is optional. It is handy in most cases, because asset issuing logic can be fully separated from the distribution/trading/ICO logic.

You can send your asset issued by a account directly to accounts x and y without any mediators. When you send custom asset from the issuing account to any other account, it issues an asset. Once the x account sends the asset back to the issuing account a, the corresponding amount of your asset is effectively destroyed.

For example, you want to issue and distribute 20 BEER tokens. You send 10 BEER tokens from a to accounts x and y respectively. Total number of BEER in circulation is 20. When account x sends 1 BEER token back to the issuing account (let's imagine, that it was consumed at the nearest pub), corresponding amount is destroyed, so now you have only 19 BEER tokens circulating.

8
  • But I do have the 'handy account' b! However, how is it handy if x and y cannot trust b to do the distribution?
    – glowkeeper
    Jun 1, 2018 at 11:30
  • As I said, you can safely ignore the step with creating b account. If you don't need it, just don't use it. It is optional, the logic can be implemented without a distribution account. In your case, x and y should trust a directly.
    – Orbit Lens
    Jun 1, 2018 at 12:40
  • Except that, if I lock the issuing account, a (so no more of the asset can be created), how do I then distribute the asset?
    – glowkeeper
    Jun 1, 2018 at 13:46
  • 1
    Yes, b can distribute the asset even if a is locked. Think of trustline as debt. Every account that want to use an asset, must trust the issuer. For example, FED (a) issues USD (an asset), and everybody, including Bank (b) and regular people (x and y) trust the issuer (USD is partially backed by gold).
    – Orbit Lens
    Jun 1, 2018 at 17:48
  • 1
    Exactly. Assets can be freely transferred or traded without any limitations between any two accounts that have established trustlines to an asset.
    – Orbit Lens
    Jun 2, 2018 at 10:59

Your Answer

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

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