Setting up Ethereum node on Windows 10 and Ubuntu.

After a few attempts I was able to start Ethereum Mist 0.11.1 in ‘fast’ mode on Windows 10:

it downloaded ‘geth’, connected to {“path”:”\\\\.\\pipe\\geth.ipc”} and started to sync, but when sync finished I was unable to send transactions (they were ‘denied’ for some reason).

Fortunately, I was able to use ‘geth’ from the command line. I successfully run the following commands:

geth account list
geth account new

and I even was able to attach to running node and execute some commands from the console:

geth attach ipc:\\.\pipe\geth.ipc
Welcome to the Geth JavaScript console!

instance: Geth/v1.8.16-stable-477eb093/windows-amd64/go1.11
coinbase: 0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
at block: 0 (Thu, 01 Jan 1970 03:00:00 MSK)
 datadir: C:\Users\D-Ef\AppData\Roaming\Ethereum
 modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> eth.accounts
["0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", ""0xYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"", "0xZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"]
> eth.accounts[0]
"0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
> personal.unlockAccount("0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
Unlock account 0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Passphrase:
true
> eth.getBalance("0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
1000000
> web3.toWei(0.01, "ether")
"10000000000000000"
> eth.syncing
{
  currentBlock: 1584784,
  highestBlock: 6853933,
  knownStates: 2368765,
  pulledStates: 2364485,
  startingBlock: 0
}
> eth.blockNumber
0
> web3.eth.getTransactionReceipt("0x2f32a07ebec4500fb15fe2cd73c76c05e508953631ad286ec8c4714942fbfbe5")
null
> web3.eth.gasPrice
1000000000

but not to send transactions:

eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value: web3.toWei(0.4, "ether")});
eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value: web3.toWei(0.4, "ether"), gas:400000000});
eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value: web3.toWei(0.4, "ether"),gas:21000, gasPrice:web3.toWei(60, 'gwei')});
Error: exceeds block gas limit
    at web3.js:3143:20
    at web3.js:6347:15
    at web3.js:5081:36
    at <anonymous>:1:1

probably because the pending block number was 1 and the latest block number was always 0:

web3.eth.getBlock("pending").number
1
web3.eth.getBlock("latest").number
0

and syncing was always in progress:

eth.syncing
{
  currentBlock: 6874230,
  highestBlock: 6874329,
  knownStates: 20870394,
  pulledStates: 20866974,
  startingBlock: 0
}

then I absolutely successfully run ‘geth’ from command line and it started to do something:

but with the same wrong result.

I synchronized the time by pressing ‘Update Now’ button in Control Panel -> Clock and Region -> Set the date and time -> Internet time -> Change Settings dialog, starting ‘Windows Time’ service and switching it to automatic mode and restarted ‘geth’:

geth --syncmode "fast" --cache=4096
geth --syncmode "fast" --cache=8192
geth --syncmode "light" --cache=4096

nothing changed, but I noticed that probably I have insufficient RAM on my machine:

The difference between currentBlock and highestBlock was always about 100:

and Geth actually used about 1.3 GB:

I added 16GB to my machine, restarted ‘geth’:

and kept it started for several days


but with the same result:

> eth.syncing
{
  currentBlock: 6926317,
  highestBlock: 6926400,
  knownStates: 78132144,
  pulledStates: 78125689,
  startingBlock: 6897800
}
> eth.syncing
{
  currentBlock: 6926382,
  highestBlock: 6926499,
  knownStates: 78294865,
  pulledStates: 78290783,
  startingBlock: 6897800
}
> eth.syncing
{
  currentBlock: 6927682,
  highestBlock: 6927794,
  knownStates: 80514783,
  pulledStates: 80510092,
  startingBlock: 6897800
}
> eth.syncing
{
  currentBlock: 6927812,
  highestBlock: 6927910,
  knownStates: 80711243,
  pulledStates: 80706106,
  startingBlock: 6897800
}
> eth.blockNumber
0

