ayush18023 / IPFS_Blockchain_app

Storing files on IPFS and storing hashes on blockchain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Skeleton of a IPFS-Ethereum Storage System

Step-1 - Run npm install command for installing all the dependencies

npm i

Step-2 - Compile the Hashes.sol contract

npx hardhat compile

After this an artifact file will be made inside the src folder which contains the JSON file with the ABI code inside it.

Step-3 - Now initiate a local blockchain network

npx hardhat node

Step-4 - Deploy the contract to the blockchain

npx hardhat run scripts/deploy.js --network localhost

here the output will be

Hashes deployed to: (hexadecimal address)

Copy that address and paste it into the hashesAddress global variable in the IPFS.js and Search.js files under 'Components' folder under 'src'

Step-5 - Start the frontend of the application on the browser

npm start

Step-6 - Install Metamask Extension onto the browser and login or create an account. Enable show local/test networks in the metamask settings. Switch to localhost:8545 Click on import an account on metamask then copy the private key of one of the accounts shown during step-3 and paste it to import that account onto your metamask

NOW, Upload file(s) then click the 'Submit' button and then click the 'ADD TO BLOCKCHAIN' button, this will ask for a payment through metamask, confirm the payment and then the file's hash will be stored on the blockchain.

You can Search for files by clicking the Search button and entering the file name with the file extension For eg: 'ABC.pdf'

After entering the file name then click on Search after that your file will be visible click on it then your file will be downloaded.

About

Storing files on IPFS and storing hashes on blockchain


Languages

Language:JavaScript 78.4%Language:HTML 10.6%Language:CSS 8.7%Language:Solidity 2.3%