Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get that sweet Sepolia ETH

Testnets after merge

It's mid 2022, Ethereum is still PoW and motoring towards merge / PoS. Surviving testnets will be Sepolia - currently PoW - and Goerli. Ropsten will be merged and then deprecated, Rinkeby won't be merged, and Kovan is Gnosis' concern.

I want to "get ready" for some Sepolia testing pre- and post-merge. Sepolia will likely not have a public validator set; testing post-merge would be limited to running applications on it. As Sepolia is PoW, I can actually go mine myself some SEPPETH. Here's how.

Components

  • Geth on Sepolia, Linux. This could absolutely be Windows, I just happen to have Linux tooling I like
  • ethminer or t-rex, Windows, with an NVidia or AMD GPU. Mostly because the only GPU I have that can mine is in my Windows box

Set up Geth

I'm using eth-docker for this.

Get prereqs: sudo apt update && sudo apt install -y docker-compose

Make your user part of the docker group so you don't need sudo for docker commands: sudo usermod -aG docker MYUSERNAME && newgrp docker

Clone eth-docker: git clone https://github.com/eth-educators/eth-docker.git sepolia && cd sepolia

Configure eth-docker for this: cp default.env .env, then nano .env and set

  • COMPOSE_FILE=geth.yml:el-shared.yml
  • EL_NETWORK=sepolia

Save and close.

Get the ETH address you want the Sepolia mining rewards to be sent to. Anything created in Metamask will do.

A few changes for Geth so it can mine. nano geth.yml and change the entrypoint. Enable the miner API, and append to it:

    entrypoint:
      - geth
      .... existing entries, leave those be
      - --http.api
      - web3,eth,net,miner
      .... existing entries, leave those be
      - --pprof.addr
      - 0.0.0.0
      - --mine
      - --miner.etherbase
      - "0xMYETHADDRESS"

You need the quotes around the address, and 0xMYETHADDRESS is going to be your actual address.

Start it: ./ethd up, and look at the logs with ./ethd logs -f execution. It should sync the chain in minutes and then be ready for mining.

Firewalling

If your Linux boxen is on the Internet, not in your home network, and only then, you'll want to firewall the RPC port 8545 and WS port 8546, which are both exposed now. Follow instructions to place ufw "in front of" docker, get the public IP your Windows box uses with something like whatismyip and create a simple policy along these lines:

sudo ufw allow OpenSSH
sudo ufw allow proto tcp from MYPUBLICIP to any port 8545
sudo ufw deny 8545
sudo ufw deny 8546

And finally sudo ufw enable. Adjust the policy to your own needs if you already had ufw running.

Connect Metamask to Sepolia

In Metamask, go to Settings, Network, Add Network and create a new custom network.

Call it Sepolia Test Network, set the New RPC URL to your Sepolia Geth as http://IP-OF-GETH-BOX:8545, Chain ID 11155111, currency symbol SEPPETH and Explorer to https://sepolia.otterscan.io.

Windows mining

Your AntiVirus and browser will likely quarantine these as cryptominers, because they are. You'll need to allow-list them.

Grab ethminer. It's open source, but doesn't work with newer-generation cards. A PR that enables CUDA11 and thus RTX 3000 series does exist, but there are no ready-made executables for it.

Extract that somewhere, get into a PowerShell or create a bat file, then start it like so: For NVidia, .\ethminer.exe -U -P getwork://IP-OF-GETH-BOX:8545 or for AMD, .\ethminer.exe -G -P getwork://IP-OF-GETH-BOX:8545.

You can get help with .\ethminer.exe --help.

An alternative is t-rex, which is closed-source. It takes a 1% dev cut, and supports newer-generation cards. Download it, then run it in PowerShell or via bat as .\t-rex.exe -a ethash -o http://IP-OF-GETH-BOX:8545.

You can get help with .\t-rex.exe --help.

In my testing both ethminer and t-rex get almost the same hashrate from GTX 1080 and GTX 1070, with T-Rex ahead by maybe 5%. T-Rex does have a nice UI.

Done

In your Geth logs, you should see 🔨 mined potential block and 🔗 block reached canonical chain as well as the occasional ⑂ block became an uncle, and in ethminer you should see Job: and **Accepted messages.

