Giter VIP home page Giter VIP logo

lighthouse's Introduction

Lighthouse Node

This project provides a way for Ethereum smart contracts to request Filecoin storage of CIDs in IPFS via Powergate. Hence, Ethereum developers can use this to request verifiable storage of data to Filecoin from Ethereum smart contracts.

Website

http://lighthouse.ninja

Blog Post

Read more about it on the blog here - https://nanditmehra123.medium.com/lighthouse-filecoin-ethereum-cross-chain-infra-project-66c041a1a1db

Demo Video

https://vimeo.com/552468707
https://www.youtube.com/watch?v=E2-cfbdSXtM

alt text

The parser at src/parser:

  1. Takes data feed from external sources VulcanizeDB.
  2. Parses the data feed into a set of parameters which can be passed to the storage-adapter.

The Storage adapter at src/storage-adapter:

  1. Accepts the arguments passed from the parser. (storage adapter is modular enough to be taken out of this repo and used as an dependency. It can be used by any other project.)
  2. Uses the arguments passed to store the data (cid) according to the config.
  3. Publishes storage status via websocket.

How to run

  1. Clone this repo
  2. Open a terminal window and run > npm install
  3. To start the lighthouse node run > node src/index.js

Now the lighthouse node is up and running, feel free to run it locally on your system or host on a server.

This node also starts a socket.io server at port 3002 with which a socket.io client can interact to get the storage info of a file.

Sample code for socket.io client -

const io = require("socket.io-client");
const socket = io("ws://localhost:3002");

// handle the event sent with socket.send()
socket.on("message", data => {
  console.log(data);
});

socket.on("connect", () => {
  // or with emit() and custom event names
  socket.emit("cid", "QmbazJSQWTwmtAFqDgqxMG5JxGhg3kgYwdapaQDMM88HTP"); // put in your <cid> here for which storage-info is requested
});

// handle the event sent with socket.emit()
socket.on("storageInfo", (storageInfo) => {
  console.log('storageInfo for cid:', storageInfo);
});

Use Truffle box to Interact with Lighthouse

Demo Video - https://vimeo.com/552468707

  • make a new directory -
          mkdir lighthouse

  • cd into that -
          cd lighthouse

  • run the following command -
          truffle unbox nandit123/lighthouse

  • Install the packages -
          npm i

  • Compile Smart Contracts -
          truffle compile

  • Migrate and Deploy -
          truffle migrate --network rinkeby

  • Now start truffle console using -
          truffle console

  • Run the following command to get the instance of the deployed smart contract -
          let specificInstance = await FPS.at("0xdFEa08D7c2B43498Bfe32778334c9279956057F0");

  • Now run this command to store data to filecoin -
          let result = specificInstance.store("sampleCid", "SampleConfig");

  • You can get the transaction hash of the previous call by typing in -
          result

  • To get the storageInfo replace your cid in the client.js file and run -
          node client.js

lighthouse's People

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.