ccwalletio/tracker

NFT with IPFS link + web argument makes the wallet crash

Closed this issue · 4 comments

I'm making some tests for a NFT collection whose content is displayed as an HTML page.
The HTML page is included in the NFT as an IPFS link. In addition, some web arguments have to be given to the page.
However, this configuration makes the wallet block forever when clicking on the "Open On-Chain File" button

image

My minted example:
Asset: asset1d9uy4qevnfftzzt4qmn0akmm460l63a7ew86l4
Policy Id: 4c0032c51475929f0e9a595c6b3b7f034a13ef6a7c90f2aded0b2b6c
Asset Name: 524c31333130
Viewer on pool.pm: https://pool.pm/asset1d9uy4qevnfftzzt4qmn0akmm460l63a7ew86l4

The IPFS file:
ipfs://ipfs/QmPcPPZhNwomMXffbVGKx1HwD3ZWSQwtamPm1Lzv4HgtrW?data=eyJuYW1lIjogIiM0MyIsICJzZXJpZXMiOiAiUG9ja2V0TW9uc3RlciIsICJudW1iZXIiOiAxMzEwLCAid2lkdGgiOiA4LCAiaGVpZ2h0IjogOCwgInNlZWRzIjogWyIyYzA5LWE0MjQtNTAwYS0xNDE2IiwgIjYyMDAtMDAxOS00YTI0LTEyMDgiLCAiNDM5NS1hYzVjLTEyMTAtMDQxMCJdLCAiY29sb3JzIjogWyJyZ2JhKDAuMCwwLjAsMC4wLDAuMCkiLCAicmdiKDIsMTk4LDU4KSIsICJyZ2IoMzUsNzMsMTE3KSIsICJyZ2IoMjU1LDEyOCwxNjQpIiwgInJnYigxLDEwOCw3MikiLCAicmdiKDIyLDIzLDI2KSIsICJyZ2IoMiwxMzAsMTk3KSIsICJyZ2IoMTU4LDI1LDExOSkiXSwgIm9yaWdpbiI6IC0xLCAic2NvcmUiOiA0LCAibG9uZ2V2aXR5IjogWzM4LCAxOCwgNjRdLCAibnVtX3BpeGVscyI6IDQxfQ==

Hi @ADAttitude, thanks for reaching out! Could you please test on v1.7.0 if this behavior still happens for you? We have made some changes to this between 1.6.4 > 1.7.0

Hello. The "Open On-Chain File" is not there anymore. I don't know if it is the expected behavior ?
2022-05-07 21_28_49-Eternl - a Cardano community wallet

Hello @ADAttitude, thanks for the comment. Removing the "Open On-Chain File" is a bug and will be resolved in the next release.

I had a look at the specific NFT, and for now, I'm afraid we won't be able to display it as you expect it to be shown. Or as the creator of the NFT intended to. Please let me explain why this is not possible at the moment.

When opening the NFT in Eternl, this will be shown:

https://ipfs.blockfrost.dev/ipfs/QmPcPPZhNwomMXffbVGKx1HwD3ZWSQwtamPm1Lzv4HgtrW

The actual NFT data stored on IPFS is only the background and the included js code.

The content shown by, e.g., pool.pm is an iFrame loading data from ipfs, using the blockfrost service. But it is appending some parameters to alter the loaded content. So they load a URL, which packs a script, which renders a webpage. And this webpage is handed some extra parameters.

We need to do this differently because of browsers' content security policy.
We load the source of an NFT, which here is a base64 encoded string, and set this to be the URL of an iframe.
So the browser will render the content that has been stored on ipfs. We cannot pass extra arguments into that process.
So we cannot make the NFT "dynamically," as it is shown on pool.pm.

I like that idea; let me call it dynamically NFT, but tbh. personally I think it's not the way to go.

NFTs, for now, can be audio, video, images, OR base64 encoded Html files.
When they are base64 encoded files, they should include all data necessary to display the NFT as it is intended to be displayed.

Here, the NFT consists of: ipfs://ipfs/QmPcPPZhNwomMXffbVGKx1HwD3ZWSQwtamPm1Lzv4HgtrW?data=eyJuYW....
So the IPFS hash is QmPcPPZhNwomMXffbVGKx1HwD3ZWSQwtamPm1Lzv4HgtrW; everything after the question mark character is considered an argument.
As there is currently no agreed-on standard for NFTs, there can be multiple ways how apps can interpret these extra parameters. Or if they interpret them at all.

My advice would be to include the parameters needed to render the NFT the way pool.pm shows it into the encoded Html content. This way, we would also be able to display it like the creator intended it to be displayed.

Be rest assured that once there is an agreed standard on handling such things, we will make sure that Eternl will be compatible with that. We do our best to display all tokens the way the creators want them to be shown.

Hi @marcuspuchalla, and thanks for this detailed response.
I will proceed as you explained then.
I think the ticket may be closed.

Thanks