A Web3 App for Storing Files in a decentralized secure way using IPFS and Ethereum Blockchain with Truffle and VueJs
- Decentalized storage of files
- Files are encrypted and decrypted in browser
-
Nodejs
-
Truffle
-
Metamask
Clone the project
git clone https://github.com/dine-5h/defile
Go to the project directory
cd defile
Install dependencies
npm install
Copy secret phrase from Metamask wallet and paste in 'truffle-config.js' and paste in MEMONEIC variable
const MEMONEIC="Paste your wallet secret phrase if you using sepolia or other testnet";
To start truffle development server (skip if you use sepolia)
npx truffle develop
To compile the solidity smart contract, run
npx truffle compile
deploy smart contract to truffle test net
npx truffle migrate --network development
Change the sepolia section in 'truffle-config.js'
const HDWalletProvider = require("@truffle/hdwallet-provider");
const sepoliaTestNetUrl="Paste your sepolia test net url";
const MEMONEIC="Paste your wallet secret phrase if you using sepolia or other testnet";
module.exports = {
networks: {
development: {
host: "http://127.0.0.1",
port: 9545,
network_id: "1337",
gas: 5000000
},
sepolia:{
provider:()=>{
return new HDWalletProvider(MEMONEIC,sepoliaTestNetUrl)
},
from:"Paste your sepolia address",
network_id:11155111,
gas:5500000,
gasPrice: 50000000000,
networkCheckTimeout: 1000000,
timeoutBlocks: 200
}
}
Variables to modify
- sepoliaTestNetUrl
- MEMONEIC
- 'from' key value in sepolia object
deploy smart contract to Sepolia Test net
npx truffle migrate --network sepolia
https://trufflesuite.com/docs/truffle/how-to/truffle-with-metamask/
https://www.alchemy.com/overviews/how-to-add-sepolia-to-metamask
After configuring the Metamask wallet run the server
Web3.storage signup is completely free and provides 150 GB of storage space for free
The following article shows how to generate api key
https://web3.storage/docs/how-tos/generate-api-token/
use your web3.storage api key in 'src/store/store.js'
...
export const Store = defineStore('Store',{
state: () => ({
account:null,
files: [],
Metamask:false,
isAuth:false,
key:null,
dfile:null,
ipfs:"Paste your web3.storage api key here"
}),
...
use api key in 'ipfs' key value
npm run dev
and localhost at port number 3000
http://127.0.0.1:3000