Coder Social home page Coder Social logo

florolf1 / florolf-ipfs-gateway Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.01 MB

Storing data in IPFS (InterPlanetary File System) and the file's hash in the blockchain utilizing IPFS HTTP client library.

License: MIT License

HTML 8.66% CSS 3.41% JavaScript 80.20% Solidity 7.73%

florolf-ipfs-gateway's Introduction

IPFS Demo

Storing data in IPFS and the file's hash in the Ethereum blockchain.

Logo

Goals for IPFS Blockchain Project

A blockchain smart contract system that integrates to IPFS.

  • Upload a file to IPFS from webpage and get the hash
  • Store hash on blockchain in smart contract
  • Read back hash from the smart contract
  • Retrieve file from IPFS using hash
  • Display on webpage

Problem

  • Storing data on Ethereum is expensive
  • Storing data in a central database is not distributed

Solution

  • IPFS is distributed
  • IPFS uses the cryptographic hash as the storage and lookup index
  • IPFS breaks the file into blocks and the blocks are stored all over the network
  • IPFS maintains an index to find the closest copies of all of the blocks to retrieve the file
  • Store the hash in the blockchain

Screenshot

Logo

Tech Stack

Client: IPFS, React

Local IPFS

ipfs init
  • Check out the quick-start
  • In a new terminal window run
ipfs daemon

React interface to IPFS

  • Create your react app
npm install -g create-react-app
npx create-react-app ipfs
cd ipfs
npm install fs-extra
npm install ipfs
  • Connect to your local IPFS
  • Make an ipfs.js file
const ipfsApi = require(‘ipfs-api’);
const ipfs = new ipfsApi(‘localhost’, ‘5001’, {protocol:‘http’});
export default ipfs;
  • Upload file

    • Open file
    • Save to buffer
    • Call ipfs add
    • Save the hash that is returned
  • Retrieve file

    • Need the hash
    • Buffer to read to
    • Call ipfs get
    • Write buffer out to a file

Author

"Buy Me A Coffee"

Support

For support, email [email protected] or join our Slack channel.

This project was bootstrapped with Create React App.

Appendix

Further Links

florolf-ipfs-gateway's People

Contributors

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