I checked my local time with PowerShell and got this:

PS C:\WINDOWS\system32> w32tm /stripchart /computer:ru.pool.ntp.org /dataonly /samples:5
Tracking ru.pool.ntp.org [94.247.111.10:123].
Collecting 5 samples.
The current time is 12/21/2018 9:53:45 PM.
21:53:45, -00.1194254s
21:53:47, -00.1207365s
21:53:49, -00.1214643s
21:53:51, -00.1169693s
21:53:53, -00.1204695s
PS C:\WINDOWS\system32> w32tm /stripchart /computer:us.pool.ntp.org /dataonly /samples:5
Tracking us.pool.ntp.org [108.61.73.244:123].
Collecting 5 samples.
The current time is 12/21/2018 9:54:16 PM.
21:54:16, -00.1267596s
21:54:19, -00.1321943s
21:54:21, -00.1261153s
21:54:23, -00.1236226s
21:54:25, -00.1213979s
PS C:\WINDOWS\system32> w32tm /config /update
The command completed successfully.
PS C:\WINDOWS\system32> w32tm /resync /rediscover
Sending resync command to local computer
The command completed successfully.
PS C:\WINDOWS\system32> w32tm /stripchart /computer:us.pool.ntp.org /dataonly /samples:5
Tracking us.pool.ntp.org [108.61.73.244:123].
Collecting 5 samples.
The current time is 12/21/2018 9:55:33 PM.
21:55:33, -00.1372422s
21:55:36, -00.1221810s
21:55:38, -00.1246994s
21:55:40, -00.1333123s
21:55:42, -00.1318334s

my local clock is 0.13s wrong and the following did not help:

w32tm /config /manualpeerlist:"ru.pool.ntp.org,0x1" /syncfromflags:manual /reliable:yes /update
w32tm /config /update
net stop w32time
net start w32time
w32tm /resync

but restarting the machine probably helped and at first there was 5 ms accuracy:

w32tm /stripchart /computer:ru.pool.ntp.org /dataonly /samples:5
Tracking ru.pool.ntp.org [87.249.18.165:123].
Collecting 5 samples.
The current time is 12/21/2018 10:33:54 PM.
22:33:54, -00.0041886s
22:33:56, -00.0032313s
22:33:58, -00.0043803s
22:34:00, -00.0048340s
22:34:02, -00.0021607s

but after about 20 minutes:

Tracking ru.pool.ntp.org [81.88.210.197:123].
Collecting 5 samples.
The current time is 12/21/2018 11:34:35 PM.
23:34:35, -00.0378463s
23:34:37, -00.0395839s
23:34:39, -00.0376975s
23:34:41, -00.0381796s
23:34:44, -00.0390146s

the configuration was:

w32tm /query /configuration
[Configuration]

EventLogFlags: 2 (Local)
AnnounceFlags: 5 (Local)
TimeJumpAuditOffset: 28800 (Local)
MinPollInterval: 10 (Local)
MaxPollInterval: 15 (Local)
MaxNegPhaseCorrection: 54000 (Local)
MaxPosPhaseCorrection: 54000 (Local)
MaxAllowedPhaseOffset: 1 (Local)

FrequencyCorrectRate: 4 (Local)
PollAdjustFactor: 5 (Local)
LargePhaseOffset: 50000000 (Local)
SpikeWatchPeriod: 900 (Local)
LocalClockDispersion: 10 (Local)
HoldPeriod: 5 (Local)
PhaseCorrectRate: 1 (Local)
UpdateInterval: 360000 (Local)


[TimeProviders]

NtpClient (Local)
DllName: C:\WINDOWS\SYSTEM32\w32time.DLL (Local)
Enabled: 1 (Local)
InputProvider: 1 (Local)
AllowNonstandardModeCombinations: 1 (Local)
ResolvePeerBackoffMinutes: 15 (Local)
ResolvePeerBackoffMaxTimes: 7 (Local)
CompatibilityFlags: 2147483648 (Local)
EventLogFlags: 1 (Local)
LargeSampleSkew: 3 (Local)
SpecialPollInterval: 32768 (Local)
Type: NTP (Local)
NtpServer: pool.ntp.org,0x1 (Local)

