Hi,
I successfully worked with IPFS Folders to host and access my metadata with an ERC-721 contract.
My json files are stored in an IPFS folder and the files named 1,2,3,4....
If I query tokenURI(1) i get
ipfs://path_to_ipfs_folder/1
If I query tokenURI(2) i get
ipfs://path_to_ipfs_folder/2
So far so good. File "1" is a json holding information and linking to the image url.
Everything works as expected - no problems so far. Linking to image and metadata works fine.
No I wanted to try Arweave for persisting metadata.
I upload the images in a folder named "images" and get for an example image the following id:
FEFJ8qmM49TFeWZOLbCHX9jcjkdxttBw8-gGSXJpIqU
This can be viewed with:
https://arweave.net/FEFJ8qmM49TFeWZOLbCHX9jcjkdxttBw8-gGSXJpIqU
Second step is creating the metadata.json file with the corresponding image arweave uris.
Metadata is designed like "ERC721 Metadata JSON Schema" defines and holds the information regarding the image.
{
[...]
"image": "https://arweave.net/FEFJ8qmM49TFeWZOLbCHX9jcjkdxttBw8-gGSXJpIqU",
[...]
}
I call this file "1" and save it on arweave within the folder metadata.
The folder lives here:
https://arweave.net/xlWqxJLHdS_PZtWbsPPY-K5yHv5dIMLji-SIdYrRzg0/
If I set the uri within the contract at the folder ID:
ar://xlWqxJLHdS_PZtWbsPPY-K5yHv5dIMLji-SIdYrRzg0
or
https://arweave.net/xlWqxJLHdS_PZtWbsPPY-K5yHv5dIMLji-SIdYrRzg0/
and try to get the Token URI I won´t get informations regarding the item.
https://arweave.net/xlWqxJLHdS_PZtWbsPPY-K5yHv5dIMLji-SIdYrRzg0/**1**
--> this won´t work because the file has an onw unique id in arweave and can´t be found with "/1".
The json itself has a different address:
https://arweave.net/HnnA6It8FprXkG_qDKQ3oIohBSv0AkNHpnAf5GRGWxU/
So I conclude I´d had to map every address to the corresponding path. I understand, that this is a no go...
Another option would be to put all metadata json elements in one file save it to arweave and query only the part needed with an API like
"https:/myrestapi/1" --> loads the json json from arweave and parses the element given in the uri ("/1".
Example:
[ element: 1 {
{ name: "1",
....
"image": "https://arweave.net/FEFJ8qmM49TFeWZOLbCHX9jcjkdxttBw8-gGSXJpIqU
",
....
}},
element: 2 {
{name: "2",
....
"image": "https://arweave.net/....",
...
API submitted with /1 gives:
{ name: "1",
....
"image": "https://arweave.net/FEFJ8qmM49TFeWZOLbCHX9jcjkdxttBw8-gGSXJpIqU
",
....
}
How do I link metadata json files held in arweave the right way?
Hopefully I missing something. Seems like a bad workaround because the interface can be shut down and the NFTs won´t find their metadata.
Thank you for your help!