Build
ONCHAIN STORAGE
Features
Tags

Metadata Tagging

Irys supports attaching metadata tags to each transaction.

Tags can be used to:

Querying

Tags are indexed by gateways and are queryable using GraphQL.

Content-Type

The Irys CLI automatically infers and sets the appropriate Content-Type (opens in a new tab) tag based on the file extension when uploading files and folders.

If your use case necessitates manual Content-Type tag setting, you can specify it during the upload process. Doing so will override the default behavior and apply the Content-Type you provided.

// Your file
const fileToUpload = "./myImage.png";
 
// Add a custom Content-Type tag
const tags = [{ name: "Content-Type", value: "image/png" }];
 
try {
	const response = await irys.uploadFile(fileToUpload, { tags: tags });
	console.log(`File uploaded ==> https://gateway.irys.xyz/${response.id}`);
} catch (e) {
	console.log("Error uploading file ", e);
}

You can also add tags via the CLI's -t option, followed by a series of name / value pairs

irys upload myImage.png -t tagName1 tagValue1 tagName2 tagValue2 -n testnet -t matic -w bf20......c9885307

Additional Uses

You can add up to 20 tags to each transaction, enabling the construction of semi-relational models within your data.

A popular practice involves creating an application-id tag, this tag helps segregate your uploads from others.

// Your file
const fileToUpload = "./myNFT.png";
 
const tags = [{ name: "application-id", value: "NFTs To The Moon" }];
 
try {
	const response = await irys.uploadFile(fileToUpload, { tags: tags });
	console.log(`File uploaded ==> https://gateway.irys.xyz/${response.id}`);
} catch (e) {
	console.log("Error uploading file ", e);
}