i was install the GETH and fully fast syncing with ethereum blocks.
see my screenshot.
web3.eth.syncing
{
currentBlock: 7001298,
highestBlock: 7001400,
knownStates: 110459512,
pulledStates: 110393584,
startingBlock: 567719
}
Then I tried to fetch balance.but it will return the 0 always.
web3.fromWei(web3.eth.getBalance('0x59a5208B32e627891C389EbafC644145224006E8'),'ether').toString(10)
in Etherscan u can see the balance of this address.
https://etherscan.io/address/0x59a5208B32e627891C389EbafC644145224006E8
so, why the geth retuns to 0 balance after syncing full blocks in main network i was run the geth with
geth --rpc --datadir "/mnt/volume_sfo2_02" --syncmode "fast"
Please help to find out this solutions.
Related
This is my geth node script
geth --datadir /root/data/data/ --networkid 1567134 --bootnodes enode://44a383ff2c8a78da1131ac82a4513b34de177103017f07c42098c53aad43bc3fd99f62d72d827349eb503f0054fec7683a7db36fc65f9d1238950f70bc4dba97#0.0.0.0:0?discport=8545 --cache=4096 --syncmode=full --gcmode=archive --http --http.addr "0.0.0.0" --ws --ws.addr "0.0.0.0" --ws.port "8546" --allow-insecure-unlock --ws.origins "*" --http --allow-insecure-unlock --http.corsdomain "*" --http.vhosts "*" --http.api "db, eth, net, web3, personal" --http.port "8545" --nodiscover --unlock 0xF122afAf3BEdae6E062Aa18e892ed8c0C9****** --password /root/data/pass.txt --mine --miner.threads 2
run my geth node yesterday and it reached 22,000 blocks yesterday. And then I open and check my node today, data was reset including balances, contracts and blocks now it 6,000.
Is there any problems related to this that already solved? I been running geth for almost 1 month and I encountered the same problem. balances and always gone and blocks are reset.
NOTE:IM RUNNING THIS GETH NODE USING VPS UBUNTU OS & THIS IS FOR PRIVATE BLOCKCHAIN NETWORK
i have tried the below command using PRIVATE_CONFIG=ignore.Can anyone help me to find some explanation regarding how tm.ipc is generated and what is its use
PRIVATE_CONFIG=tm.ipc nohup geth --datadir new-node-1 --nodiscover --verbosity 5 --networkid 31337 --raft --raftport 50000 --rpc --rpcaddr 0.0.0.0 --rpcport 22000 --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,raft --emitcheckpoints --port 21000 2>>node.log &
The tm.ipc socket file is created by the transaction manager (Constellation or Tessera).
It's used by Quorum to communicate with the transaction manager for private transactions and Quorum expects PRIVATE_CONFIG to specify the location of the sokcet file.
If you are only interested in public transactions then you don't need a transaction manager, hence the PRIVATE_CONFIG=ignore setting.
Documentation for this can be found here
I am using geth to create a Private blockchain in my system which is connected to my office network.
I want to add another peer(different PC) to my blockchain network which is connected to the same network.
How can I do that??
Any suggestions on, creating an app which indeed does solve the above requirement.
The key change that would be needed is to start geth nodes on those machines using rpc mode
For example start geth node on Machine 1 and Machine 2 using the commands:
Machine 1 : geth --datadir "C:\ethereum\geth\data\01" --networkid 1234 --rpc --rpcport "8545" --rpcaddr "127.198.216.197" --rpccorsdomain "*"
Machine 2 : geth --datadir "C:\ethereum\geth\data\01" --networkid 1234 --rpc --rpcport "8545" --rpcaddr "127.198.216.198" --rpccorsdomain "*"
Now add Machine 2 as a peer to Machine 1 if you want to do it manually or use a Bootnode and start Geth using Bootnode. You can refer to the link if you want to use Boot nodes: https://github.com/ethereum/go-ethereum/wiki/Setting-up-private-network-or-local-cluster
Then you should be able to attach your console using the command: geth attach http://127.198.216.197:8545
One caveat: You need to open respective ports if they are blocked by your office network
When running the client daemon you can add the 'connect' parameter to specify the IP:Port of the computer you want to try to connect to when starting.
bitcoind --daemon -connect=127.0.0.1:9090
This usually has to be done when the ip's of nodes hard coded into your blockchain codebase have not been updated to the IP's where you have nodes running. Thus peers.dat does not know where to look for a connection to the blockchain.
You can also specify these in the config file with the addnode parameter. e.g.
server=1
rpcport=9090
rpcuser=bitcoinrpc
rpcpassword=3QtnxrB7P5y4EpBdad1MkCeB2RHmArvcarw7udgXsAce
addnode=10.0.0.2:8333
Short description
I have three Ethereum nodes connected in a private network and I am using the interactive Javascript console with geth.
The problem is, I cannot find a way to get ether on any of the accounts. The balance is always 0.
Details
For all three nodes, the configuration and output are similar with the difference only in their addresses and account numbers.
File tree before running geth:
~/eth/
database/
keystore/
genesis/
CustomGenesis.json
Contents of CustomGenesis.json:
{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000042",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x00",
"gasLimit": "0x08000000",
"difficulty": "0x0400",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0xd77821c8b92e3e29bc63c8f2a94a6c6a64b28b53",
"alloc": {
"0x862e90e6b6ebfe0535081d07be8e0f38e422932c": {"balance": "100"},
"0x47e4cf0cc71e7257663f3d2f95e3f8982ece3ad8": {"balance": "200"},
"0x1df2f4f40c03367a9bf42b28a090fed1cccb3068": {"balance": "300"},
"0xd77821c8b92e3e29bc63c8f2a94a6c6a64b28b53": {"balance": "4444444444444444444"},
"0x28685a4b9418c1cb85725318756aa815e8e34497": {"balance": "5555555555555555555"},
"0x86f0526280fea57255c6391a4c7dbdbe8e1181ab": {"balance": "6666666666666666666"}
}
}
While in the directory ~/eth/ I started geth with:
sudo geth --networkid 15 --datadir ./database --nodiscover --maxpeers 2 --rpc --rpcport 8080 --rpccorsdomain * --rpcapi "db,eth,net,web3" --port 30303 --identity TestNet init ./genesis/CustomGenesis.json
... which produced the following output:
INFO [07-12|13:12:46] Starting peer-to-peer node instance=Geth/v1.6.6-stable-10a45cb5/linux-amd64/go1.8.1
INFO [07-12|13:12:46] Allocated cache and file handles database=/home/ethereum6/eth/database/geth/chaindata cache=128 handles=1024
INFO [07-12|13:12:46] Writing default main-net genesis block
INFO [07-12|13:12:47] Initialised chain configuration config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Metropolis: 9223372036854775807 Engine: ethash}"
INFO [07-12|13:12:47] Disk storage enabled for ethash caches dir=/home/ethereum6/eth/database/geth/ethash count=3
INFO [07-12|13:12:47] Disk storage enabled for ethash DAGs dir=/home/ethereum6/.ethash count=2
WARN [07-12|13:12:47] Upgrading db log bloom bins
INFO [07-12|13:12:47] Bloom-bin upgrade completed elapsed=222.754µs
INFO [07-12|13:12:47] Initialising Ethereum protocol versions="[63 62]" network=15
INFO [07-12|13:12:47] Loaded most recent local header number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [07-12|13:12:47] Loaded most recent local full block number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [07-12|13:12:47] Loaded most recent local fast block number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [07-12|13:12:47] Starting P2P networking
INFO [07-12|13:12:47] HTTP endpoint opened: http://127.0.0.1:8080
INFO [07-12|13:12:47] RLPx listener up self="enode://5ded12c388e755791590cfe848635c7bb47d3b007d21787993e0f6259933c78033fd6fa17cbb884ed772f1c90aebaccc64c5c88cddc1260e875ac8f6f07067bf#[::]:30303?discport=0"
INFO [07-12|13:12:47] IPC endpoint opened: /home/ethereum6/eth/database/geth.ipc
Interactive Javascript console is started in another terminal with:
sudo geth attach ipc:$HOME/eth/database/geth.ipc
... which gives:
Welcome to the Geth JavaScript console!
instance: Geth/v1.6.6-stable-10a45cb5/linux-amd64/go1.8.1
coinbase: 0x1fb9fb0502cb57fb654b88dd2d24e19a0eb91540
at block: 0 (Thu, 01 Jan 1970 03:00:00 MSK)
datadir: /home/ethereum6/eth/database
modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0
>
Etherbase is set on all nodes with miner.setEtherbase(personal.listAccounts[0]). Each node only has one account. (3 nodes, 3 accounts)
> eth.accounts
["0x1fb9fb0502cb57fb654b88dd2d24e19a0eb91540"]
> personal.listAccounts
["0x1fb9fb0502cb57fb654b88dd2d24e19a0eb91540"]
>
Calling admin.nodeInfo gives:
> admin.nodeInfo
{
enode: "enode://5ded12c388e755791590cfe848635c7bb47d3b007d21787993e0f6259933c78033fd6fa17cbb884ed772f1c90aebaccc64c5c88cddc1260e875ac8f6f07067bf#[::]:30303?discport=0",
id: "5ded12c388e755791590cfe848635c7bb47d3b007d21787993e0f6259933c78033fd6fa17cbb884ed772f1c90aebaccc64c5c88cddc1260e875ac8f6f07067bf",
ip: "::",
listenAddr: "[::]:30303",
name: "Geth/v1.6.6-stable-10a45cb5/linux-amd64/go1.8.1",
ports: {
discovery: 0,
listener: 30303
},
protocols: {
eth: {
difficulty: 17179869184,
genesis: "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
head: "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
network: 15
}
}
}
>
The nodes are connected with admin.addPeer(..) such that each node shows two peers when calling admin.peers.
When I start mining with miner.start(), this is the output that I receive in the interactive js console:
> miner.start()
null
>
... and in the other terminal running the node:
INFO [07-12|13:16:34] Updated mining threads threads=0
INFO [07-12|13:16:34] Transaction pool price threshold updated price=18000000000
INFO [07-12|13:16:34] Starting mining operation
INFO [07-12|13:16:34] Commit new mining work number=1 txs=0 uncles=0 elapsed=749.279µs
After that nothing happens and the balance on all accounts is still 0 when checking with eth.getBalance(eth.accounts[0]).
What options do I have to try and get the nodes on the private network to start mining ether?
Why does the preallocation of ether not work in CustomGenesis.json?
Was the difficulty provided in CustomGenesis.json ignored? admin.nodeInfo showed a different number.
All comments and suggestions are welcome, thanks!
You probably set the genesis difficulty so high, that your CPU miners don't have a chance of finding a block. You probably want to set the difficulty to something more reasonable, such as 1 million (0x100000 in hex).
Ok, I'll provide what input I have (bear in mind that I am new as well, so we are in the same boat!)
The part I am confident in, is the whole balance part, so:
1. Make a new account (on whichever node): personal.newAccount("password")
2. Set the new account to be the coinbase of this node: miner.setEtherbase(eth.accounts[0])
3. Start the mining: miner.start()
Then, you can check the balance while you are mining. Try:
web3.fromWei(eth.getBalance(eth.coinbase), "ether")
The problem was apparently the way the genesis block was initialized.
The Wrong Way
By calling geth with init and the other command-line arguments:
geth --networkid 15 --datadir ./database --nodiscover --maxpeers 2 --rpc --rpcport 8080 --rpccorsdomain * --rpcapi "db,eth,net,web3" --port 30303 --identity TestNet init ./genesis/CustomGenesis.json
the node is started with the mainnet genesis block:
...
INFO [07-12|13:12:46] Writing default main-net genesis block
...
and after that, everything else cannot work the way expected.
The Solution
Call geth with init and --datadir arguments only:
geth --datadir /path/to/database init /path/to/CustomGenesis.json
A short output is given and geth immediately exits when the initialization is finished:
INFO [07-13|10:30:49] Allocated cache and file handles database=/path/to/database/geth/chaindata cache=16 handles=16
INFO [07-13|10:30:49] Writing custom genesis block
INFO [07-13|10:30:49] Successfully wrote genesis state database=chaindata hash=ed4e11…f40ac3
INFO [07-13|10:30:49] Allocated cache and file handles database=/path/to/database/geth/lightchaindata cache=16 handles=16
INFO [07-13|10:30:49] Writing custom genesis block
INFO [07-13|10:30:49] Successfully wrote genesis state database=lightchaindata hash=ed4e11…f40ac3
and after this, everything else works as expected.
Big thanks to Péter for helping me figure this out!
I am trying to setup a private network and trying to connect peers. Currently I'm trying it on my laptop and desktop (both of them are connected to different internet).
I run the below command in first terminal(in both systems (data dir is different in both systems)):
geth --rpc --rpcaddr "0.0.0.0" --rpcport "8545" --rpccorsdomain "http://localhost:5000, http://localhost:6000" --port "2403" --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --networkid 1001201 --datadir "E:\User\priv\data" init "E:\User\priv\genesis.json"
then I run:
geth --datadir "E:\User\priv\data"
Now, in the second terminal:
geth attach ipc:\\.\pipe\geth.ipc
I get the same enode value on both the systems when i run admin.nodeInfo.enode
then on 1st PC,
admin.addPeer("enode://e0c4960659b6ce4eda71c67b337055636f67660a711d157a81572b5eff1ed1b77931bef4bd079e2660baa661ac16d696b831e9394cb619378071a2593ecdf17a#[192.168.1.2]:30301");
on 2nd PC,
admin.addPeer("enode://e0c4960659b6ce4eda71c67b337055636f67660a711d157a81572b5eff1ed1b77931bef4bd079e2660baa661ac16d696b831e9394cb619378071a2593ecdf17a#[13.75.117.156]:30302");
both of them return true.
But admin.peerCount returns 0.
Can somebody please help me to setup a private geth network?
Step1
geth --identity "YourNodeName" --rpc --rpcport "8092" --datadir "DirectoryPathToStoreData" --port "30330" --nodiscover --rpcapi "db,eth,net,web3" --networkid 2010 init PathOfGenesisFile
The above command is to initialise a Genesis File.
Note: All Peers willing to connect to a network should have a same Genesis File.
Step2
geth --identity "YourNodeName" --rpc --rpcport "8092" --datadir "DirectoryPathToStoreData" --port "30330" --nodiscover --rpcapi "db,eth,net,web3" --networkid 2010 console
The above command opens a Geth JavaScript console.
Do the above 2 steps in other system also.
Step3
In the system where you want to add other system as peer type the following command admin.addPeer("Argument") where Argument is the enode value of other node which is obtained by typing admin.nodeInfo() in other system.
Eg:admin.nodeInfo
{
enode: "enode://965dc2b0f39e199d3a07871293015d8a4ad9349834fc27b7ee5e87bea89547e4fafda3ce7982ae07c14b8770c87a6c14e3fe2f91ef0d0ca717eb6ae56aa3e74b#[::]:30330?discport=0",
//////////
}
where 30330 is the network id of other system.
copy upto 30330.You need to give the ip address of other system in place of
[::]
It returns true if that node is capable of acting as a peer but not mean that it is added to our network, to know that type net.peerCount. It returns 1, if added.
You can follow the step3 for adding more peers.
You can create a private blockchain without creating a Genesis File.If you opt for that, follow this link.
As outlined here, your --port and --rpcport variables should be different. The resulting EnodeURLs should also be different.
Also, when you run geth the second time, I'd include everything you used in the first run before init.