Giter VIP home page Giter VIP logo

decentralized_google_drive's Introduction

Sample Hardhat Project

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.

Decentralized Google Drive Overview

This is a decentralized Google Drive project implemented using Solidity, Hardhat, EtherJS, and Pinata. It allows users to store and retrieve images in a decentralized manner.

Prerequisites

Node.js Hardhat EtherJS Pinata account Setup

Clone this repository. Install the dependencies: npm install Create a Pinata account and obtain your API key and secret. Add your API key and secret to the .env file. Deployment

Deploy the smart contract to a blockchain network: npx hardhat run scripts/deploy.js --network Replace with the name of the blockchain network you want to deploy to, such as localhost or rinkeby.

Once the smart contract is deployed, copy the contract address. Usage

To store an image in the decentralized Google Drive, you will need to call the uploadImage() function in the smart contract. You can do this using a Web3 library, such as EtherJS.

const web3 = new Web3(ethereum.provider);

const contract = new web3.eth.Contract( [ // ABI of the smart contract ], contractAddress );

const image = await contract.methods.uploadImage(imageBuffer).send({ from: accountAddress }); Replace with the buffer of the image you want to upload. Replace with the address of the Ethereum account you are using.

Once the image is uploaded, you can retrieve it using the getImage() function in the smart contract.

const image = await contract.methods.getImage(imageId).call(); Replace with the ID of the image you want to retrieve.

Conclusion

This is a simple example of how to create a decentralized Google Drive using Solidity, Hardhat, EtherJS, and Pinata. You can use this as a starting point to build your own decentralized storage application.

Additional Notes

You can use a frontend framework, such as React or Vue, to build a user interface for your decentralized Google Drive. You can use a decentralized file sharing network, such as IPFS or Swarm, to store the images. You can use a smart contract to implement additional features, such as access control and encryption.

Try running some of the following tasks:

npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.js

decentralized_google_drive's People

Contributors

debshibraj123 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.