Enjoy the feeling of early Ethereum mining. Difficulty on Sepolia is low, you should see rewards come in steadily.

@TobiWo
Copy link

TobiWo commented Mar 5, 2022

Thanks for the detailed explanation @yorickdowne .
I just want to add that I had some strange behavior of my GPU while mining on Sepolia (I guess it would be the same on mainnet or other ethash chains) and maybe someone experiences the same.

I'm mining with a single 1080 GTX and interestingly it could happen that the GPU only mined with 25% of it's hashpower. I have no idea why this happens. As far as I know the 1080 was not patched for LHR (light hash rate). Maybe it is a specific issue with my 1080.

However, I accidentally found out that the GPU needs some kind of kickstart to run with full hashpower. The kickstart is simply a youtube video or some similar work/process where the GPU is involved. Sometimes I just need this as a kickstart, sometimes I need to stream a video all the time (I can recommend longplays of video games for that purpose 😉 ). So if anybody sees the same behavior, just start a youtube video and your GPU will mine with full power.

@yorickdowne
Copy link
Author

yorickdowne commented Mar 7, 2022

Wow that's strange @TobiWo ! Thanks for sharing.

@StephenFluin
Copy link

StephenFluin commented May 2, 2022

Are these instructions still working? ec--shared.yml was renamed to el-shared.yml, and I keep getting this after running ./ethd-up and attaching to the execution:

sepolia_execution_1 exited with code 1
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied
execution_1         | standard_init_linux.go:228: exec user process caused: permission denied

@yorickdowne
Copy link
Author

yorickdowne commented May 4, 2022

It should still work. I’ll take a look as to what’s going on with permission errors, that’s unexpected.

@nft-fun
Copy link

nft-fun commented May 19, 2022

Thanks for putting this together. I think I've got it going on an old macbook running ubuntu but I didn't do anything related to ethminer or t-rex; which I see you alluded to. Is my machine actually mining then? Or is it just continually syncing the node and not attempting to mine blocks?

Edit - also for the folks mentioning permissions I did need to run the ./ethd commands with sudo. I also needed to use the file name COMPOSE_FILE=geth.yml:el-shared.yml . In addition to a new EC_NETWORK=sepolia in my .env I also modified EL_NETWORK=sepolia and NETWORK=sepolia. I think it sync'd a goerli genesis block to my machine in my initial setup before making those changes, so I needed to run sudo ./ethd terminate to clear out the mismatched genesis block and start fresh.

@yorickdowne
Copy link
Author

yorickdowne commented May 19, 2022

sudo for docker commands is needed if your user isn't part of the docker group. Entirely up to you how you'd like to run this. sudo usermod -aG docker MYUSERNAME makes your user part of the docker group.

Good point that I renamed things to EL from EC, made that change in the instructions.

You now have a synced Geth on Sepolia. You are indeed not mining anything until and unless you point a machine with a GPU running a mining executable at this Geth. I've documented it for Windows only because that's what I have. I do not doubt that mining software exists for Linux or macOS, I just didn't go looking for it.

@nft-fun
Copy link

nft-fun commented May 19, 2022

Thanks for the feedback and for your efforts!

@parkan
Copy link

parkan commented May 26, 2022

Thanks for the detailed explanation @yorickdowne . I just want to add that I had some strange behavior of my GPU while mining on Sepolia (I guess it would be the same on mainnet or other ethash chains) and maybe someone experiences the same.

I'm mining with a single 1080 GTX and interestingly it could happen that the GPU only mined with 25% of it's hashpower. I have no idea why this happens. As far as I know the 1080 was not patched for LHR (light hash rate). Maybe it is a specific issue with my 1080.

However, I accidentally found out that the GPU needs some kind of kickstart to run with full hashpower. The kickstart is simply a youtube video or some similar work/process where the GPU is involved. Sometimes I just need this as a kickstart, sometimes I need to stream a video all the time (I can recommend longplays of video games for that purpose wink ). So if anybody sees the same behavior, just start a youtube video and your GPU will mine with full power.

did you check your clocks with nvidia-smi? I am guessing the card is running underclocked by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment