Tokens & NFT 2.0
The guide section will walk you through uploading images and metadata to Cascade and Sense protocol on LUKSO Testnet.
Introductionβ
Cascade is a protocol that allows users to store data permanently in a highly redundant, distributed fashion with a single upfront fee.
Sense is a lightweight protocol on the Pastel Network, built to assess the relative rareness of a given NFT against near-duplicate meta-data. Sense can recognize even the most subtle similarities between two digital collectibles, even if one has been transformed. The protocol goes beyond the standard βdigital fingerprintβ approach to establishing the rareness of an NFT, and actually looks at the rareness of the pixel patterns in data. While digital fingerprints do allow users to verify that an NFT was created by a particular creator, this is a fairly weak form of rareness. Sense solves this problem by assigning a βRelative Rareness Scoreβ to quantify how rare an NFT is relative to all NFTs in the underlying dataset.
Uploading files to Cascade and Sense Protocolβ
To upload files to Cascade and Sense protocol, you need gateway api key.
Upload files to Cascade Protocolβ
You can use CascadeUploader of @lukso/data-provider-cascade
library to upload files to Cascade Protocol and retrieve result id and ipfs link.
import { createReadStream } from "node:fs";
import { CascadeUploader } from "@lukso/data-provider-cascade";
import { config } from "dotenv";
config({ path: "./.env.test" });
const provider = new CascadeUploader(
process.env.CASCADE_API_KEY || ""
);
const file = createReadStream("./examples/test-image.png");
const result = await provider.uploadToCascade(file);
if (result) {
console.log(result.ipfs_url);
}
Upload files to Sense Protocolβ
You can use SenseUploader of @lukso/data-provider-sense
library to upload files to Sense Protocol and retrieve result id and ipfs link.
import { createReadStream } from "node:fs";
import { SenseUploader } from "@lukso/data-provider-sense";
import { config } from "dotenv";
config({ path: "./.env.test" });
const provider = new SenseUploader(
process.env.SENSE_API_KEY || ""
);
const file = createReadStream("./examples/test-image.png");
const result = await provider.uploadToSense(file);
if (result) {
console.log(result.ipfs_url);
}
Retrieve activation ticket transaction idβ
To get activation ticket transaction status and id, you can use retrieveTxId
funciton of provider.
const { result_id } = await provider.uploadToCascade(file);
const { status, tx_id } = await provider.retrieveTxId(result_id);
console.log(tx_id);
Add Cascade and Sense's result id and activation ticket id to metadataβ
After you upload files to Cascade and Sense protocol, you need to save those information at metadata of nft.
{
... other properties
cascadeId: "fc67a80d-0d4a-4065-868f-8c9bd1d0efb6", // Cascade upload result id
cascadeTxId: "4482769c-7256-4339-97ad-f563c11e38ad", // Cascade Activation Ticket TxId
senseId: "3959c860-ccbd-402c-8617-6cdac8cfef7f" // Sense upload result id
senseTxId: "b1641fd0-328a-4c62-913b-3e7414c3b154" // Sense Activation Ticket TxId
}