This is my submission for the Consensus 2024 Hackathon. The project aims to demonstrate how files can be uploaded to the Polkadot network using Substrate and Subsquid. The project consists of a Next.js web application that allows users to upload files to the Polkadot network and a SubSquid indexer that indexes the uploaded files.
The demo of this project is available at https://consensus-hackathon-2024.vercel.app//.
This project consists of two main components:
- A Next.js web application located in the
web
directory. - A set of SubSquid indexers located in the
indexers
directory. (One for each supported network)
- Node.js (>= 14.x)
- Yarn or npm
- Docker (for the SubSquid indexer)
-
Navigate to the
web
directory:cd web
-
Install dependencies:
yarn install
-
Create a
.env
file in theweb
directory and add the required environment variables. Use the provided.env.sample
as a reference. -
Start the development server:
yarn dev
The web application should now be running at http://localhost:3000.
-
Navigate to the
indexers
directory:cd indexers/<network>
-
Copy the example environment file and modify it as needed:
cp .env.sample .env
-
Install the required dependencies:
npm ci
-
Start the SubSquid Docker:
sqd up
-
Start the indexing process:
sqd process
-
Start the graphql endpoint/playground:
sqd serve
The indexer should now be running.
- Visit http://localhost:3000 to access the file upload interface.
- Follow the on-screen instructions to upload a file to the Polkadot network.
- You can choose different networks (Polkadot, Kusama, Autonomys Testnet, Polkadot Testnet) and the file will be chunked and uploaded accordingly.
- The SubSquid indexer is designed to index data from the Polkadot network.
- Ensure that the Docker containers are running correctly by checking the logs:
docker-compose logs -f
. ├── web │ ├── components │ │ ├── ConnectWalletModal.tsx │ │ ├── FileUploader.tsx │ │ └── ... │ ├── constants │ │ └── networks.ts │ ├── hooks │ │ ├── useFileUploader.ts │ │ └── useWallet.ts │ ├── pages │ │ ├── index.tsx │ │ └── ... │ ├── public │ │ ├── logo.png │ │ └── ... │ ├── styles │ │ └── globals.css │ ├── utils │ │ ├── truncateFileName.ts │ │ └── ... │ ├── .env.sample │ └── ... └── indexer ├── docker-compose.yml ├── .env.sample └── ...
This project is licensed under the MIT License. See the LICENSE
file for details.
The source code for this project is available at https://github.com/FileOnchain/fileonchain-web.