NtpServer (Local)
DllName: C:\WINDOWS\SYSTEM32\w32time.DLL (Local)
Enabled: 0 (Local)
InputProvider: 0 (Local)
w32tm /query /status
Leap Indicator: 0(no warning)
Stratum: 3 (secondary reference - syncd by (S)NTP)
Precision: -23 (119.209ns per tick)
Root Delay: 0.0443077s
Root Dispersion: 7.7919124s
ReferenceId: 0xC303FE02 (source IP:  195.3.254.2)
Last Successful Sync Time: 12/21/2018 11:30:27 PM
Source: pool.ntp.org,0x1
Poll Interval: 11 (2048s)

then I switched to stratum 1 ntp server:

w32tm /query /status
Leap Indicator: 0(no warning)
Stratum: 1 (primary reference - syncd by radio clock)
Precision: -23 (119.209ns per tick)
Root Delay: 0.0000000s
Root Dispersion: 10.0000000s
ReferenceId: 0x4C4F434C (source name:  "LOCL")
Last Successful Sync Time: 12/22/2018 12:22:10 AM
Source: Local CMOS Clock
Poll Interval: 10 (1024s)

but got a strange result:

w32tm /stripchart /computer:ntp3.stratum1.ru /dataonly /samples:5
Tracking ntp3.stratum1.ru [88.147.254.228:123].
Collecting 5 samples.
The current time is 12/22/2018 12:24:05 AM.
00:24:05, -01.1101141s
00:24:07, -01.1097999s
00:24:09, -01.1108969s
00:24:14, -01.1117056s
00:24:16, -01.1102872s

so after the synchronization the time became even worse than before, looks like it synchronizes with 1 second accuracy. Within next couple days I got this:

PS C:\WINDOWS\system32> w32tm /stripchart /computer:ru.pool.ntp.org /dataonly /samples:5
Tracking ru.pool.ntp.org [80.93.50.95:123].
Collecting 5 samples.
The current time is 12/22/2018 2:46:33 AM.
02:46:33, -00.2791673s
02:46:35, -00.2783580s
02:46:37, -00.2780384s
PS C:\WINDOWS\system32> w32tm /stripchart /computer:ru.pool.ntp.org /dataonly /samples:5
Tracking ru.pool.ntp.org [195.122.241.236:123].
Collecting 5 samples.
The current time is 12/22/2018 3:55:15 AM.
03:55:15, -00.1404319s
03:55:17, -00.1358025s
03:55:19, -00.1386863s
03:55:21, -00.1349205s
03:55:23, -00.1388944s
PS C:\WINDOWS\system32> w32tm /stripchart /computer:ru.pool.ntp.org /dataonly /samples:5
Tracking ru.pool.ntp.org [217.70.19.12:123].
Collecting 5 samples.
The current time is 12/22/2018 10:12:31 PM.
22:12:31, -00.0787462s
22:12:33, -00.0788919s
22:12:35, -00.0774421s
22:12:37, -00.0775899s
22:12:39, -00.0781309s
PS C:\WINDOWS\system32> w32tm /stripchart /computer:ru.pool.ntp.org /dataonly /samples:5
Tracking ru.pool.ntp.org [78.140.251.2:123].
Collecting 5 samples.
The current time is 12/23/2018 12:58:45 PM.
12:58:45, -00.2455088s
12:58:47, -00.2466598s
12:58:49, -00.2453215s
12:58:51, -00.2452405s
12:58:53, -00.2456714s

the following probably resets sync settings:

w32tm /unregister
w32tm /register

At work I have this:

