0

For example, a seller is selling product A. The seller says that whomsoever pays first gets the product. The seller also sells product B, and whomsoever pays first gets product B, and so on.

What I am thinking is that the seller can publish his next sequence number for product A and the next for product B and so on. The transaction is then constructed with the seller as the source such that when the sequence number is consumed no other transaction can consume it.

The problem is when the later sequence numbers get consumed first; error bad_seq will be returned, although later they will become valid once the previous numbers are consumed. But the later transactions will never become valid if, in this example, product A never gets sold.

I think this is not at all viable. Might anyone suggest how to go about this scenario?

1

If each product you are selling is unique (say, art objects), all of them can be treated as non-fungible tokens. Take a look at my write-up on different Stellar-based NFT approaches here. SDF has no plans to implement NFTs on-chain in the nearest future, therefore, the best option (at least, my favorite one) is using accounts as NFTs. It requires some custom coding, but it is more comprehensive in theory. Also, check how Litemint handles NFTs.

1

Don't know a good solution without drawbacks but here are some more ideas:

  • Publishing the sequence number alone wouldn't be sufficient since the seller would also have to sign the transaction if they are the tx source. Now as you need a co-signing service anyways, you could create temporary source accounts for every product instead. Then co-sign any transaction that contains the payment and a close account (actually account merge) operation for the temporary account.

  • Require buyers to send a payment with a unique memo to themselves or lock up the money in a temporary escrow account or something - just as a kind of purchase agreement. Once the first ones are determined via ledger, they'll have to make the real payment to the seller.

  • Just refund consecutive payments.

1

Or just post the product as an offer, given you've created an asset for it. Whoever takes the offer takes the product. If one wants to let the buyers bid, let them submit offers and the seller will just take the highest bid. I think this is a good application of Stellar's exchange.

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.