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!
Related
I am trying to implement a basic pp example as shown below (SCRIPT1).
import pp
ppservers = ("*",) # autodiscovery mode on!
# create the job server
job_server = pp.Server(ppservers=ppservers)
for computer, cpu_count in job_server.get_active_nodes().iteritems():
print "Found {} with CPU count {}!".format(computer, cpu_count)
Environment Details
OS : windows10
python version : 2.7 (on machine 1 and machine 2)
machine1 IP : 192.168.1.4
machine2 IP : 192.168.56.1
Steps followed till now :
machine1 and machine2 are connected in same network using wifi
SCRIPT1 is placed on machine1 (machine1 is job server)
installed pp in machine2(worker node) and started server on machine2 (port 60000) using
python ppserver.py -a
triggered SCRIPT1 on machine1, machine 1 output is as shown below
Found local with CPU count 8!
But output at step4 is expected to also detect machine 2 and show output as
Found 192.168.56.1:60000 with CPU count 2!
Found local with CPU count 4!
A newbie to parrallel computing, how do i debug this ?
Appreciate any kinda pointers for this.
Firewall and virtualBox was the issue.
Steps followed to get to the fix:
ping xxx.xxx.x.x. (machine1 IP)
run ppserver on same machine1 and see if jobserver can list the same machine1 as a worker node
if 1 and 2 is the issue, it is mostly caused by firewall, in this case add an inbound rule for the required port and continue.
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.
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
What Iam trying to achieve is to run an ethereum/client-go on an aws EC2
instance and being able to access it from remote client side, for playing around with Rinkeby test network
I am trying to run an geth docker image on ec2 instance on aws.
When I run the docker using the below command, I am getting the following error.
sudo docker run -it -p 8545:8545 -p 30303:30303 ethereum/client-go --rpc --rinkeby --syncmode "fast" --rpc --rpcapi 'db,eth,net,web3,personal' --rpcaddr XXX.XX.XXX.XXX --cache=1024
Where --rpcaddr XXX.XX.XXX.XXX is my Elastic IP
INFO [04-17|10:24:08] Maximum peer count ETH=25 LES=0 total=25
INFO [04-17|10:24:08] Starting peer-to-peer node instance=Geth/v1.8.4-unstable-92c6d130/linux-amd64/go1.10.1
INFO [04-17|10:24:08] Allocated cache and file handles database=/root/.ethereum/rinkeby/geth/chaindata cache=768 handles=1024
INFO [04-17|10:24:08] Writing custom genesis block
INFO [04-17|10:24:08] Persisted trie from memory database nodes=355 size=65.27kB time=1.082517ms gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [04-17|10:24:08] Initialised chain configuration config="{ChainID: 4 Homestead: 1 DAO: <nil> DAOSupport: true EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: 1035301 Constantinople: <nil> Engine: clique}"
INFO [04-17|10:24:08] Initialising Ethereum protocol versions="[63 62]" network=4
INFO [04-17|10:24:08] Loaded most recent local header number=0 hash=6341fd…67e177 td=1
INFO [04-17|10:24:08] Loaded most recent local full block number=0 hash=6341fd…67e177 td=1
INFO [04-17|10:24:08] Loaded most recent local fast block number=0 hash=6341fd…67e177 td=1
INFO [04-17|10:24:08] Regenerated local transaction journal transactions=0 accounts=0
INFO [04-17|10:24:08] Starting P2P networking
INFO [04-17|10:24:10] UDP listener up self=enode://350e33a2680260f24bd1837e59610173769023f6cf609ab59b1aca63dc867cce5d7cb520343ed9a04b8a98d5a7d08f57f9e2ee258502312fafad42d005179aab#[::]:30303
INFO [04-17|10:24:10] IPC endpoint opened url=/root/.ethereum/rinkeby/geth.ipc
INFO [04-17|10:24:10] IPC endpoint closed endpoint=/root/.ethereum/rinkeby/geth.ipc
INFO [04-17|10:24:10] Blockchain manager stopped
INFO [04-17|10:24:10] Stopping Ethereum protocol
INFO [04-17|10:24:10] RLPx listener up self=enode://350e33a2680260f24bd1837e59610173769023f6cf609ab59b1aca63dc867cce5d7cb520343ed9a04b8a98d5a7d08f57f9e2ee258502312fafad42d005179aab#[::]:30303
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa6e76b]
goroutine 76 [running]:
github.com/ethereum/go-ethereum/eth/filters.(*EventSystem).eventLoop(0xc42c694d00)
/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/eth/filters/filter_system.go:434 +0x2eb
created by github.com/ethereum/go-ethereum/eth/filters.NewEventSystem
/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/eth/filters/filter_system.go:113 +0x104
Can anyone help, what is causing the above issue?
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa6e76b]
When I run the same docker with --rpcaddr 127.0.0.1 it works fine, but cannot access from remote client,
sudo docker run -it -p 8545:8545 -p 30303:30303 ethereum/client-go --rpc --rinkeby --syncmode "fast" --rpc --rpcapi 'db,eth,net,web3,personal' --rpcaddr 127.0.0.1 --cache=1024
I have tried using,
Public DNS (IPv4),
IPv4 Public IP and
Elastic IP
for the --rpcaddr values
Also I have given the security permission in aws TCP inbound and outbound ports.
Am i doing this right? Is this the right way to run web3 provider?
You should be using volumes in my opinion because the client will try download the ethereum blockchain, but with your current setup there is nowhere to save the blockchain.
Have a look at this page:
https://github.com/ethereum/go-ethereum/wiki/Running-in-Docker
"To persist downloaded blockchain data between container starts, use Docker data volumes. Replace /path/on/host with the location you want to store the data in."
$ docker run -it -p 30303:30303 -v /path/on/host:/root/.ethereum ethereum/client-go
Try see if this helps. If you still have issues I'll be happy to try help or consider looking over the issues on github for geth. I saw someone got a similar error in 2017 and logged an issue see here:
https://github.com/ethereum/go-ethereum/issues/15079
I'm struggling to get iscsiadm to connect from the iSCSI Initiator VM (using VirtualBox) to my iSCSI Target VM (also on VirtualBox).
E.g.
iscsiadm --mode discovery --type sendtargets --portal <ip address> --discover
iscsiadm: cannot make connection to <ip address>: Connection refused
There is a Host-only adapter network set up and I can SSH between the two VMs.
I disabled iptables to check if it was a firewall problem but was still getting the same problem.
Fwiw, on the Target machine I have:
# tgtadm --mode target --op show
Target 1: iqn.2014-03.my.target.server:tgt1
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 55 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: rdwr
Backing store path: /dev/vg_iscsi/lv_iscsi_1
Backing store flags:
Account information:
ACL information:
ALL
Any suggestions what else I can try?
Your client machine have another session logged into that target.
First you will have to logged out that target from your client, then discover using your new targetname.
Logout(change parameter accordingly):
iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260 --logout
If your client still does not discover, use 0.0.0.0 3260 as portal for this particular iqn in your server machine. This should work fine.
server:
o- portals .................................................................... [Portals: 1]
| | o- 0.0.0.0:3260 ..................................................................... [OK]
This is not a firewall issue.
me#here:~$ sudo iscsiadm -m discovery -t st -p 192.168.22.240
iscsiadm: cannot make connection to 192.168.22.240: Connection refused
iscsiadm: cannot make connection to 192.168.22.240: Connection refused
iscsiadm: cannot make connection to 192.168.22.240: Connection refused
^Ciscsiadm: caught SIGINT, exiting...
me#here:~$ sudo iscsiadm -m discoverydb -t st -p 192.168.22.240
# BEGIN RECORD 2.0-873
discovery.startup = manual
discovery.type = sendtargets
discovery.sendtargets.address = 192.168.22.240
discovery.sendtargets.port = 3260
discovery.sendtargets.auth.authmethod = None
discov...