- Create a file registry on-chain. Upload the files to the IPFS and then store the CID in a smart contract against an upload ID.
-
Implement a File Registry based on the smart contract that allows users to store file information on-chain. Contract should support following read and write operations:
- function save(string filePath, string cid) - save the data in the registry
- function get(string filePath) public view returns (string) - gets the cid of the file using the filePath
-
Implement an API service with the following routes:
-
POST /v1/files
- Argument: file and filePath
- Uploads it to the IPFS node using one of the client libraries. IPFS client will return the cid for the uploaded file.
- Saves the data in the File Registry.
-
GET /v1/files?filePath=/dumy.txt
- Argument: filePath as queryString
- Get the data from the File Registry and return the CID to the client.
-
-
Install docker.
-
Copy
backend/.env.example
and rename it to.env
. -
Start docker container.
make up
If it doesn't work, use this command.
docker compose up
-
Stop docker container.
make down
If it doesn't work, use this comand
docker compose down
-
You can see swagger documentation at this url.
- We are interested in your code management and development skills, so please solve the problem keeping that in mind.
- The API service needs to be developed in Golang.
- You are free to use any Ethereum test network, or a local environment (eg. ganache)
- Please ensure that the coding conventions, directory structure and build approach to your project
- The codebase should contain a docker-compose file that sets up the API and IPFS node in a docker environment.
-
Deploying Smart Contracts
-
Running an IPFS Node
-
Go IPFS Client