Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origin not able to connect to blockchain network using Metamask extension #642

Closed
RohitGupta027 opened this issue Mar 5, 2020 · 5 comments
Labels
question Further information is requested

Comments

@RohitGupta027
Copy link

Based on the documentation, I was trying to bootstrap origin application (backend, frontend, ganache) on my machine using yarn run:origin. Application boots up without any errors but as long as I access URL http://localhost:3000/devices/production, Metamask extension asks to connect to Blockchain network which is running on http://localhost:8545/ (as a part of yarn run command)
I have imported all the accounts on Metamask by providing seed phrase from ganache-cli running locally. But UI shows Please check your blockchain network and connect to correct and web console throws below error

sagas.js:205 ContractsSaga::WrongNetwork Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.
    at ABICoder.../../node_modules/web3-eth-contract/node_modules/web3-eth-abi/src/index.js.ABICoder.decodeParameters (index.js:226)
    at Contract.../../node_modules/web3-eth-contract/src/index.js.Contract._decodeMethodReturn (index.js:471)
    at Method.outputFormatter (index.js:824)
    at Method.../../node_modules/web3-eth-contract/node_modules/web3-core-method/src/index.js.Method.formatOutput (index.js:165)
    at sendTxCallback (index.js:540)
    at index.js:147
    at inpage.js:1
    at inpage.js:1
    at i (inpage.js:1)
    at inpage.js:1

Can you let me know which step am I missing here?

@e00dan
Copy link
Contributor

e00dan commented Mar 5, 2020

Hello @RohitGupta027! Thanks for asking!

For me yarn run:origin works just fine.

What happens often though is if you kill Ganache and then start another instance, MetaMask caches some values about the previous one, and MetaMask doesn't work correctly with the new Ganache instance. The solution for that problem is simple: switch to other network in MetaMask (for example to main net) and then switch back to Localhost 8545.

In case you have a different problem, check yarn run:origin logs for any errors. I'm more used to running separate commands, instead of yarn run:origin, so I have finer control. You can try it as well (use separate terminal sessions):

yarn run:ganache
yarn run:backend
yarn run:demo && yarn run:simulator
yarn run:ui

Please let me know if this works for you. Also, take a close look and search for errors in logs - please post them here so I can assist you further.

@e00dan e00dan added the question Further information is requested label Mar 5, 2020
@RohitGupta027
Copy link
Author

Hello @kuzirashi Thanks for a quick response. I have actually tried your solution to switch it to other networks but didn't work for me, I guess Metamask cache is the problem. However, running separated commands as you suggested works like a charm 👍
Can you help me pointing out the documentation/resource where I can see the workflows as well to be able to understand how to use the application now?

@JonathanWfels
Copy link
Contributor

Hey @RohitGupta027 we are currently working on extensive documentation but it is all still a work in progress. To get a better idea about the project you can already check out: https://energyweb.atlassian.net/wiki/spaces/OD/overview

The page will grow a lot, so keep checking it for more content.

@e00dan
Copy link
Contributor

e00dan commented Mar 9, 2020

I believe the original issue has been solved. Feel free to open another issues if you encounter them. Thanks!

@e00dan e00dan closed this as completed Mar 9, 2020
@RohitGupta027
Copy link
Author

RohitGupta027 commented Mar 11, 2020

@kuzirashi I tried to run all 4 commands in different tabs as you suggested but again started getting the same issue like earlier Please make sure you've chosen the correct blockchain network and the contract address is valid. I have switched to another network to clean caches also I have reinstalled the metamask many times but with no success. This is a very strange issue not sure if you faced this issue ever or not. Any tips/suggestions on how to much metamask with the application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants