DEV Community

Cover image for Creating a blockchain using Ethereum (part 1)
Ryan
Ryan

Posted on • Edited on

Creating a blockchain using Ethereum (part 1)

Intro

Over the past few months I've really, really gotten into crypto so today I decided to create my own blockchain from scratch(ish). After very little research I decided Ethereum would be the best choice and I found this article on Medium and got cracking.

Installing geth

In the article they used Go Ethereum (geth), which is just the Golang implementation of the Ethereum protocol. The official site suggests that one of the quickest ways to get up and running is using Docker. Unfortunately I'm on a Mac M1 chip (arm64 CPU), so I thought it would be easier to use the Rosetta 2 emulator and Homebrew:

arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Alt Text

This set it up in the /usr/local directory. From here I could install:

arch -x86_64 brew install ethereum
Alt Text

Creating a Miner Account

Next, I set up a miner account to generate public and private keys:

geth account new --datadir <path-to-data-directory>

Finally I set up and initialized the genesis block which required creating a simple json file:

Alt Text

geth -datadir <path-to-data-directory> init <path-to-genesis-block>

Alt Text

And that was it! I was ready to start mining. Pretty easy, maybe 30 minutes and very little coding. Hopefully this trend continues in the next steps.

Goto Part 2

Top comments (4)

Collapse
 
altiano profile image
Altiano Gerung

curious, how much ETH will you get if running it on your M1 for 10 hours?

Collapse
 
talemache profile image
Ryan

I'm running it today so I'll let you know. Probably not much though, I would guess way less than 1 USD and a negative net profit.

Collapse
 
mccurcio profile image
Matt Curcio

Do you like Bill Maher's discussion on Bitcoin? lol

Collapse
 
talemache profile image
Ryan

Lol, not really but I don't know if he was just trying to be controversial or if he actually believes what he said. Maybe both Idk.