Code Monkey home page Code Monkey logo

ipfs-dapp's Introduction

IPFS Storage

This repository provides an implementation of DApp for use of IPFS with PNG images. It contains the following components: a smart contract that stores the CID of files for users, tests for it, a script for the deployment of the contract and a frontend.

Overview

Please note that you will need an Ethereum node to run (the frontend is focused on the local network), but you will not need to run an IPFS node yourself. All the details of working with IPFS are encapsulated.

Frontend

The frontend provides the following opportunities:

  1. You can upload a photo from your computer and upload it to IPFS using the "Upload" button;
  2. Using the "Download" button, you can download the last image saved in IPFS.

Quick start

To run this program, you first need to install the dependencies. This is done with the following command:

$ npm install

Next, you will need to launch a local Ethereum node, into which the contract will be shared in the future. It is recommended to do this in a separate terminal:

$ npx hardhat node

You can deploy contracts using the deploy script.js, it also automatically fills in the frontend configuration files, so other ways to embed a smart contract are not recommended for use:

$ npx hardhat run scripts/deploy.js --network localhost
Compiled 2 Solidity files successfully
Deploying the contracts with the account: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
Storage's address: 0x5FbDB2315678afecb367f032d93F642f64180aa3

The frontend is implemented on React, so you also need to install dependencies to run it. The frontend itself is started by the start command:

$ cd frontend/
$ npm install
$ npm start

Tests

To run smart contract tests, use the following command:

$ npx hardhat test


  Storage contract
    ✔ Deployment (1342ms)
    ✔ The user should not have files in the newly created contract
    ✔ After sending the hash to the smart contract, it can be received when calling getter (44ms)
    ✔ The contract should emit an event when registering a hash


  4 passing (1s)

ipfs-dapp's People

Contributors

ipodtsepko avatar

Watchers

 avatar  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.