89DEVs

What is Sepolia testnet and how to deploy smart contracts?

sepolia dolphinThe Sepolia testnet is a new test net of the Ethereum blockchain and replaced the Ropsten test net which is now deprecated. The Sepolia testnet relies on the proof-of-stake consensus mechanism since it successfully merged with the proof-of-stake beacon chain on July 6th 2022. 

It is highly recommended to test smart contracts on Sepolia Testnet or another Testnet before deploying them to the main net. 

Oh one more thing, ETH is called SEP on Sepolia. 

Sepolia Quick Facts

Network Name: Sepolia Test Network RPC URL: https://rpc.sepolia.dev alternative RPC URL: https://rpc.sepolia.online alternative RPC URL: https://www.sepoliarpc.space alternative RPC URL: https://rpc.sepolia.org alternative RPC URL: https://rpc-sepolia.rockx.com Network/Chain ID: 11155111 Symbol: SEP Block Explorer URL: https://sepolia.etherscan.io/ Consensus Mechanism: Proof of Stake EVM Version: London Genesis hash: 0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9 Faucets: https://sepoliafaucet.net/ https://faucet.sepolia.dev/ https://sepolia-faucet.pk910.de/ https://faucet-sepolia.rockx.com/ Merger Date: 6th of July 2022
In this tutorial, we will show you:
  1. how to connect MetaMask to Sepolia
  2. how to find the network settings for Sepolia Testnet
  3. how to get free test Ether from the Sepolia Faucet
  4. how to deploy a Solidity smart contract to the Sepolia Testnet
  5. how to use the block explorer for Sepolia Testnet

Add Sepolia Testnet to MetaMask

MetaMask has by default the Ropsten, Kovan, Rinkeby, and Goerli test nets already configured. To use the Sepolia testnet we have to configure our MetaMask wallet for it by adding the Sepolia Testnet details and pointing it towards a Sepolia node. To do so we click on the account icon in the top right corner of MetaMask and then select settings. select settings in MetaMask In the settings menu, we select the Networks to go to the network settings and to see an overview of all configured networks in MetaMask. go to settings menu in MetaMask If we already see the Sepolia Testnet under Networks then MetaMask is already configured for it. Otherwise, we have to add it by click the blue Add Network button. add new network to metamask

Network settings for Sepolia

To add Sepolia Testnet to our MetaMask wallet we have to enter the Sepolia Testnet details. This will connect our MetaMask wallet to the RPC endpoint of a node in the Sepolia Testnet. Just copy the settings below into MetaMask and click Save. Then the Sepolia Network will show up and can be selected in the dropdown menu.

Network settings for Sepolia Testnet

Find all network setting for the Sepolia Testnet in the following table:
parameter value
Network Name Sepolia Test Network
New RPC URL https://rpc.sepolia.dev
Chain ID 11155111
Symbol SEP
Block Explorer URL https://sepolia.etherscan.io/
Please make sure to copy the URLs without whitespace, otherwise, an error will be shown. add new network to MetaMask Alternative RPC URLs: https://rpc.sepolia.online https://www.sepoliarpc.space https://rpc.sepolia.org https://rpc-sepolia.rockx.com

Sepolia Faucet: Get test funds

The next step is to get some test funds to our MetaMask wallet. We will need them later to pay for the deployment fees of our Solidity contract. The currency in Sepolia is SEP instead of ETH and it is only valued on the testnet. We can get test funds from a faucet website that dispenses 0.05 SEP per user. copy address from metamask to sepolia faucet All we have to do is to use the Sepolia Faucet, copy our address from MetaMask, and paste it into the faucet website. Then solve the captcha and click Request funds after a few seconds the website will show that the transaction has been completed. Please be patient it make take a while. sepolia faucet dispenses free funds Time to go to our MetaMask wallet and check if the funds really arrived. It's also possible to check transactions on the Sepolia Testnet Blockexplorer. While the block explorer for the testnet might look the same as for the mainnet they are different, make sure you're using the correct block explorer otherwise the transactions won't show up. In case the Faucet is not working, here are some alternative Faucets: https://faucet.sepolia.dev/ https://sepolia-faucet.pk910.de/ https://faucet-sepolia.rockx.com/

Deploy contract to Sepolia

We have set up MetaMask and acquired test funds from the Sepolia faucet. Now it's finally time to deploy our smart contract written in Solidity to the Sepolia Testnet. We will use Remix in this tutorial because it is the most beginner-friendly IDE. In remix, we go to the Deploy & Run tab, which can be chosen on the left side. There we select Injected Web3 under Environment. If it is the first time, MetaMask will open to confirm the Connection between MetaMask and remix. connect MetaMask to remix After confirming the connection our MetaMask wallet is connected to the remix IDE. Now we can click Deploy in remix (the orange or red button depending on if the contract is payable or not). Then MetaMask will open another window asking for confirmation of the transaction. It will also show an estimate of the gas fees that we have to pay to deploy the contract. MetaMask will also show an estimate of how long it will take to complete the transaction. In our case, we're deploying to a testnet so the transaction is completed almost instantly (very likely within 15 seconds). We can confirm the transaction and the contract will be deployed. deploy smart contract to sepolia testnet In case the deployment takes too much time, we can even speed it up by clicking the blue Speed Up button. speed up contract deployment time on sepolia After the transaction has been completed we will receive a notification from MetaMask. We can then see the deployed contract in Remix under Deployed contracts and can test it as we would test on the local environment. deployed contract in remix For this tutorial we have deployed a hello world contract, so the only functionality is to echo hello world. However, deploying first to the Sepolia test net is crucial to make sure that your contract works as expected before deploying it to the Mainnet. If you're a beginner in Solidity make sure to check our Solidity Tutorial 2022.

Block explorer for Sepolia

With the deprecation of the Ropsten Testnet, the Sepolia Testnet is now the recommended testing ground for Solidity contracts before they are deployed to the Ethereum blockchain. To check transactions and smart contracts we can use the block explorer for the Sepolia testnet. It works the same way as the mainnet block explorer, however, transactions in the main net won't show up here and vice-versa. sepolia testnet explorer etherscan The Sepolia Testnet Explorer shows the latest blocks and latest transactions in the Sepolia testnet, you can reach it under the Etherscan subdomain sepolia.etherscan.io. An alternative block explorer for Sepolia is provided by Otterscan under the subdomain sepolia.otterscan.io. Learn also how to deploy smart contracts to alternative chains:

        

Summary

Click to jump to section