0

Really simple question, with presumably involved answer:

I'm trying to understand how to make what starts off as a simple hello_world application where I sell the integers "1-2-3..50" to USER=account who provides me PRICE=n XLM at contract Z. This seems as simple as I can make it, but then it also suggests I'd like endpoints for:

  1. SELECT who, which USER, has bought asset=="1"?
  2. LIST which assets have been bought?
  3. LIST what assets has USER=="x" bought?
  4. SET PRICE=n*1.2 for future sales of integers.
  5. CREATE a new asset, "51", and make it available for sale.

I'm an experienced developer, but don't have a full appreciation for the toolchain and tradecraft/design patterns that go into this.

Does this mean I'm building only a contract? Because by golly it already feels like a whole application. Where does it modularize?

How much of this is something that the stellar chain/dev environment already gives? If I /think/ this is all I need in my most minimal contract, what else do I need to consider too?

For example, it costs money to run the ops 1-5, right? How do I set up the accounts that would receive these operations? Also, to complicate slightly more, suppose I wanted to have privacy on some of these, or permissions on (5) to only allow me=USER==0 to do this?

What are the best references for systematically understanding and correcting every foolish assumption I have above?

2

Check out the docs for Horizon, which is a RESTful API for gathering information about the network. It doesn't cost anything to make queries to it, but when building a real application, the best practice is to run your own Horizon instance to avoid centralization. Running Horizon implies running a core node, which has some nontrivial resource requirements, so it's not free in that regard.

You only pay fees for transactions (which contain operations) submitted to the network. Stellar doesn't have smart contracts the same way Ethereum does—contracts don't run code, they're a sequence of transactions that are crafted in such a way that they provide guarantees about when they'll be valid.

To specifically address your questions:

1

Unlike Ethereum, Stellar does not have automagic on chain contracts. You have to craft of chain transactions to achieve anything.

First read the official guides and especially get familiar with the stellar "transaction/contains operations" and assets concepts.

Then as a first start, go to stellar laboratory account creator where you can create as many testnet accounts as you want for free.

Play around with the stellar laboratory transaction builder, create a simple native XLM payment transaction from one of your test accounts to another. Create an asset (create a trustline == how to set up accounts to receive...), create a payment with your asset.

You can also do all of this in a language of your choice with one of the sdks.

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.