That Time I Ran A Full Ethereum Node On My Computer

Lee Azzarello
Coinmonks
Published in
9 min readApr 21, 2018

--

Part One

I have a computer with 500 gigabytes of storage capacity. I would like this computer to be part of the global decentralized Ethereum main network. Let’s go!

I visit the go-ethereum project on Github. It is very active!

Discover and review best Blockchain api and node products

It looks like the software I need is named geth. The documentation says it is quite capable. I Install it on my computer!

Lees-MacBook-Pro:geth leeazzarello$ geth version
Geth
Version: 1.8.2-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10
Operating System: darwin
GOPATH=/Users/leeazzarello/go
GOROOT=/usr/local/Cellar/go/1.10/libexec

Let’s run it!

Lees-MacBook-Pro:~ leeazzarello$ geth
INFO [03–19|15:40:28] Maximum peer count ETH=25 LES=0 total=25
INFO [03–19|15:40:28] Starting peer-to-peer node instance=Geth/v1.8.2-stable/darwin-amd64/go1.10
INFO [03–19|15:40:28] Allocated cache and file handles database=/Users/leeazzarello/Library/Ethereum/geth/chaindata cache=768 handles=128
INFO [03–19|15:40:36] Initialised chain configuration config=”{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Constantinople: <nil> Engine: ethash}”
INFO [03–19|15:40:36] Disk storage enabled for ethash caches dir=/Users/leeazzarello/Library/Ethereum/geth/ethash count=3
INFO [03–19|15:40:36] Disk storage enabled for ethash DAGs dir=/Users/leeazzarello/.ethash count=2
INFO [03–19|15:40:36] Initialising Ethereum protocol versions=”[63 62]” network=1
INFO [03–19|15:40:36] Loaded most recent local header number=5285440 hash=8aed25…6106fa td=3142921855785140055448
INFO [03–19|15:40:36] Loaded most recent local full block number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [03–19|15:40:36] Loaded most recent local fast block number=5285335 hash=e3e4b9…87f92a td=3142576463361106413435
INFO [03–19|15:40:36] Loaded local transaction journal transactions=0 dropped=0
INFO [03–19|15:40:36] Regenerated local transaction journal transactions=0 accounts=0
INFO [03–19|15:40:36] Starting P2P networking
INFO [03–19|15:40:38] UDP listener up self=enode://e4647b30867c35991fff0f25481448ca10e29c707ffee4548813d5f2458f92397a3b6aaa6e7b24ee58b89531d54d0d2b62d694ba7e0508dcfb83a1f1ad16c376@[::]:30303
INFO [03–19|15:40:38] RLPx listener up self=enode://e4647b30867c35991fff0f25481448ca10e29c707ffee4548813d5f2458f92397a3b6aaa6e7b24ee58b89531d54d0d2b62d694ba7e0508dcfb83a1f1ad16c376@[::]:30303
INFO [03–19|15:40:38] IPC endpoint opened url=/Users/leeazzarello/Library/Ethereum/geth.ipc
INFO [03–19|15:42:38] Block synchronisation started
WARN [03–19|15:42:40] Synchronisation failed, retrying err=”block download canceled (requested)”
WARN [03–19|15:42:49] Lied about chain head peer=e63681e1eec3c72f reported=2503882 found=2504058
WARN [03–19|15:42:49] Synchronisation failed, dropping peer peer=e63681e1eec3c72f err=”peer is stalling”

Uh…what’s going on? I guess I’ll sit here for a while.

As I’m waiting I read some of the docs. I discover this thing called fast sync mode. It seems the two modes are incompatible and one cannot transform into another. Whelp, let’s start over and do it fast this time!

Ctrl+C
Lees-MacBook-Pro:~ leeazzarello$ geth --fast

Woah, there’s a bunch of gigabytes on my hard drive now.

Lees-MacBook-Pro:geth leeazzarello$ pwd
/Users/leeazzarello/Library/Ethereum/geth
Lees-MacBook-Pro:geth leeazzarello$ du -sh chaindata/
63G chaindata/

I wonder if I can interact with this blockchain data I have on my computer? Is it synced? It looks like there’s an interactive console I can use to find out.

