Overview
Irys is a datachain, a blockchain optimized for data storage. Irys is built to store, retrieve, and process datasets of any size with minimal latency.
Irys makes it easy to store your data onchain by supporting payments with ETH on Linea. You can upload data with a single upfront payment, with guaranteed retrieval for a duration you set at the upload time — from a few days to forever.
Data on Irys is fully verifiable; you can inspect the blockchain at any time and verify what data was posted, when, and where it's located in Irys's data ledgers.
Use Irys with Linea
Irys is chain agnostic; smart contracts on Linea can link to data on Irys.
You can:
- Deploy NFT contracts on Linea and have images and metadata on Irys
- Build games with state on Linea and visual assets on Irys
- Build an onchain identity protocol with user metadata on Irys
- Build a cross-chain bridge and use Irys to store messages
You can use ETH on Linea to pay for permanent storage on Irys.
Pay for uploads
Irys has a "pay once, store forever" payment model based on the number of bytes you upload.
Free uploads
Uploads of less than 100KiB are free on Irys.
Receipts
Each upload to Irys is given a cryptographically signed receipt that can be trustlessly verified.
Receipts are a JSON object with the following format:
{
id: '1Txlbl5NgEqUbIkDnnunHC0gFx0n8_Y92zAsoX54kI8',
timestamp: 1676891681110,
version: '1.0.0',
public: '...',
signature: '...',
deadlineHeight: ...,
}
Field | Description |
---|---|
id | Transaction id (used to download the data) |
timestamp | Timestamp (UNIX milliseconds) of when the transaction was created |
version | The version of this JSON file, currently 1.0.0 |
public | Public key of the bundler node used |
signature | A signed deep hash of the JSON receipt |
deadlineHeight | The block number by which the transaction must be finalized on Arweave |
Pay for users' uploads
Use balance approvals to pay for your users' uploads and build a web2-style UX that saves users from having to convert fiat or own tokens.
With balance approvals:
- You pay for transactions.
- Users sign transactions.
Create an approval
const receipt = await irysUploader.approval.createApproval({
amount: irysUploader.utils.toAtomic(1), // Amount in atomic units
approvedAddress: "<address>",
expiresInSeconds: 100, // Expires in 100 seconds. Delete to remove expiration.
});
Upload using an approval
const receipt = await irysUploader.upload("GM World", {
upload: { paidBy: "<address>" },
});
Tagging
Irys supports attaching up to 20 metadata tags to each transaction. Tags are indexed and can be queried.
// Your file
const fileToUpload = "./myNFT.png";
const tags = [{ name: "application-id", value: "foo" }];
try {
const response = await irysUploader.uploadFile(fileToUpload, { tags });
console.log(`File uploaded ==> https://gateway.irys.xyz/${response.id}`);
} catch (e) {
console.log("Error uploading file ", e);
}
Querying
Transaction metadata can be queried using the Irys's GraphQL.