w32tm /stripchart /computer:ru.pool.ntp.org /dataonly /samples:5
Collecting 5 samples.
The current time is 12/24/2018 3:40:09 PM.
15:40:09, -00.0267946s
15:40:11, -00.0278182s
15:40:13, -00.0279371s
15:40:15, -00.0295136s
15:40:17, -00.0268985s
w32tm /query /status
Leap Indicator: 0(no warning)
Stratum: 4 (secondary reference - syncd by (S)NTP)
Precision: -23 (119.209ns per tick)
Root Delay: 0.0562810s
Root Dispersion: 0.4208670s
ReferenceId: 0x0A00000F (source IP:  10.0.0.15)
Last Successful Sync Time: 12/24/2018 2:17:03 PM
Source: SPBWORK.mywork.local
Poll Interval: 15 (32768s)

I synchronized the time on my Ubuntu 18.04 machine with chrony and installed ‘geth’ with the following commands:

sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
geth -h
NAME:
   geth - the go-ethereum command line interface

   Copyright 2013-2018 The go-ethereum Authors

USAGE:
   geth [options] command [command options] [arguments...]

VERSION:
   1.8.20-stable-24d727b6

and configured ‘geth’ service:

[Unit]
Description=Geth

[Service]
Type=simple
User=eth
Restart=always
WorkingDirectory=/home/eth
ExecStart=/usr/bin/geth --syncmode "fast" --cache=8192

[Install]
WantedBy=default.target
sudo useradd -d /home/eth -m --uid 10000 eth
sudo nano /etc/systemd/system/geth.service
sudo systemctl daemon-reload
sudo systemctl enable geth.service
Created symlink /etc/systemd/system/default.target.wants/geth.service → /etc/systemd/system/geth.service.
service geth status
sudo service geth start
sudo service geth stop
journalctl -u geth.service
дек 27 20:08:29 tor systemd[1]: Started Geth.
дек 27 20:08:29 tor geth[241739]: WARN [12-27|20:08:29.851] Sanitizing cache to Go's GC limits       provided=8192 updated=2073
дек 27 20:08:29 tor geth[241739]: INFO [12-27|20:08:29.856] Maximum peer count                       ETH=25 LES=0 total=25
дек 27 20:08:29 tor geth[241739]: INFO [12-27|20:08:29.879] Starting peer-to-peer node               instance=Geth/v1.8.20-stable-24d727b6/linux-amd64/go1.10.4
дек 27 20:08:29 tor geth[241739]: INFO [12-27|20:08:29.879] Allocated cache and file handles         database=/home/eth/.ethereum/geth/chaindata cache=1036 handles=2048
дек 27 20:08:30 tor geth[241739]: INFO [12-27|20:08:30.104] Writing default main-net genesis block
дек 27 20:08:30 tor geth[241739]: INFO [12-27|20:08:30.819] Persisted trie from memory database      nodes=12356 size=1.88mB time=133.354585ms gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.0
дек 27 20:08:30 tor geth[241739]: INFO [12-27|20:08:30.827] Initialised chain configuration          config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 267500
дек 27 20:08:30 tor geth[241739]: INFO [12-27|20:08:30.828] Disk storage enabled for ethash caches   dir=/home/eth/.ethereum/geth/ethash count=3
дек 27 20:08:30 tor geth[241739]: INFO [12-27|20:08:30.828] Disk storage enabled for ethash DAGs     dir=/home/eth/.ethash               count=2
дек 27 20:08:30 tor geth[241739]: INFO [12-27|20:08:30.828] Initialising Ethereum protocol           versions="[63 62]" network=1
дек 27 20:08:30 tor geth[241739]: INFO [12-27|20:08:30.879] Loaded most recent local header          number=0 hash=d4e567…cb8fa3 td=17179869184 age=49y8mo1w
дек 27 20:08:30 tor geth[241739]: INFO [12-27|20:08:30.880] Loaded most recent local full block      number=0 hash=d4e567…cb8fa3 td=17179869184 age=49y8mo1w
дек 27 20:08:30 tor geth[241739]: INFO [12-27|20:08:30.880] Loaded most recent local fast block      number=0 hash=d4e567…cb8fa3 td=17179869184 age=49y8mo1w
дек 27 20:08:30 tor geth[241739]: INFO [12-27|20:08:30.880] Regenerated local transaction journal    transactions=0 accounts=0
дек 27 20:08:31 tor geth[241739]: INFO [12-27|20:08:31.081] New local node record                    seq=1 id=6a81e1db9c9130c5 ip=127.0.0.1 udp=30303 tcp=30303
дек 27 20:08:31 tor geth[241739]: INFO [12-27|20:08:31.082] IPC endpoint opened                      url=/home/eth/.ethereum/geth.ipc
дек 27 20:08:31 tor geth[241739]: INFO [12-27|20:08:31.084] Started P2P networking                   self=enode://d31bd37cf888ef4e01dda94dc5af603db3e81afb7446aa644dc49f41ba92eb2e221af8dc3e2c66889bd44a
дек 27 20:08:41 tor geth[241739]: INFO [12-27|20:08:41.085] Block synchronisation started
дек 27 20:08:46 tor geth[241739]: INFO [12-27|20:08:46.185] Imported new block headers               count=192 elapsed=1.472s number=192 hash=723899…123390 age=3y5mo2w
дек 27 20:08:46 tor geth[241739]: INFO [12-27|20:08:46.189] Imported new block receipts              count=2   elapsed=90.799µs number=2   hash=b495a1…4698c9 age=3y5mo2w  size=8.00B
дек 27 20:08:46 tor geth[241739]: INFO [12-27|20:08:46.315] Imported new block headers               count=192 elapsed=104.323ms number=384 hash=d3d5d5…c79cf3 age=3y5mo2w
sudo su - eth
geth attach ipc:/home/eth/.ethereum/geth.ipc

Finally I switched to ‘light’ mode, because ‘fast’ takes more than 250GB of disk space, copied my wallets to ~.ethereum/keystore and was able to send a transaction:

cd ~
geth attach ipc:.ethereum/geth.ipc
eth.accounts
eth.getBalance(eth.accounts[0])
personal.unlockAccount(eth.accounts[0])
eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value: web3.toWei(0.7, "ether")})

My final service configuration was:

[Unit]
Description=Geth

[Service]
Type=simple
User=eth
Restart=always
WorkingDirectory=/home/eth
ExecStart=/usr/bin/geth --syncmode "light" --cache=8192

[Install]
WantedBy=default.target

in ‘light’ mode the node data currently takes 464MB.

Disabling the service:

sudo service geth stop
systemctl is-active geth
sudo systemctl disable geth

After some time I updated geth to version 1.8.21-stable-9dc5d1a9.

6 Responses to Setting up Ethereum node on Windows 10 and Ubuntu.

  1. dmitriano says:

    Used –nousb as argument on geth to prevent ‘Failed to enumerate USB devices’ error.

  2. dmitriano says:

    To only download data from other nodes, you don’t need to open any outgoing ports at all. Opening your :30303 to the world is required only if you want to run full node, helping other people to use Ethereum. see https://ethereum.stackexchange.com/questions/26652/geth-connectivity-behind-a-firewall

  3. dmitriano says:

    Looks like ‘light’ mode does not work anymore. To increase the disk space on Windows 10 I tried to follow this: https://docs.microsoft.com/en-us/troubleshoot/windows-server/backup-and-storage/establish-striped-volume-raid-0

  4. dmitriano says:

    https://datawookie.netlify.app/blog/2018/10/dns-on-ubuntu-18.04/
    sudo apt install resolvconf

    Edit /etc/resolvconf/resolv.conf.d/head and add the following:
    # Make edits to /etc/resolvconf/resolv.conf.d/head.
    nameserver 8.8.4.4
    nameserver 8.8.8.8

    sudo service resolvconf restart

Leave a Reply to dmitriano Cancel reply

Your email address will not be published. Required fields are marked *