Lees-MacBook-Pro:geth leeazzarello$ geth console
> INFO [03-19|15:47:19] Block synchronisation started
INFO [03-19|15:47:21] Imported new block headers count=278 elapsed=62.697ms number=5285719 hash=9e4e03…65b0fe ignored=106
INFO [03-19|15:47:21] Imported new block headers count=110 elapsed=92.542ms number=5285829 hash=905f1e…0ca7ee ignored=0
INFO [03-19|15:47:22] Imported new state entries count=259 elapsed=4.845µs processed=36200855 pending=4145 retry=2 duplicate=0 unexpected=0
INFO [03-19|15:47:23] Imported new state entries count=384 elapsed=4.167µs processed=36201239 pending=9959 retry=0 duplicate=0 unexpected=0
INFO [03-19|15:47:23] Imported new block receipts count=41 elapsed=43.361ms number=5285376 hash=218633…f56eb9 size=2.98mB ignored=0
INFO [03-19|15:47:24] Imported new state entries count=384 elapsed=2.181µs processed=36201623 pending=14455 retry=2 duplicate=0 unexpected=0
INFO [03-19|15:47:25] Imported new block receipts count=1 elapsed=478.739µs number=5285377 hash=bedd4c…8fb709 size=10.67kB ignored=0
INFO [03-19|15:47:25] Imported new block receipts count=129 elapsed=206.809ms number=5285506 hash=580e9b…c4bb7f size=8.83mB ignored=0
INFO [03-19|15:47:26] Imported new state entries count=384 elapsed=2.201µs processed=36202007 pending=19068 retry=0 duplicate=0 unexpected=0
INFO [03-19|15:47:26] Imported new block headers count=1 elapsed=4.297ms number=5285830 hash=294154…19d282 ignored=0
INFO [03-19|15:47:26] Imported new block receipts count=39 elapsed=58.088ms number=5285545 hash=a041c3…dabfd4 size=3.03mB ignored=0
INFO [03-19|15:47:26] Imported new block receipts count=64 elapsed=87.223ms number=5285609 hash=7fbf4a…5626f3 size=3.98mB ignored=0
INFO [03-19|15:47:28] Imported new block receipts count=62 elapsed=72.201ms number=5285671 hash=9aa74a…6fe835 size=4.01mB ignored=0
INFO [03-19|15:47:28] Imported new state entries count=1152 elapsed=2.002ms processed=36203159 pending=18929 retry=0 duplicate=0 unexpected=0
INFO [03-19|15:47:28] Imported new block receipts count=71 elapsed=78.378ms number=5285742 hash=6c98ce…850746 size=3.83mB ignored=0
INFO [03-19|15:47:29] Imported new block receipts count=22 elapsed=28.929ms number=5285764 hash=eb9c1d…7fa025 size=1.30mB ignored=0
INFO [03-19|15:47:29] Imported new state entries count=0 elapsed=567.702µs processed=36203159 pending=1 retry=1 duplicate=0 unexpected=384
INFO [03-19|15:47:30] Imported new state entries count=273 elapsed=3.147µs processed=36203432 pending=4369 retry=0 duplicate=0 unexpected=384
INFO [03-19|15:47:31] Imported new state entries count=384 elapsed=2.712µs processed=36203816 pending=10253 retry=0 duplicate=0 unexpected=384
INFO [03-19|15:47:32] Imported new state entries count=384 elapsed=27.117µs processed=36204200 pending=14955 retry=0 duplicate=0 unexpected=384

WTF!?!?! This thing is spamming my console! Let’s try again.

Lees-MacBook-Pro:~ leeazzarello$ geth --verbosity 2 console
Welcome to the Geth JavaScript console!
instance: Geth/v1.8.2-stable/darwin-amd64/go1.10
coinbase: 0xc255ac58231fba799e6822bf7af53fc50418aa8a
at block: 0 (Wed, 31 Dec 1969 16:00:00 PST)
datadir: /Users/leeazzarello/Library/Ethereum
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
> WARN [03-19|15:49:16] Synchronisation failed, retrying err="block download canceled (requested)"
WARN [03-19|15:50:16] Synchronisation failed, retrying err="block download canceled (requested)"
> eth.syncing
false
> eth.blockNumber
0

The output of eth.syncing is false (which appears to indicate the affirmative answer to the question “am I fully synced?”) but the current block is zero. That doesn’t make sense.

I wonder what syncing means? I doubt I know because I thought I was syncing but it doesn’t seem like I’m syncing. Looks like there’s a popular article on the subject. I read that.

Some lore on the proper usage of geth indicates fast synced chaindata from geth isn’t actually data which is useful for things like finding the current block and balances of addresses. Additional lore suggests I use a different client application called Parity.

Cool, I get to use Rust! Do I need to sync the whole blockchain again? Can I import the chaindata from geth? Storage is cheap and I can’t find an answer to the sharing data problem. Let’s run the two without sharing anything.

Lees-MacBook-Pro:parity leeazzarello$ ./target/release/parity --no-warp
2018-03-19 16:11:02 Keys path /Users/leeazzarello/Library/Application Support/io.parity.ethereum/keys/Foundation
2018-03-19 16:11:02 DB path /Users/leeazzarello/Library/Application Support/io.parity.ethereum/chains/ethereum/db/906a34e69aec8c0d
2018-03-19 16:11:02 Path to dapps /Users/leeazzarello/Library/Application Support/io.parity.ethereum/dapps
2018-03-19 16:11:02 State DB configuration: fast
2018-03-19 16:11:02 Operating mode: active
2018-03-19 16:11:03 Configured for Foundation using Ethash engine
2018-03-19 16:11:03 Updated conversion rate to Ξ1 = US$541.49 (8794077 wei/gas)
2018-03-19 16:11:08 Public node URL: enode://4121163a69d484ba67179c470087bec584f76acf85d6c937b70209e81851a39644f293cfd34fcfb911d5c468371a30e39f2e4f2cd1000e889304e3ca428f558a@10.7.34.83:30303
2018-03-19 16:11:13 Syncing #2039 4d35…2d91 205 blk/s 0 tx/s 0 Mgas/s 5388+ 1189 Qed #8636 8/25 peers 2 MiB chain 12 MiB db 11 MiB queue 4 MiB sync RPC: 0 conn, 0 req/s, 0 µs

Looks like my disk is filling up!

Lees-MacBook-Pro:chains leeazzarello$ pwd
/Users/leeazzarello/Library/Application Support/io.parity.ethereum/chains
Lees-MacBook-Pro:chains leeazzarello$ du -sh ethereum/
1.3G ethereum/

Not synced yet…I read Parity has a UI with an app store. Interesting. Let’s browse through that while the blocks are syncing.

The Parity UI

I’m browsing the Ðapp store. Ðapp UI wants to request permissions named “permission for Ðaaps”. I don’t know what this means. Do my Ðaaps need permission to request permissions? Whatever, click the Reject button…

Huh. That might have been the wrong choice. Let’s get that permission permissions thing back. Clicking Approve results in something different! Cool.

The Parity Ðaap browser

I’ll try GitHub hint Ðapp. Clicking open prompts “Permission for shell”. First try and there’s already an Ðapp asking for a shell on my local machine from a web browser. It’s cool, I’m not afraid. I’ll allow it. I’m presented with a field called URL. I put “http://example.com" into the form and I was prompted for “Permission for node”. Allowing it. Silence…

I don’t really know what just happened. I couldn’t notice anything that changed. I didn’t get a Github hint, whatever that means. Oh well.

Neat! There’s a Parity Wallet app (Ðapp?). It wants “Permission for accounts”. Seems legit. I’ll allow it.

It looks like I can add my employer’s smart contract. Cool. This time a new permission called “Permission for accountsEdit”. Click’d approve.

The Parity token watcher Ðaap

How’s my disk space looking?

Lees-MacBook-Pro:parity leeazzarello$ du -sh /Users/leeazzarello/Library/Application\ Support/io.parity.ethereum/chains/ethereum
4.5G

Getting there…

I notice Parity has an IDE to write smart contracts! Let’s type up a hello world contract while I’m waiting for my disk to fill up. I’ll be following the Ethereum greeter tutorial.

Looks like the solc compiler in the IDE is asking for some permissions that are not default. I don’t know how to grant these permissions but I know how to use solc outside of the Parity IDE. I’ll do that.

The Parity Smart Contract Editor

Abandoning the Parity smart contract editor, I continue with the instructions for the greeter tutorial. It says I should attach a WebSocket (RPC) connection to my local blockchain service. Let’s do it!

$ geth attach ws://127.0.0.1:8546
Fatal: Unable to attach to remote geth: bad status

Huh. Well, I’m running geth and attaching to a node running parity. Looks like not only are the chaindata formats incompatible, so are the network protocols for the RPCs. Muah wah. I start up geth and continue on the tutorial. Point of process…now geth and parity are running on the same computer.

Lees-MacBook-Pro:contract leeazzarello$ geth --ws --verbosity 1
Fatal: Error starting protocol stack: listen tcp 127.0.0.1:8546: bind: address already in use

lol, yeah. Need a different network port.

Lees-MacBook-Pro:contract leeazzarello$ geth --ws --wsport 8547 --verbosity 1
Lees-MacBook-Pro:contract leeazzarello$ geth attach ws://127.0.0.1:8547
Welcome to the Geth JavaScript console!
instance: Geth/v1.8.2-stable/darwin-amd64/go1.10
coinbase: 0xc255ac58231fba799e6822bf7af53fc50418aa8a
at block: 0 (Wed, 31 Dec 1969 16:00:00 PST)
modules: eth:1.0 net:1.0 rpc:1.0 web3:1.0

Yea! I’m connected but remember when geth told me it wasn’t synced a few days ago? Let’s see how this tutorial can progress. I don’t have a fully synced blockchain on my computer. It seems there are many other options. I’ll get to them in another part. For now, I cannot deploy the greeter tutorial. Let’s at least get the account stuff set up on my local geth chain.

Looks like the geth API changed since the greeter tutorial was written.

> personal.unlockAccount(eth.accounts[0])
Unlock account 0xc255ac58231fba799e6822bf7af53fc50418aa8a
Passphrase:
Error: The method personal_unlockAccount does not exist/is not available

Let’s try the test net.

Lees-MacBook-Pro:contract leeazzarello$ geth --testnet --ws --wsport 8547 --verbosity 1 console
> personal
{
listAccounts: undefined,
ecRecover: function(),
getListAccounts: function(callback),
importRawKey: function(),
lockAccount: function(),
newAccount: function github.com/ethereum/go-ethereum/console.(*bridge).NewAccount-fm(),
openWallet: function github.com/ethereum/go-ethereum/console.(*bridge).OpenWallet-fm(),
sendTransaction: function(),
sign: function github.com/ethereum/go-ethereum/console.(*bridge).Sign-fm(),
unlockAccount: function github.com/ethereum/go-ethereum/console.(*bridge).UnlockAccount-fm()
}
> personal.newAccount()
Passphrase:
Repeat passphrase:
Error: The method personal_newAccount does not exist/is not available

Wild. I guess I’m stuck. Time to go to the upstream project and do some bug hunting while I wait for Parity to sync over what looks like will take a number of days.

OR NOT! Looks like the API is broken but the command line utility calls different functions to create a new account.

Lees-MacBook-Pro:contract leeazzarello$ geth --testnet account new
INFO [03–20|14:24:50] Maximum peer count ETH=25 LES=0 total=25
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase:
Repeat passphrase:
Address: {861bd3185bf3344a21cd26828fc64b230c91f89a}

But the personal.unlockAccount() function called through a console continues to fail. At this point I think I’m going to take a break. I feel very confused. It seems like I need to dive deeper into the details of these software applications. Perhaps there are some utilities which could help complete the greeter tutorial?

In Summary

  • I installed two different ethereum client applications
  • Roughly 75GB was copied to my computer over two days but was not synced before I finished this essay
  • One client had an API which threw an exception on the documented use of a function
  • A tutorial using geth as an example client could not be reproduced on my computer

Stay tuned for part two, where I try and do a hello world with Parity after it syncs.

--

--

Lee Azzarello
Coinmonks

Consistently On Message — opinions my own — currently devops in aerospace and music h4x @noisebridge and @queeriouslabs