
Show HN: eth-private-net – Tooling to run a private Ethereum network locally - vincentchu
https://github.com/vincentchu/eth-private-net
======
virtuexru
> eth-private-net is a simple tool that allows you to quickly setup a three-
> node private Ethereum network running locally on your personal computer. The
> tool makes initializing, starting, and connecting nodes fast and easy. The
> network comes with three pre-made identities (Alice, Bob, and Lily) and a
> tutorial that walks you through simple actions like mining and transferring
> Ether, and culminates with the deployment and execution of a simple smart
> contract called FreeBeer.

> I wrote this tool because I found a lot of the Ethereum tooling opaque and
> difficult to understand. A lot of the information that I needed to know was
> scattered through the documentation, and there wasn't a single place that
> wrapped together the most instructive examples to build my understanding.
> Moreover, I wanted a tool that would allow me to repeatedly reinitialize a
> network from a known, clean state to help me experiment with building,
> deploying, and running smart contracts.

Exactly the kind of thing I've been looking for! Thank you tons.

------
Torgo
>I wrote this tool because I found a lot of the Ethereum tooling opaque and
difficult to understand.

Thank you, I don't feel alone now.

------
geofft
This is an amazingly well-written example! I have very little interest in
Ethereum (or cryptocurrency in general) but your writeup made me want to try
it out and play with it. I wish I had documentation this good for everything!

~~~
vincentchu
Thanks! We were doing some deep technical dives into ethereum and
cryptocurrencies here at Initialized Capital (where I work) and I was getting
frustrated that I couldn't get all of the moving pieces together in one place.

This tool / tutorial was something I threw together to prove to myself that I
understood everything, but then turned into something that I thought some
other people might be interested in playing with.

------
designium
Question: how does it differ to testrpc + web3?

~~~
vincentchu
testrpc is more of a backend for developing and running tests for solidity
smart contracts (e.g., Truffle recommends it as a backend for testing).

My project is more focused on getting people to use the actual ethereum
tooling (geth), and for them to learn what's going on under the hood.

------
netvarun
Here is a similarly great post if you'd like to get your feet wet on running
the bitcoin network locally (via regtest mode):

