I would really love to use a stellar token for a game to track e.g. ownership of different areas/land?
Is this possible with stellar?
Stellar Stack Exchange is a question and answer site for developers and users of Stellar and the Stellar Distributed Exchange. It only takes a minute to sign up.
Sign up to join this communityYes. You will have to create a separate asset for each item (kitty/land/area). The key part is that you currently can't change number of decimal places for assets on Stellar which are, by default, divisible to 7 decimal places. If you want your asset to be non-divisible, 0.0000001
of your asset will represent a single item. You will have to present it correctly in your user interface.
If you want to allow your users to send a fraction of unit of your item (up to 1/10,000,000
) you don't have to do anything special in your user interface as they are divisible by default in Stellar. You can create a new issuing account and send the following assets to your distribution account:
1 LAND1
1 LAND2
1 LAND3
Then you can create a new offer to sell part of your land like:
Sell 0.5 LAND1 Buy 1000 XLM
.
Things get a little more complicated for non-divisible assets because you need to update your user interface to interpret 0.0000001
of your asset as a single item. Again, you can create a new issuing account but this time you only send 0.0000001
of each asset what represents a single item:
0.0000001 KITTEN1
0.0000001 KITTEN2
0.0000001 KITTEN3
Now, because assets on Stellar are divisible only to 7 decimal places you can't send/sell a part of 1 kitten (this would hurt!). So creating a following offer: Sell 0.0000001 KITTEN1 Buy 1,000 XLM
means you are selling KITTEN1
for 1,000
XLM.
LAND*
assets could be currently supported from a single issuing account in Stellar? I'm concerned about the scalability of things like trustlines and Stellar.toml. For the use-case above, we'd potentially want thousands or millions of LAND Assets.
Apr 18, 2018 at 16:37
Short answer: right now it's not possible as the way assets are represented is done using trust lines that by design don't distinguish between tokens.
Convoluted answer: you could do it by issuing an asset per unique token (and you would issue only 1 of each). From a data set point of view it's workable (you would use the ASSET_TYPE_CREDIT_ALPHANUM12
asset type), where this solution breaks down is on usability as transferring tokens would require creating a trust line per token. For somebody to transfer a token to somebody else, the parties would have to cooperate on a multi-sig transaction that does something like: