Page MenuHomePhabricator

[ecash-wallet] Support for NFTs on SLP
ClosedPublic

Authored by bytesofman on Sep 2 2025, 20:41.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC349e90e7f06e: [ecash-wallet] Support for NFTs on SLP
Summary

Add supporting utxo selection and tx building for SLP_TOKEN_TYPE_NFT1_GROUP, aka NFTs.

Note that NFTs on XEC have some intricacies with the spec that could be greatly simplified by using this kind of library. Namely, users must deal with minting "Collection" or "Group" tokens. Then they must "fan out" these tokens to create utxos with qty-1. Then exactly 1 of these utxos must be at the index-0 input of the tx that mints an NFT.

I looked at making this simplification in the initial implementation, i.e. if a user tries to mint an NFT, the lib automatically fans out. However this is nontrivial. This logic is not necessary for Cashtab drop-in. Due to the associated complexity, it should be handled in its own diff, if it is added.

Properly, though, if NFTs on eCash are to become important and useful -- it would be much better to come up with a new ALP-based spec. Some advantages of an ALP NFT:

  • Eliminates requirement for "preparatory" tx for listing on agora
  • Could eliminate the requirement for "fan-out" txs; instead, with ALP, you could design the spec such that we BURN qty 1 of the parent token and GENESIS qty 1 of the NFT in the same tx, while providing token change.
  • Could include messages in NFT txs, which could be used programmatically for things like encoding changes in privileges, associations, or sale royalties

So, in improving NFT support, it would be higher ROI to engineer this kind of spec than to obfuscate the complexities of the existing SLP NFT spec as much as possible. ecash-wallet could obfuscate the preparatory txs and the fan out txs. But it could never fix the problem of "we cannot include msgs or app data in NFT txs" ... and I think that could be particularly useful especially for non-image NFTs.

Test Plan

npm test, CI

Diff Detail

Event Timeline

more validation for genesis action vs token type

bytesofman published this revision for review.Sep 2 2025, 21:12
bytesofman added inline comments.
modules/ecash-lib/src/payment/action.ts
73 ↗(On Diff #55464)

this is isolated in D18557; this diff will be rebased on 18557 before landing.

18557 has to land first, as ecash-wallet uses the latest npm-published version of ecash-lib when it is published

Fabien requested changes to this revision.Sep 3 2025, 15:28
Fabien added a subscriber: Fabien.
Fabien added inline comments.
modules/ecash-lib/src/payment/action.ts
73 ↗(On Diff #55464)

You should rebase and make it depend on D18557

This revision now requires changes to proceed.Sep 3 2025, 15:28
bytesofman retitled this revision from [ecash-wallet] Support for NFTs to [ecash-wallet] Support for NFTs on SLP.Sep 3 2025, 15:55
bytesofman edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Sep 3 2025, 16:08
This revision was automatically updated to reflect the committed changes.