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

discrepancies in web3.fromWei(eth.getBalance(eth.accounts[0]),"ether") #2325

Closed
adligo opened this issue Mar 11, 2016 · 3 comments
Closed

discrepancies in web3.fromWei(eth.getBalance(eth.accounts[0]),"ether") #2325

adligo opened this issue Mar 11, 2016 · 3 comments

Comments

@adligo
Copy link

adligo commented Mar 11, 2016

Hi All,

I have three machines that I am trying to mine with, all report the same results from;

eth.accounts[0]

However 2/3 machines report 0 from the following command, the third machine reports the correct balance;

web3.fromWei(eth.getBalance(eth.accounts[0]),"ether")
Which matchs
http://api.etherscan.io/api?module=account&action=balance&address=X

Also I should note that I copied the data directory from the machine that shows the correct balance
to the other machines using a .tar.gz file. Is there some other file that I need to copy?

Other issues include;

  1. AlethOne shows about 1 MH/s as only process, geth shows 120 MH/s as only process (I have cranked up the threads on some fast 6/12 physical core/virtual core machines to 260 in geth. Which one is correct?
  2. Geth is killing my home network when run from 3 machines, I am trying to have two of the machines get the blocks from the third machine, but I can't seem to find documentation about how to do this correctly, or I am misreading the documentation.
    I have tried --nodiscover, and admin.addPeer(), but no mining occurs;
    I have tried --bootnode, but this just seems to add a single peer, and more are discovered.
    I am looking for a admin.add(remove)UpstreamPeer or something, which should also be a command line argument --upstreampeers "enode enode".
  3. It would be nice if there was a standard directory for the blocks so that miners could switch between the different mining clients to find the one best for them.

I can create other issue tickets for 1-3 if these are indeed issues.

Cheers,
Scott

@adligo
Copy link
Author

adligo commented Mar 11, 2016

Also I should mention all machines are on 1.3.5 and were upgrades using;
debug.setHead(493.999)

@adligo adligo closed this as completed Mar 11, 2016
@adligo adligo reopened this Mar 11, 2016
@bas-vk
Copy link
Member

bas-vk commented Mar 11, 2016

In case your nodes are not at the same block height you might get different results when you retrieve the balance. Web3 will by default use "latest" which points the latest block on the chain at that node.

You only had to do the debug.setHead(..) trick when your local chain passed the homestead block. This can only have happened on the test network. It is likely that some of your nodes are not synced with the network and return the balance from an older state. You can check the block height with eth.blockNumber in the console. If all nodes are at the same block heigh (and chain) and give you different balances please create an issue.

It should be sufficient to copy the datadir to another machine. Please keep in mind that any keys in the datadir/keystore directory are also copied. Just for mining you don't need to have the private key available. You can set the etherbase/coinbase address from the command line (--etherbase) when you start geth.

Your issues:

  1. Alethone and geth are two completely different applications that don't have anything to do with each other. That makes comparing them and asking which one is correct not very useful. Both give an indication that probably is right. I'm not sure how reliable these numbers actually are.
  2. Afaik being able to mine has nothing to do with how many peers you have. You can also mine on a local private chain without problems. I would recommend keeping it simple. Just start your nodes without custom nodiscover and bootnode arguments. Check how many peers you have with admin.peers.length, it should give you a number >0. Check that your node is synced with eth.syncing. If this returns false the miner should start (it can take some time, it needs to generate a DAG before it can mine). You can verify that with eth.hashrate. If eth.syncing returns you multiple performance indicator your node is syncing with the network. During that proces the miner won't run since you would be mining on old blocks which would be a lost of energy. Btw, by default geth won't begin mining, you need to specify the --mine flag when you start geth. Or use miner.start(nThreads) from the console.
  3. The use for this is rather limited. Most serious miners will connect to a remote ethereum node over the RPC interface and don't have the chain synced locally. You can read a bit more about mining here.

@adligo
Copy link
Author

adligo commented Mar 13, 2016

I was able to solve the issue by deleting the entire block chain on each machine, and having geth download the entire chain again. However this still doesn't explain what cause the issue in the first place, since I copied the blockchain data from one machine to another.
I have opened another ticket for the networking issues;
#2330

bas-vk
Thanks for your detailed response,
Scott

@adligo adligo closed this as completed Mar 13, 2016
maoueh pushed a commit to streamingfast/go-ethereum that referenced this issue Apr 17, 2024
* ci: temp enable blobtx branch ci run;
* Switch ON blobpool & ensure Cancun hardfork can occur (ethereum#2223)
* feat: support blob storage & miscs; (ethereum#2229)
* chainconfig: use cancun fork for BSC;
* feat: fill WithdrawalsHash when BSC enable cancun fork;
* rawdb: support to CRUD blobs;
* freezer: support to freeze block blobs;
* blockchain: add blob cache & blob query helper;
* freezer: refactor addition table logic, add uts;
* blobexpiry: add more extra expiry time, and logs;
* parlia: implement IsDataAvailable function;
* blob: refactor blob transfer logic;
* blob: support config blob extra reserve;
* blockchian: support to import block with blob & blobGasFee; (ethereum#2260)
* blob: implement min&max gas price logic;
* blockchian: support import side chain;
* blobpool: reject the banned address;
* blockchain: add chasing head for DA check;
* params: update blob related config;
* blockchain: opt data available checking performance;
* params: modify blob related params;
* gasprice: support BEP-336 blob gas price calculate;
* blobTx: mining + brodcasting (ethereum#2253)
* blobtx mining pass (ethereum#2282)
* Sidecar fetching changes for 4844 (ethereum#2283)
* ci: temp enable blobtx branch ci run;
* Switch ON blobpool & ensure Cancun hardfork can occur (ethereum#2223)
* feat: support blob storage & miscs; (ethereum#2229)
* chainconfig: use cancun fork for BSC;
feat: fill WithdrawalsHash when BSC enable cancun fork;
* rawdb: support to CRUD blobs;
* freezer: support to freeze block blobs;
* blockchain: add blob cache & blob query helper;
* freezer: refactor addition table logic, add uts;
* blobexpiry: add more extra expiry time, and logs;
* parlia: implement IsDataAvailable function;
* blob: refactor blob transfer logic;
* blob: support config blob extra reserve;
* blockchian: support to import block with blob & blobGasFee; (ethereum#2260)
* blob: implement min&max gas price logic;
* blockchian: support import side chain;
* blobpool: reject the banned address;
* blockchain: add chasing head for DA check;
* params: update blob related config;
* blockchain: opt data available checking performance;
* params: modify blob related params;
* gasprice: support BEP-336 blob gas price calculate;
* fix failed check for WithdrawalsHash (ethereum#2276)
* eth: include sidecars in fitering of body
* core: refactor sidecars name
* eth: sidecars type refactor
* core: remove extra from bad merge
* eth: fix handlenewblock test after merge
* Implement eth_getBlobSidecars && eth_getBlobSidecarByTxHash (ethereum#2286)
* execution: add blob gas fee reward to system;
* syncing: support blob syncing & DA checking;
* naming: rename blobs to sidecars;
* fix the semantics of WithXXX (ethereum#2293)
* config: reduce sidecar cache to 1024 and rename (ethereum#2297)
* fix: Withdrawals turn into empty from nil when BlockBody has Sidecars (ethereum#2301)
* internal/api_test: add test case for eth_getBlobSidecars && eth_getBlobSidecarByTxHash (ethereum#2300)
* consensus/misc: rollback CalcBlobFee (ethereum#2306)
* flags: add new flags to override blobs' params;
* freezer: fix blob ancient save error;
* blobsidecar: add new sidecar struct with metadata; (ethereum#2315)
* core/rawdb: optimize write block with sidecars (ethereum#2318)
* core: more check for validity of sidecars
* mev: add TxIndex for mev bid (ethereum#2325)
* remove useless Config() (ethereum#2326)
* fix WithSidecars (ethereum#2327)
* fix: fix mined block sidecar issue; (ethereum#2328)
* fix WithSidecars (ethereum#2329)

---------
Co-authored-by: GalaIO <[email protected]>
Co-authored-by: buddho <[email protected]>
Co-authored-by: Satyajit Das <[email protected]>
Co-authored-by: Eric <[email protected]>
Co-authored-by: zzzckck <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants