FastFS is a decentralized file storage system built on the NEAR blockchain that allows users to upload and serve files through a standardized protocol. Files are stored on-chain and served through a web interface with predictable URLs.
FastFS uses NEAR blockchain transactions to store file data. When a file is uploaded, it becomes accessible via a URL that combines the transaction's predecessor ID, receiver ID, and the file's relative path.
Files uploaded to FastFS are accessible via URLs with the following format:
Example:
mob.near
= predecessor_id (uploader)fastfs.near
= receiver_id (can be any account)fastnear.png
= relative_path (filename)All FastFS uploads must use the function call method:
Arguments must be serialized using the Borsh format with the following schema structure:
Create a FastFS data structure:
Use Borsh serialization to encode the data:
Send a NEAR transaction with:
__fastdata_fastfs
The FastFS system enforces the following validation rules:
null
for file deletion)Here's a complete example of uploading a file to FastFS:
The FastFS indexer processes transactions and stores the following data in ScyllaDB:
Files can be removed by uploading without content by setting the content
field to null
:
This will remove the file from the FastFS system.
Common validation failures:
For easy file uploads, you can use the web-based drag and drop interface:
This documentation provides a complete guide for implementing FastFS file uploads. The system provides a decentralized, blockchain-based file storage solution with predictable URL patterns and robust validation.