Macrometa: Track IPFS Files with Macrometa

Learn how to track IPFS Files with Macrometa.

What is Macrometa?

Macrometa is a full-stack platform for APIs and applications. Macrometa offers a comprehensive and extensive API that can be used to interact with a variety of different databases. In this tutorial, we’ll use a Dynamic database to track file names and their associated IPFS CID, which can be queried and used by the Macrometa API in a variety of applications and workflows.

Read below to learn how to track IPFS files Macrometa.

Prerequisites:

1. First, navigate to console.filebase.com.

If you don’t have an account already, sign up, then log in.

2. Select ‘Buckets’ from the left side bar menu, or navigate to console.filebase.com/buckets.

Select ‘Create Bucket’ in the top right corner to create a new bucket for your files.

3. Enter a bucket name and choose the IPFS storage network to create the bucket.

Bucket names must be unique across all Filebase users, be between 3 and 63 characters long, and can contain only lowercase characters, numbers, and dashes.

4. Next, select the bucket from your list of buckets, then select ‘Upload’ in the top right corner to upload your files. For this tutorial’s example, we’ll use 3 PNG files.

5. Select your files to be uploaded.

Once uploaded, they will be listed in the bucket.

6. You can view the object’s IPFS CID in the CID column, or you can click on your uploaded object to display the metadata for the object, which includes the IPFS CID.

Choose the method you prefer, and take note of the IPFS CID.

7. Login to the Macrometa Developer web portal.

Select ‘Collections’ on the left side bar menu, then select ‘Create a Collection’.

8. Select ‘Dyno Table’ for the new collection type.

9. Provide a name for your collection, then set the Partition Key as file-name and Sorting Key as ipfs-cid.

10. Select the collection name.

11. Select ‘New Item’:

12. Enter the file name and the IPFS CID you took note of earlier.

13. Repeat this step for each CID you’d like to add to the tracker database.

14. You can also use database queries to add to the database.

Select ‘Queries’ from the left side bar menu, then select ‘New’. Enter the following database query:

INSERT { 'file-name': '4.png', 'ipfs-cid': 'bafybeif5x2gihgepga2vtjlx3lfdwgxquo2sbv4a77rsedokf6poqrrcse' }

INTO Filebase_IPFS_Tracker

15. Then select ‘Run Query’.

In the Query Result screen, there should be ‘1 Writes’:

16. You can view the collection to confirm the query was successful.

If you have any questions, please join our Discord server, or send us an email at hello@filebase.com

Last updated