[https://witestlab.poly.edu/blog/get-rich-on-fake-
bitcoins/](https://witestlab.poly.edu/blog/get-rich-on-fake-bitcoins/)

------
onetom
We at enuma.io has also wrote a blog post with similar goals but specifically
for setting up a Proof of Authority chain:

[http://blog.enuma.io/update/2017/08/29/proof-of-authority-
et...](http://blog.enuma.io/update/2017/08/29/proof-of-authority-ethereum-
networks.html)

------
LeicaLatte
One small step towards a OCM. Thank you for this!

~~~
netvarun
By OCM you mean a one-click miner?

------
nguyenhd2107
Thank you man.

------
tonetheman
Lovely work!

------
hacker772
Thanks for putting this together! I had been looking for something like this
to get me started with Ethereum...

I've been going through the walkthrough and seem to have hit a snag. I have
alice, bob, and lily all initialized and connected to each other as peers to
form a three-node network, and have tried to have alice start mining. The
"Generating DAG in progress" completed after 13 minutes (not 1 minute as you
said it should, though I'm running Ubuntu on a virtual machine on my not-that-
fast Surface Book which may explain this. After it completes, I see this
message in the console:

DEBUG[09-08|12:27:59] Recalculated downloader QoS values rtt=20s
confidence=1.000 ttl=1m0s INFO [09-08|12:28:03] Generating DAG in progress
epoch=0 percentage=98 elapsed=12m39.760s INFO [09-08|12:28:09] Generating DAG
in progress epoch=0 percentage=99 elapsed=12m46.488s INFO [09-08|12:28:09]
Generated ethash verification cache epoch=0 elapsed=12m46.499s
DEBUG[09-08|12:28:09] Failed to load old ethash dataset epoch=1 err="open
/home/xxxxxx/.ethash/full-R23-290decd9548b62a8: no such file or directory"
INFO [09-08|12:28:13] Generating ethash verification cache epoch=1
percentage=82 elapsed=3.088s INFO [09-08|12:28:13] Generated ethash
verification cache epoch=1 elapsed=3.636s DEBUG[09-08|12:28:19] Recalculated
downloader QoS values rtt=20s confidence=1.000 ttl=1m0s DEBUG[09-08|12:28:39]
Recalculated downloader QoS values rtt=20s confidence=1.000 ttl=1m0s INFO
[09-08|12:28:59] Generating DAG in progress epoch=1 percentage=0
elapsed=22.150s DEBUG[09-08|12:28:59] Recalculated downloader QoS values
rtt=20s confidence=1.000 ttl=1m0s DEBUG[09-08|12:29:18] Couldn't add port
mapping proto=tcp extport=40301 intport=40301 interface="UPnP or NAT-PMP"
err="no UPnP or NAT-PMP router discovered" DEBUG[09-08|12:29:19] Recalculated
downloader QoS values rtt=20s confidence=1.000 ttl=1m0s INFO [09-08|12:29:22]
Generating DAG in progress epoch=1 percentage=1 elapsed=44.984s
DEBUG[09-08|12:29:39] Recalculated downloader QoS values rtt=20s
confidence=1.000 ttl=1m0s INFO [09-08|12:29:48] Generating DAG in progress
epoch=1 percentage=2 elapsed=1m11.554s DEBUG[09-08|12:29:59] Recalculated
downloader QoS values rtt=20s confidence=1.000 ttl=1m0s INFO [09-08|12:30:13]
Generating DAG in progress epoch=1 percentage=3 elapsed=1m36.181s
DEBUG[09-08|12:30:20] Recalculated downloader QoS values rtt=20s
confidence=1.000 ttl=1m0s INFO [09-08|12:30:34] Generating DAG in progress
epoch=1 percentage=4 elapsed=1m57.705s

I never see the "Successfully sealed new block" message and alice's ether
value never increases; it seems like a new "generate DAG" step just begins. I
also notice that in my .ethash directory I have two files:
"full-R23-0000000000000000" and "full-R23-290decd9548b62a8", with the "000..."
file last modified at 12:28 (the same time that the process completed" and the
"290..." file getting updated later. I then let this complete to 100 percent
(it took 34 minutes this time), and see the following:

INFO [09-08|13:02:48] Generating DAG in progress epoch=1 percentage=98
elapsed=34m11.249s DEBUG[09-08|13:03:04] Recalculated downloader QoS values
rtt=20s confidence=1.000 ttl=1m0s INFO [09-08|13:03:14] Generating DAG in
progress epoch=1 percentage=99 elapsed=34m37.494s INFO [09-08|13:03:14]
Generated ethash verification cache epoch=1 elapsed=34m37.500s
DEBUG[09-08|13:03:24] Recalculated downloader QoS values rtt=20s
confidence=1.000 ttl=1m0s DEBUG[09-08|13:03:44] Recalculated downloader QoS
values rtt=20s confidence=1.000 ttl=1m0s

Alice's ether value still hasn't increased. At this point I'm stumped as to
what's going on. Any help to get me moving again would be greatly appreciated.
Thanks!

~~~
vincentchu
Given that it took many minutes to generate the DAG, I'm wondering if your
machine is a bit underpowered. You can make mining much easier by adjusting
the difficulty parameter here (lower means faster mining):
[https://github.com/vincentchu/eth-private-
net/blob/master/ge...](https://github.com/vincentchu/eth-private-
net/blob/master/genesis.json#L8)

It was tuned to yield a block every 15 seconds or so on my laptop; may be
slower or faster depending on how fast your machine is relative to mine.

------
aqsheehy
Why though?

