Uploading the JSON file โ
The JSON file has to be uploaded somewhere outside the blockchain.
There are two main solutions:
- uploading the file on IPFS.
- uploading it on a regular server/service that exposes the file through HTTPS.
Regular server
The two advantages of uploading on a regular server are:
- The download is faster than from IPFS (A proxy cache or some other techniques can make IPFS as fast).
- If you don't use the
sha256
reference explained in reference the JSON file, the file can be updated, (as long as the URL is the same) without interaction with the contract.
The drawbacks are:
- There is no guarantee that the URL will still be able to hold this file. For example, if you loose the control of the domain name, the contract loose its metadata (except if you've setup a way to update the reference in the server). You users are not guaranteed that you'll keep the file uploaded.
- If you don't use the
sha256
reference explained in reference the JSON file, anyone that control (or hack the server) can bypass the contract's code to update the file. - You have to manage your uploaded files (note that users of IPFS should also manage their files) and be sure they are accessible 100% of the time.
IPFS
By contrast, on IPFS the file are referenced through their hash. As a consequence:
- The metadata is guarantee not to change outside a contract's mechanism.
- Anyone that saved the JSON file can re-upload it to IPFS at anytime so there is no single point of failure that may cause it to be unaccessible for eternity.
A drawback of IPFS is that it's slow, this can be mitigated with proxy cache system.