No More Goerli Faucet! Using the New Infura Sepolia Faucet for Ethereum Smart Contract Testing
It’s difficult to get testnet ETH to test your smart contracts. Let's see how you can get free testnet ETH using the Sepolia test network and the Infura Seoplia faucet.
Join the DZone community and get the full member experience.
Join For FreeWhen you first start developing on Ethereum, you quickly discover how critical it is to test your dapps — even more so than in traditional development.
But almost as quickly as learning you need to test is learning that it’s very difficult to get the testnet ETH you need to complete that testing! It’s a frustrating, and at times confounding, problem all Ethereum devs face.
But there are solutions. Let’s look at one of them: the new Infura Sepolia faucet — which drips .5 testnet ETH per wallet per day. If you don’t know what testnet ETH is, or what drips means, or even what the Ethereum testnet is, we’ll cover all that here.
And if you do already know all that — skip down to the bottom, where we’ll walk through the details of how to get that Sepolia testnet ETH for free!
Sepolia Testnet Logo from Sepolia.dev
Testing Smart Contract Requires Testnet ETH
In web3, it’s critical to test your dapps. Not only do blockchain developers have the concerns of web2 developers, but added on is the weight of immutability — once a smart contract is deployed, it can’t be changed. And with massive economic risk undertaken by many smart contracts, testing to ensure your smart contract is secure, scalable, and free from vulnerabilities is crucial.
So, it’s no wonder there is an entire industry dedicated to making sure smart contracts are tested well. From tools such as Truffle and concepts such as Fuzzing to paid audits to established best practices — there is plenty of source material to work from.
And one of those best practices is testing your dapp on a testnet — a blockchain that mimics the production version of a blockchain (the Ethereum mainnet). Just as it sounds and similar to traditional development, a blockchain testnet is a test environment.
Acquiring Testnet ETH Is Difficult
But there’s a big problem with web3. You need testnet ETH to use the testnets. You need it to pay gas fees and fund your contracts…. Basically, you need to test your smart contract. And it is surprisingly difficult to obtain testnet ETH. Even though it’s meant to have zero value (and to be freely and easily accessible to developers), it’s notoriously difficult to get. And with the advent of L2s (Polygon, zkEVM, etc.) and testnet ETH bridging, getting your hands on these testnet tokens is even more important and challenging than ever.
In fact, it’s so challenging to get the testnet ETH that LayerZero recently opened a pool to start selling Goerli testnet ETH. Yes, you read that right; the ETH that is supposed to be free and widely available is so difficult to get there is now a market for buying and selling it. And while many developers fundamentally disagreed with this market (as they don’t want to commoditize the ability to test), that didn’t stop many of them from using the pool to quickly acquire the testnet ETH they needed.
So, what can be done?
Many devs advocate switching to an alternate testnet where the ETH is easier to acquire. Namely, Sepolia—where the faucets drip freely :)
What Is Sepolia?
Goerli is the largest public Ethereum testnet and is often the default environment for devs. But as mentioned above, it is notoriously difficult to get testnet ETH on Goerli. And beyond that, Goerlie is in the process of being sunsetted.
Sepolia is a newer testnet (launched in late 2021), currently running PoS, that was created to mimic “harsher” network conditions. It has short block times and faster transaction confirmation times than other testnets. It is meant to replace the Rinkeby and Kovan networks. And it has plenty of testnet ETH to go around!
(from eth-clients/sepolia: the sepolia/bepolia testnet configurations)
In short, the Ethereum Sepolia network is the perfect network to use for testing and now is the perfect time to start using it. And, of course, to do that, you need that Sepolia testnet ETH.
What Is the Purpose of a Sepolia Faucet?
There is where a faucet comes in. A faucet is a free way to get tokens. It “drips” a certain amount of tokens to your crypto wallet address at a given rate. Typically, most faucets allow you to request tokens once per day (at a maximum).
You can get Sepolia ETH using the new ConsenSys Sepolia faucet.
How To Get Sepolia ETH Using the New Infura Sepolia Faucet
Let’s walk through how to get that Sepolia testnet ETH using the Sepolia testnet faucet — a new faucet that drips .5 free testnet ETH per day.
How To Use the New Sepolia Faucet
1. Set up MetaMask in your browser. MetaMask is a digital wallet that holds your tokens, including your Sepolia ETH.
2. By default, MetaMask loads to the Ethereum mainnet. Follow these instructions to switch to the Sepolia network. (It’s hidden by default.)
3. Go to the Sepolia faucet at infura.io/faucet. Enter your wallet address. (if you have issues copying the wallet address, check this note here).
4. Login with your Infura account.
5. Get your funds!
6. Enjoy testing with the test ETH!
Conclusion
Testing is key to smart contract development on Ethereum. And for years, trying to get the necessary testnet ETH has been frustrating. But with the new Sepolia testnet and ConsenSys Sepolia faucet, life as an Ethereum dev is a little bit easier. Try it out and get that .5 testnet ETH!
Published at DZone with permission of Michael Bogan. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments