#Setup a contract for NFT sales

44 messages · Page 1 of 1 (latest)

umbral geyser
#

Hey, i've been working on a NFT designer app for a while

The designer is working so far (a minimal 3d editor) and i'd now like to integrate it with XRPL XLS-20

Basically my idea is:

  • Users design their nft
  • they setup an escrow transaction with the right amount of XRP and a secret (a hash i told them to put there) and a NFT will release the escrow
  • Once done, i receive a callback from the user, and check if there is indeed an escrow setup
  • If everything matches, i mint the XLS-20, send it to the escrow, and the contract requirements are fulfilled, releasing the xrp to me and the NFT to the user

(Ofc all of this should be seamless and the user just signs a tx on their wallet)

I just want to make sure i'm not paying too much upfront for users who might never convert to actually buying anything

Is this a good setup or is there any easier way - or - is this even possible ?

umbral geyser
#

Edit: I've read the Lazy Minting part of the docs, however it does sound like i would have to pay upfront again

Even if i have an off ledger checkout flow, at the last step i'd have to pay 2 XRP + tx costs every time someone presses the buy now button, except they don't have to actually buy it by simply rejecting the transaction on their wallets..

Is there really no other way to guarantee that the XRP is "reserved" and that the user can prove that they will buy it ?

If, hypothetically, 500 people want to buy an nft, but only 50 actually convert at the end
That means, given an NFT price of 2 XRP, i'd have to provide ~920 XRP as a reserve (sell offer + reserve for nft) for the objects, that might possibly get never picked up

Burning them after a certain amount of time is an option, but again that's quite a risky model isn't it?

It could quickly lead to a situation where my dev wallet gets drained by reserve requirements and i'd be unable to fulfill requests of users that might actually buy something

#

Edit 2:
Okay, so probably telling users to authorize my dev wallet to mint on their behalf is one way of "ensuring" that there is some sort of trust between user <-> app

Flow i'm thinking of:

  1. User sets up authorization Tx once
  2. They set up an escrow with a password i give them
  3. I mint the nft on their behalf, finish the escrow
  4. done

Unfortunately that puts the user at risk of me grabbing the escrow without giving them the NFT, but for now i can hope that once some users start minting and receive their nfts, this will be negligible

fallow ember
#

Just as a general info: an Escrow on the XRPL is not a smart contract. So you can't send a NFT there which then releases both the XRP and NFT

#

And having the users authorize you account doesn't work. Because in this scenario, the User wallet would be the Issuer of the NFT (except that's what you want to achieve?)

#

And in this scenario the NFT would still be in Your account and not the user account. So you would have to sell it to the user anyway, reserving 2 XRP again for the sell offer

umbral geyser
fallow ember
#

Yeah but your can't really mint into their account. You can mint in their name but then the NFT is in your account anyway

#

So you have to transfer the NFT via sell offers anyway

umbral geyser
fallow ember
#

yeah, not really. You have to cover some of the reserves upfront

#

But NFTs are cheap in reserves and not accepted sell offers can be deleted in a timely manner

umbral geyser
#

I understand. That's really putting a lot of risk on the app dev side, isn't it?

I will never hold the NFTs for a long time, so the reserve costs can somehow be managed

But i'd have to actively monitor the wallet to make sure it's always having enough funds - and suddenly if there was a lot of users trying to buy at the same time, i'd have to queue them (degrading their experience) to make sure i don't run out of XRP 🥲

Also, let's say XRP value goes 10x, the reserve costs will skyrocket (until adjusted)

umbral geyser
fallow ember
#

Transaction cost is only 0.000010 XRP. Not sure if that's really a problem.

umbral geyser
#

and then there is the problem of transferFees, which i'd like to give the user the opportunity to collect
which seems quite impossible in this scenario?

fallow ember
#

You can make 100.000 transactions with only 1 XRP

umbral geyser
umbral geyser
fallow ember
fallow ember
umbral geyser
fallow ember
#

But all NFT or payment transactions is 10 drops base fee

fallow ember
#

To collect royalties

umbral geyser
#

hmm, this way i'd have to adjust my pricing to include an expected average loss of transactions per actual sell

umbral geyser
#

I'm just trying to find the right structure here, obviously it's all theoretical for now

fallow ember
#

Yeah, a solution would be to set your account as NFTMinter. But I don't think that's a good user case for the user since it gives you some kind of control of the User wallet

umbral geyser
fallow ember
#

No, it's designed for NFT issuers to protect the issuer wallet which collects the royalties

#

If you need to regularly mint it's better to not do with the issuer account to not expose the secret key too often

#

Better use a second account you own, mint there and distribute the nft from there

#

Keeping the issuer wallet safe

umbral geyser
#

ahhhhhh

fallow ember
#

But still be able to collect royalties

umbral geyser
#

Well, let's say i build a ticket selling app, where hosts can manage events and then mint tickets and collect royalties

Now, the only way to do so would be to collect a payment upfront (technically unrelated to the sale), then give them the NFT data which they then have to mint in a separate TX?

#

That sounds a bit weird from a user experience perspective, you go to checkout and have to sign two transactions

The only other way i can think of on XRPL would be to create a separate token, then charge users on this token automatically (since i am the token issuer) when they purchase something

But then there's even more work for them to do (build a trustline, buy the tokens, make sure to have the right amount before purchasing something)

fallow ember
#

No, you just mint the NFT and when a user wants to buy one, you create a sell offer with the sell amount for the NFT with the user account as destination

#

The user then has to only issue 1 transaction to accept the sell offer.

cyan isle
#

For a setup where hosts are managing events and want to mint tickets, using the NFTokenMinter seems like the right answer. Then you can mint the NFTs for them. This will require you to manage the reserves for NFTs, though.

#

Usually people mint on demand - so mint when someone wants to buy a ticket and you can then just immediately sell to them.