Giter VIP home page Giter VIP logo

btfsfile's Introduction

Introduction

BTFSFile is a demonstration DApp which combines BTFS with the TRON blockchain. Using the existing IPFS JS SDK, developers can create their own decentralized applications leveraging a file storage and sharing solution.

The DApp deployment steps consist of:

  1. Deploying the smart contract to the TRON network.
  2. Initializing and launching a BTFS daemon.
  3. Updating the DApp variable config file with the depoyed contract address.
  4. Uploading the DApp to BTFS via the daemon.
  5. Pinning the DApp via BTFS name publish.

Requirements:

  • ipfs-http-client
  • tronweb
  • browserify - $ browserify source.js -o app.js

Launching a BTFS Daemon

You can launch the BTFS daemon on either your local machine or on a server. In the end, the DApp files will be pinned to the BTFS network. To install and deploy BTFS, follow the BTFS Installation instructions from the developer documentation.

Smart Contract Deployment to TRON

Smart contract deployment can be achieved via Tron-Box.

Update the DApp Variable Config File

In the vars.json configuration file, update the contractAddr field to your deployed contract address. Update the baseURL to the BTFS gateway and the hostIpAddr to the API gateway.

{
	"contractAddr" : "",
	"defaultUserAddr" :"",
	"nodeURL" : "",
	"hostIpAddr" : "",
	"tipConversion" : "",
	"baseURL" : ""
}

Upload the DApp to BTFS

Upload the DApp directory to BTFS using the btfs add -r command:

User-MacBook-Pro:applications user$ btfs add -r appfolder
added QmPL71PEun4sRfVFFQbvCixDcfaAnvA4GFJzQMaaiVbuUA appfolder/admin.html
added QmPraNCTJbTkWGSqSSTMsdWioWDjhUVbr4paUadgbBzDUW appfolder/app.css
added QmWm31CwBhxre7DZ6F9qXHttomfeA8m9Ec6PX1a9vQodAT appfolder/app.js
added QmeRLS9TfoouuoCpJf4ujnuo4K13xnSeQV5qvutjkgPuBE appfolder/imgs/like.svg
added QmbxLM4g8qhYBu5FdTa21mH7ajzgNouBXdNNRjHek9RwXp appfolder/imgs/magnifier-tool.svg
added QmQrc63s97b2aj3phfq9BGmnor8hPJPmbT2TzxF2nxT3Lh appfolder/imgs/thumbs.svg
added QmNMAnqrVHqCrbmVgCyg1tPn79UaRkmHmqceYSfFeg5k5c appfolder/imgs/tron.svg
added QmReRFMURESs5fZ2mRVMaWJTGSmVbdWP4aZDQYR1G8RWvd appfolder/imgs/user.svg
added QmU3cFYKnov8dGzCHezJpSdPTwMVk9BjQiK87HqzR753oc appfolder/index.html
added QmaBdF4HZFHGSQi56SnfTQXhSPDUdTuFoC2RGoWpzKQXZ3 appfolder/package.json
added QmXZRA7qNdKCQFTRDR6MrSn8wUsiSw1DxZtEuFdZLKeJfn appfolder/source.js
added QmRL9LoaUfQmvrpkQrC68MQi6E3vowqJaZMJ58YRZtpaSA appfolder/upload.html
added QmdGvionorjntbQY1k2nfjNDoMjmwHtVppnKVjcsAgSygm appfolder/vars.json
added QmYC2xQXx2k7wkqudEL8u8HmQXFHMgiMmSfRPZETSMUwYM appfolder/imgs
added QmYw7aKqffvi9eArbX5SBZ5W6HRVqm82Mu6k6Eh6aoG9fx appfolder
 9.18 MiB / 9.18 MiB [=======================================================================] 100.00%
 

Pin the DApp

Run the btfs name publish <hash> where represents the hash value of the uploaded directory:

Published to QmUYEVd5fTDPaTxmp9rYkKN9FV9hdZLitZq6iGfZTYeQUm: /btfs/QmYw7aKqffvi9eArbX5SBZ5W6HRVqm82Mu6k6Eh6aoG9fx

btfsfile's People

Contributors

tycm4109 avatar c201808 avatar

Watchers

James Cloos 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.