Create a Database using Tangle and IPFS for beginners
The full article was originally published by Yehia Tarek on Medium. Read the full article here.
If you are not familiar with MAM its simply create a Merkel Tree to save hashes. The hash of the root is capable of accessing all other hashes using side-key in our case as we use Restricted MAM. So IPFS will upload files then the returned hashed will be saved on MAM.
How the database will work
For sure our database will be in JSON format.
1- Upload JSON data to the IPFS and get the returned hash to access the files later.
2- Send the IPFS using MAM restricted.
To get Data:-
1-Fetch data using mama restricted and get the uploaded IPFS hash.
2- Fetch the hash of the IPFS to get the uploaded JSON data.
Let’s Start Coding
The IPFS code to upload data. Check function on the documentation here.