lanxeon / blockchain-cloud-deduplication

Miniproject to use blockchain as a middle layer to the cloud to deduplicate cloud data on client side through file hashes and public key encryptions.
1 stars 4 forks source link

NO ETHEREUM CLIENT DETECTED. INSTALL METAMASK #2

Open xujiaman opened 3 years ago

xujiaman commented 3 years ago

I ran testrpc to build a test chain ,linked metamask to it and then migrated the contracts. After executing npm start, I got

Welcome, new User! In order to get started, just make an alias. This will be your identity you use to share files with others... kind of like a username NO ETHEREUM CLIENT DETECTED. INSTALL METAMASK from the homepage.

And the information in the console is:

[HMR] Waiting for update signal from WDS... react-dom.development.js:24994 Download the React DevTools for a better development experience: https://fb.me/react-devtools App.js:34 Entered componentDidMount App.js:59 TypeError: Cannot read property 'enable' of undefined at App.loadBlockchainData (App.js:71) at App.componentDidMount (App.js:37) at commitLifeCycles (react-dom.development.js:19814) at commitLayoutEffects (react-dom.development.js:22803) at HTMLUnknownElement.callCallback (react-dom.development.js:188) at Object.invokeGuardedCallbackDev (react-dom.development.js:237) at invokeGuardedCallback (react-dom.development.js:292) at commitRootImpl (react-dom.development.js:22541) at unstable_runWithPriority (scheduler.development.js:653) at runWithPriority$1 (react-dom.development.js:11039) at commitRoot (react-dom.development.js:22381) at finishSyncRender (react-dom.development.js:21807) at performSyncWorkOnRoot (react-dom.development.js:21793) at scheduleUpdateOnFiber (react-dom.development.js:21188) at updateContainer (react-dom.development.js:24373) at react-dom.development.js:24758 at unbatchedUpdates (react-dom.development.js:21903) at legacyRenderSubtreeIntoContainer (react-dom.development.js:24757) at Object.render (react-dom.development.js:24840) at Module../src/index.js (index.js:7) at webpack_require (bootstrap:784) at fn (bootstrap:150) at Object.1 (serviceWorker.js:141) at webpack_require (bootstrap:784) at checkDeferredModules (bootstrap:45) at Array.webpackJsonpCallback [as push] (bootstrap:32) at main.chunk.js:1 UserFiles.js:24 [UserFiles] -> ComponentDidMount`` GET http://localhost:3001/user/bandwidth/null net::ERR_CONNECTION_REFUSED GET http://localhost:3001/user/files/null net::ERR_CONNECTION_REFUSED Uncaught (in promise) Error: Network Error at createError (createError.js:16) at XMLHttpRequest.handleError (xhr.js:83) Uncaught (in promise) Error: Network Error at createError (createError.js:16) at XMLHttpRequest.handleError (xhr.js:83)

I can't figure out what my problem is. Would you give me some help?

lanxeon commented 3 years ago

Hi, have you installed Metamask, and connected it to the Truffle blockchain? I have not mentioned various steps to run this because I never expected anyone would want to try this out.

xujiaman commented 3 years ago

Your codes help me a lot, thanks! I've installed Metamask and connected it to localhost:8545(the default port of testrpc). The following instructions were executed in turn: npm install testrpc truffle migrate and connected Metamask to localhost:8545 npm start Then the errors mentioned in the last comment occured. I had no idea what to do next.

xujiaman commented 3 years ago

I upgraded Metamask ,the errors changed. Ubuntu18 04-xjm3eth_success-2021-03-01-10-33-33 Ubuntu18 04-xjm3eth_success-2021-03-01-10-36-04

lanxeon commented 3 years ago

Yeah, my bad. I never really explained how this app is supposed to work. This is not a pure Dapp, but more of a semi-Dapp since there is a backend where the files will be stored. To run the backend server: Open another terminal/cmd in the same directory, and run npm run dev.

Another important step to ensure that the client-side app works with Metamask correctly is to follow the below steps:

  1. after using truffle migrate, navigate to /build/contracts/FileCheck.json. You will find a JSON object with several properties. The 2 important ones you have to look out for is ABI and networks.
  2. Copy the entire ABI property, and navigate to /src/config/contract.js. In the line export const ABI =, paste the ABI object/array that you copied.
  3. Now navigate back to /build/contracts/FileCheck.json, and copy-paste the value of the address property in the networks object. It should be a hex string of length 16. Copy-paste that into the line export address = line in /src/config/contract.js.

It should now work with Metamask. Sorry for the late reply, and for the lack of explanation. I never expected anyone to actually take any interest in running the app. I will try making a detailed README when I get the time. If you come across any other issues running the app, feel free to tell me.

PS: I will be making several changes on the app from here on out to connect the backend to the blockchain and check the file ownership status from the smart contracts directly, as well as general improvements in the workflow, etc. I am also going to change my MongoDB password and move the MongoDB connection URL to a .env file (BIG OOPS).

lanxeon commented 3 years ago

Your codes help me a lot, thanks! I've installed Metamask and connected it to localhost:8545(the default port of testrpc). The following instructions were executed in turn: npm install testrpc truffle migrate and connected Metamask to localhost:8545 npm start Then the errors mentioned in the last comment occured. I had no idea what to do next.

I believe you need to run truffle compile before running truffle migrate and the following steps.

xujiaman commented 3 years ago

Thanks for your generous help. I've tried to run npm run dev ,but it failed again. It seems like lack of packages, but I can't figure it out. Ubuntu18 04-xjm3eth_success-2021-03-18-17-01-57

lanxeon commented 3 years ago

Really sorry for the late reply, I'm not sure how but this completely missed my radar, if you're getting an error of that sort, it would mean that the UserRoutes file cannot be found. Please ensure that the "/routes/UserController.js" file exists.