status-im / dappcon-workshop-dapp

DApp to be used in Dappcon
4 stars 3 forks source link

Metamask Ether Balance #3

Open dotnetspec opened 6 years ago

dotnetspec commented 6 years ago

Hi, Useful dapp for getting to grips with Embark ...

Overview

Unable to add eth to account balance and a working UI

Extra Detail

If I start Embark with 'embark run' the ethereum accounts have no credit and I'm not sure how to specifiy/mine any ('geth --mine' does nothing after 30mins)

If I start Embark with 'embark simulator' my Metamask ethereum accounts get the default credit of 100 eth but the dapp webpage won't fully load with the twitter dialog

Steps to reproduce (embark run)

1.start embark with 'embark run'

  1. login to MM(Metamask) on Chromium - check account on RPC localhost:8000 3.view index.html page at localhost;8000 4.observe eth balance in MM = 0

Screenshots

image

Logs

log.txt

Context (Environment)

Questions?

  1. What do I need to configure to ensure I have an MM account with credit as well as a working UI I can test the app functionality with?
dotnetspec commented 6 years ago

Some of the variations (from default) I've tried in config (e.g. rpcHost: "127.0.0.1" instead of localhost) are in this file:

blockchain.js.tar.gz

development doesn't allocate an eth balance.

Privatenet gives: Blockchain process ended before the end of this process. Code: 0

emizzle commented 6 years ago

On the master branch, you will see files in the config/ that should help you.

Using those config files (especially the blockchain config file), you should have 3 accounts created for you with no need to use metamask.

If you want to use metamask, you should be connecting to http://localhost:8545 but you'll need to edit the config to specify accounts (see https://embark.status.im/docs/contracts_deployment.html). And then you'll need to import these accounts in to metamask.

There are also tutorial instructions for this repo (as it's meant to serve as a tutorial) in the /instructions folder on the master branch.

dotnetspec commented 6 years ago

Hi. Please find below my git patch file (let me know if this is not the best way to share my configuration) with the changes I made stepping through the tutorial (at the end I still have this same issue (+from account error on build (see below))): dappcon_start_here_attempt.patch.tar.gz Please note: web3.eth.accounts[0] specifies 'undefined' in the web page console but web3.eth.defaultAccount gives: "0x3901F05c5e296E97c8Dc2ebEdCCa5F010f895552" which is my dev Metamask account. Is this info of any help? If I specify the 'from' account (as I do in the 'patch') I get: "error deploying contracts
│ error deploying =DTwitter= due to error: unknown account" Any idea what I should try next? Thx ...

jrainville commented 6 years ago

@dotnetspec To get all the accounts, you need to use web3.eth.getAccounts(callback). The callback will return to you the accounts. You can also use a promise instead. Here is the web3 doc: https://web3js.readthedocs.io/en/1.0/web3-eth.html#getaccounts

In your case, starting by not using Metmask would be easier. As Eric said, some accounts are already created for you, but when Metamask is there is your browser, it overrides those accounts. So what you can do is just disable Metamask in your extension settings.