3

Complete newbie here so thanks in advance for tolerating the ignorance that follows.

Working on creating a little card game to learn solidity and have reached the part where I need to assign metadata to the token.

I understand that the tokenURI should point to a json file/object on my web server that is formatted to the standard. So, for token 6 it would be something like: "http://mycardgame.com/cards/6".

I also understand how I could use a variable like baseURI to store all but the "6", get the 6 when the token is minted, and put them together to form the entire URI.

What I have no earthly idea on is how to create that "6" json on the server so the URI points to a valid thing.

I imagine it's something either fairly complicated or ridiculously easy to do, otherwise at least one of the many ERC721 tutorials would have covered more than just setting the tokenURI in the contract. I'd bet complicated over easy.

So, where should I start looking to learn what I'll need to do? Not looking for a quick handout, willing to do the work of actually learning.

  • This is off-topic here. I think you're just asking "How do I host JSON on my server?" and that's unrelated to Ethereum. You'll find better help on Stack Overflow. – user19510 Dec 16 '18 at 21:15
  • I figured there was some crossover here as it would seem I'd need to use some of the data from my solidity file when the creating the json object. – Kevin Phillips Dec 16 '18 at 21:29

1 Answers1

1

Here is an example JSON to use as a starting point:

https://tenthousandsu.com/erc721/00001.json

You can see the EIP specification which includes a JSON schema you can validate against.

You will host that file using an Amazon S3 bucket, GitHub Pages static hosting, a commodity cPanel host, or some other web hosting mechanism.

Don’t be shy, I can also help with whatever else you want to add in there.

William Entriken
  • 4,690
  • 15
  • 42