truffle-box / react-box

Truffle, Webpack and React boilerplate.
https://truffle-box.github.io/
MIT License
736 stars 251 forks source link

Difference between Metamask Enabled and Disabled #29

Closed vertangelx closed 5 years ago

vertangelx commented 7 years ago

I ran the example with Metamask disabled and the stored value is correctly shown as 5.

However when I enable the Metamask plugin in Chrome, the Metamask window appears asking for the transaction to be approved, before the SimpleStorage method set is called.

simpleStorageInstance.set(5, {from: accounts[0]})

Can someone please explain why the transaction is automatically approved/signed when Metamask is disabled, but not when Metamask is enabled?

stephledev commented 6 years ago

This is obviously a security feature of MetaMask. Just imagine if they didn't ask for approval. Some malicious dApp could easily steal all your coins with a simple transaction. If no injected web3 library is detected in the browser, truffle will load a web3 library on its own and by default connect to the localhost. Depending on your local client (e.g. testrpc), transaction calls will be automatically signed.

matthhong commented 6 years ago

What is this transaction, by the way? And where do I find the code that creates this transaction?

Edit: Oh, it's just the gas price for setting the variable. Didn't realize the default type for local variables like uint storedData is storage.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been closed, but can be re-opened if further comments indicate that the problem persists. Feel free to tag maintainers if no there is no reply to further comments.