Skip to content

Instantly share code, notes, and snippets.

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

Sepolia is now on PoS

As of 2022/7/6, Sepolia has switched to PoS. The window to do some mining has closed.

Testnets after merge (original, old content from here)

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 and Kovan won't be merged.

I want to "get ready" for some Sepolia testing pre- and post-merge. Sepolia will not have a public validator set; testing post-merge will be limited to running applications on it. As Sepolia is PoW, I can actually go mine myself some SepplETH. 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 SepplETH and Explorer to https://sepolia.etherscan.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

@Jiangzy520
Copy link

Jiangzy520 commented Jun 11, 2022

它应该仍然有效。 我会看看权限错误发生了什么,这是出乎意料的。

Sir, the laptop CPU I use: AMD's own inherited graphics card GPU can mine to get Sepolia?

@yorickdowne
Copy link
Author

yorickdowne commented Jun 11, 2022

Probably. The easiest way is just to install t-rex and see what happens. I am by no means an expert. I have one GPU and the only things I ever mined were Ropsten and Sepolia testnets.

@Hua-Yen
Copy link

Hua-Yen commented Jul 13, 2022

新的 Sepolia Faucet 現在在哪邊呢?
https://sepoliafaucet.net/
https://faucet.sepolia.dev/
這二個水龍頭目前失效。

@yorickdowne
Copy link
Author

yorickdowne commented Jul 14, 2022

@Hua-Yen As far as I know, there is currently no reliable Sepolia Faucet. ethstaker Discord will run one, but we need Infura to offer a Sepolia endpoint, first. The ethstaker faucet will be protected by BrightID for Sybil resistance. It is incredibly hard to operate a faucet and keep it operational, because bots will attempt to drain it.

@yorickdowne
Copy link
Author

yorickdowne commented Oct 31, 2022

There was likely a mistake when updating geth.yml. git restore geth.yml and then just ./ethd config to run an RPC node on Sepolia. Sepolia mining is no longer possible, nor is validating.

@matewilk
Copy link

matewilk commented Nov 2, 2022

Hey, is it possible to run it on a Mac?

I'm trying to run it on MacOS but getting the following error:

$ ./ethd install
./ethd: line 1526: syntax error near unexpected token `&'
./ethd: line 1526: `            ;;&'

@avdheshcharjan
Copy link

avdheshcharjan commented Nov 6, 2022

same here

@qjawe
Copy link

qjawe commented Nov 6, 2022

I can't run ./ethd install neither ./ethd up
It shows this error

./ethd install
./ethd: line 1548: syntax error near unexpected token `&'
./ethd: line 1548: `            ;;&'

@avdheshcharjan
Copy link

avdheshcharjan commented Nov 6, 2022

Using MacBook Air M1 and having the same issue!

I can't run ./ethd install or ./ethd up
It shows this error

./ethd install
./ethd: line 1548: syntax error near unexpected token &' ./ethd: line 1548: ;;&'

@yorickdowne
Copy link
Author

yorickdowne commented Nov 7, 2022

There are faucets for Sepolia ETH, see https://faucetlink.to

As for Mac M1 and eth-docker: eth-docker uses some bash-isms and gets tested on Linux. I don't have a Mac to test on, alas, so it working on Mac is more miss than hit.

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