Skip to content

Commit 881fba6

Browse files
mvadariTapanito
andauthored
Add XLS-54d: 0054 XLS-54d: Add DestinationTag to NFTokenCreateOffer transaction and NFTokenOffer object (#346)
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
1 parent 103472e commit 881fba6

File tree

1 file changed

+145
-0
lines changed
  • XLS-0054-nftokenoffer-destination-tag

1 file changed

+145
-0
lines changed
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
<pre>
2+
xls: 54
3+
title: NFTokenOffer Destination Tag
4+
description: Add DestinationTag to NFTokenCreateOffer transaction and NFTokenOffer object
5+
author: Florent (@florent-uzio)
6+
created: 2023-11-27
7+
status: Stagnant
8+
category: Amendment
9+
</pre>
10+
11+
# Challenge Overview
12+
13+
My team is working with multiple partners who build on the XRP Ledger.
14+
The majority of those partners mention the cost associated with the XRP reserves (base + owner) which can quickly become high.
15+
Some projects use NFTs and they need to create hundred, thousand... of accounts. Those projects custody the key for their end users.
16+
17+
As an example, in 2023 an NFT project needed to create 4000 accounts requiring approximately 60,000 XRP for it (10 base + ~5 to cover transaction fees and owner reserves).
18+
19+
# 1. Proposed solution
20+
21+
To streamline this process and minimize costs, we propose a technical solution by modifying one ledger object and one transaction:
22+
23+
1. [NFTokenOffer](https://xrpl.org/nftokenoffer.html#nftokenoffer) ledger object
24+
2. [NFTokenCreateOffer](https://xrpl.org/nftokencreateoffer.html#nftokencreateoffer) transaction
25+
26+
Those changes will require an amendment.
27+
28+
# 2. `NFTokenOffer` ledger object
29+
30+
One new field is added to the object: `DestinationTag`.
31+
32+
## 2.1. Fields
33+
34+
As a reference, the `NFTokenOffer` object has the current fields (in addition to the [common fields](https://xrpl.org/transaction-common-fields.html)):
35+
36+
| Name | JSON Type | Internal Type | Required |
37+
| ----------------- | --------------- | ------------- | -------- |
38+
| Amount | Currency Amount | AMOUNT | Yes |
39+
| Destination | string | AccountID | No |
40+
| Expiration | number | UInt32 | No |
41+
| LedgerEntryType | string | UInt16 | Yes |
42+
| NFTokenID | string | Hash256 | Yes |
43+
| NFTokenOfferNode | string | UInt64 | No |
44+
| Owner | string | AccountID | Yes |
45+
| OwnerNode | string | UInt64 | No |
46+
| PreviousTxnID | string | Hash256 | Yes |
47+
| PreviousTxnLgrSeq | number | UInt32 | Yes |
48+
49+
`DestinationTag` would be added to that object with the following specifications:
50+
51+
| Name | JSON Type | Internal Type | Required |
52+
| -------------- | --------- | ------------- | -------- |
53+
| DestinationTag | Number | UInt32 | No |
54+
55+
# 3. `NFTokenCreateOffer` transaction
56+
57+
This transaction already exists and one field would be added to it: `DestinationTag`.
58+
59+
## 3.1. Fields
60+
61+
The current fields of that transaction are:
62+
63+
| Field | JSON Type | Internal Type | Required |
64+
| ----------- | --------------- | ------------- | ------------------ |
65+
| Owner | String | AccountID | Yes if `buy` offer |
66+
| NFTokenID | String | Hash256 | Yes |
67+
| Amount | Currency Amount | Amount | Yes |
68+
| Expiration | Number | UInt32 | No |
69+
| Destination | String | AccountID | No |
70+
71+
`DestinationTag` would be added to that transaction with the following specifications:
72+
73+
| Name | JSON Type | Internal Type | Required |
74+
| -------------- | --------- | ------------- | -------- |
75+
| DestinationTag | Number | UInt32 | No |
76+
77+
## 3.2. Usage
78+
79+
Once the transaction is submitted and validated by the XRPL, the `DestinationTag` is stored in the `NFTokenOffer` object and will then be used by the NFT project backend to give ownership of a specific NFT to one of their user.
80+
81+
## 4. Flow, how would you use such `DestinationTag` for NFTs?
82+
83+
Let’s start this explanation by analyzing first a payment flow with an exchange like Coinbase for example.
84+
85+
We will then see how it can be expanded to NFTs.
86+
87+
Let’s say we have three people:
88+
89+
- Alice has a 2,000 XRP balance with Coinbase (so Alice has a destination tag),
90+
- Bob has a 1,000 XRP balance with Coinbase (so Bob also has a destination tag).
91+
- Doug has his own regular XRP address with a 1,500 XRP balance (no destination tag required for him).
92+
93+
![image](https://github.com/XRPLF/XRPL-Standards/assets/36513774/7901d35f-4899-4eb2-b805-acb35e4309dd)
94+
95+
If Alice wants to send Doug 500 XRP, Alice logs on to Coinbase, enters Doug's `r...` address & the amount, and clicks send. Coinbase's balance decreases, Doug's increases. A Payment transaction is sent on the XRPL. No problem.
96+
97+
If Doug wants to send Bob 500 XRP, first Doug needs to find Bob's destination tag for Coinbase. Bob logs on, finds the number, gives it to Doug, and Doug sends a transaction where the destination is Coinbase's r... address, and the destination tag is the number Bob gave Doug.
98+
Doug's balance decreases, and Coinbase's balance increases. But there's an extra step - Coinbase has to examine that transaction, extract the destination tag, look it up in their own database, and then credit Bob with the XRP.
99+
100+
Now what if Bob wants to send Alice 750 XRP? If Coinbase submits a payment transaction from their own r... address with Bob's SenderTag to their own r... address with Alice's DestinationTag, the transaction will fail as malformed (`temREDUNDANT`)!
101+
102+
There's no point in having such a transaction on the ledger. Coinbase simply needs to update their own records to move the balance from Bob to Alice - there's no point in involving the XRPL.
103+
104+
**Now let's expand this example to include NFTs.**
105+
106+
An NFT project, such as the one mentioned at the top of the page that wants to create 4,000 wallets, might envision, for each NFT, to do the following:
107+
108+
1. Fund a "custodied" wallet with 15 XRP (Payment).
109+
2. Mint the NFT ([NFTokenMint](https://xrpl.org/nftokenmint.html)).
110+
3. Offer the NFT to the "custodied" account (create a sell [NFTokenCreateOffer](https://xrpl.org/nftokencreateoffer.html#nftokencreateoffer) with amount of 0 (the amount can vary, it’s just an example here) and `destination` set to the new wallet.
111+
4. Have the new "custodied" wallet accept the NFT offer ([NFTokenAcceptOffer](https://xrpl.org/nftokenacceptoffer.html))
112+
113+
Step 4, though, implies that they control the secret key of the "custodied" wallet and submit transactions on its behalf.
114+
Technically the NFT project buys and sells NFTs among their customers
115+
116+
**Now they're starting to sound like Coinbase.**
117+
118+
Using the exchange-like approach, the process for each NFT would be:
119+
120+
1. Mint the NFT ([NFTokenMint](https://xrpl.org/nftokenmint.html))
121+
2. Internally assign ownership of the NFT to a customer,
122+
123+
Now, whenever one of their internal customers wants to buy or sell the NFT to another internal customer, there is no point in involving the XRPL, just like Bob paying Alice on Coinbase.
124+
125+
If an external wallet wants to buy one of the NFTs, they create an offer for it. They don't even necessarily have to know the destination tag of who owns it - but the NFT project doesn't submit an automated [NFTokenAcceptOffer](https://xrpl.org/nftokenacceptoffer.html) transaction until the current internal owner accepts it manually.
126+
127+
If one of the NFT Project users wants to buy an external NFT, _that_ is when `DestinationTag` comes in.
128+
129+
The NFT project submits a buy [NFTokenCreateOffer](https://xrpl.org/nftokencreateoffer.html#nftokencreateoffer) which includes the user's destination tag.
130+
When the offer is accepted, the NFT project looks at the `NFTokenAcceptOffer` transaction metadata, which includes the offer being deleted (in the `DeletedNode` object), gets the `DestinationTag` from there, and credits ownership of the NFT to that account.
131+
132+
Now if an external wallet would like to sell an NFT to a specific user of that NFT project, that specific user will give his destination tag to the seller.
133+
The seller submits a sell [NFTokenCreateOffer](https://xrpl.org/nftokencreateoffer.html#nftokencreateoffer) with the NFT project’s `r…` address as the destination, and the user's destination tag. Similarly as the buy scenario above, once the sell [NFTokenCreateOffer](https://xrpl.org/nftokencreateoffer.html#nftokencreateoffer) is accepted, the NFT project will credit ownership of the NFT to that specific user.
134+
135+
## 5. Additional Notes
136+
137+
1. The destination tag is NOT added to the [NFToken](https://xrpl.org/nftoken.html#nftoken) object itself. There's no need for it. It's the project's responsibility to internally update ownership of an NFT just like it's Coinbase's responsibility to update their customer's account balance when receiving a payment.
138+
139+
2. This proposal would interact with the `lsfRequireDestTag` flag on an `AccountRoot`. The `NFTokenCreateOffer` and `NFTokenAcceptOffer` transactors should enforce the behavior of that flag.
140+
141+
## 6. Benefits
142+
143+
- Cost Reduction: Minimizes XRP reserve requirements, lowering the financial burden on NFT projects. With `DestinationTag`, the NFT Project mentioned at the top of the page would only need one account (~200 XRP including base + [NFT reserves](https://xrpl.org/nft-reserve-requirements.html#nft-reserve-requirements)) instead of 4000 accounts (~60,000 XRP).
144+
- Efficiency: Simplifies the process by internalizing ownership transactions, reducing the need for extensive ledger involvement.
145+
- Enhanced User Experience: Streamlines the NFT creation and exchange process, making it more user-friendly for both project creators and consumers.

0 commit comments

Comments
 (0)