Code Monkey home page Code Monkey logo

ipfs-file-upload's Introduction

Description

This is a image uploader that will allow users to store their files on IPFS, the interplantary file system (https://ipfs.io/). It uses React and a lot of code from a pre-built Truffle box, with custom components throughout. An updated version of this will have administrative capabilities to allow for unlimited file-size uploads.

Assumptions and Dependencies

• Ganache (CLI or GUI) • Truffle • React • Infura • node.js • ipfs-api • getweb3.js • Chrome with Metamask tied to Ganache

Steps to Run

Have Ganache running and connected to Metamask via Custom RPC

  1. Git clone
  2. cd ipfs-file-upload
  3. truffle compile
  4. truffle migrate (use --reset if there are issues)
  5. truffle test
  6. npm run start
  7. Chrome should open. Make sure Metamask is set to the custom RPC account.
  8. Select choose file and browse for a test image file
  9. Click Sumbit and wait for Metamask to open
  10. Check payment amount and choose Submit
  11. Your image should appear in the window. To test that it is not stored locally, simply refresh the page.

Technical details

A lot of this happens within the javascript components (App.js) wherein calls are made to IPFS via React to Infura, after the contract is initated files are stored on IPFS and the Ethereum Blockchain. I have had some issues getting Metamask to offer a nonce that is different than what is offered by Ganache, this remains a bit of a stumbling block. getweb3.js is a client-side app that connects to the blockchain via metamask. Metamask is a chrome plugin that allows you to transform your browser into a full web3 browser. This uses Infura as a means of connecting to IPFS.

Security

While I realize there are limited tests, I have not found any vulnerabilities within the code itself, either the .sol contracts or within the .js code. Since it utilizes many outside resources (Infura, web3/metamask) I can't tell if there would be a vulnerability there, or during the handoff of communications. Ether is passed through metamask during the file upload process to pay for the gas required for the upload itself.

Unfinished components

I wanted to offer administrative rights to allow unlimited file sizes for 'onlyOwner' (admins), whereas non-admin users would only be allowed to upload certain (<200k) files. This remains unimplemented in the project.

ipfs-file-upload's People

Contributors

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