Learn how to use Tableland SQL to track Object Name, Type, and IPFS CID of objects stored in an IPFS Filebase Bucket.
Tableland is an SQL database and network protocol built for use on the Ethereum network. Tableland can be used to store anything from tokenURI metadata to NFT extensions or DAO tools. Tables created and stored with Tableland utilize a user’s Ethereum wallet address for authentication, so no usernames, passwords, or access keys required.
Tableland can be used to record and track metadata for objects stored in a Filebase IPFS bucket. Objects stored on the IPFS network have an associated IPFS CID which is unique to each file, but isn’t easily identifiable like typical file IDs or storage paths are. To solve this, you can create a database with Tableland that tracks your objects and their associated file name, type, and IPFS CID so you can query it whenever you need to quickly reference an object.
Read below to learn how to use Tableland SQL to track object name, type, and IPFS CID of objects stored in an IPFS Filebase bucket.
- Download and install the Tableland CLI tool:
npm i -g @textile/tableland-cli
PRIVATE_KEY_STRINGwith your private key string.
tableland create "CREATE TABLE AssetTracker (id INT PRIMARY KEY, name TEXT, type TEXT, cid TEXT, provider TEXT, url TEXT);" --description="Filebase Asset Tracker"
The response from that query is your new table name! You’ll need to reference that later to update and query the table. It should look something like the following:
If you have your own API keys for Infura, Alchemy, etc you can avoid the warning message that was printed with the above command. See
tableland create —helpfor details.
tableland query "INSERT INTO assettracker_192 VALUES (0, 'filebase_robot.png', 'PNG', 'bafybeict7kegxaugjue5rcys65islddi2rnzmj2hh2wfq3wynf7t772hy4', 'filebase.com', '<https://bafybeict7kegxaugjue5rcys65islddi2rnzmj2hh2wfq3wynf7t772hy4.ipfs.dweb.link>');"
assettracker_192with the value you received in the previous step. The following table has some additional objects you might want to include.
Example Database Table:
tableland query "SELECT * FROM assettracker_192;"
This example queries all entries in the database. You can modify this to reflect your desired query for a single object or a certain criteria of objects.