New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Test Network Configuration

BaseMon, Oct 9, 2023, 12:00 AM

Configure your deploy script to work on different test networks like Base Squarley, Gorly, and Mumbai. Securely manage keys and secrets using .env files to prevent compromising your smart contract. Keep your deployments safe and test with confidence. 🔒🚀 📚 Head to Base Camp for full courses on smart contract development: https://docs.base.org/base-camp/docs/welcome ✅ Subscribe to our channel here: https://www.youtube.com/@BuildonBase ► Build on Base: https://base.org ► Follow us on Twitter: https://twitter.com/buildonbase ► Join our Discord: https://base.org/discord

Transcript

now that we know our deploy script works we can configure it to use on different test Networks the first thing that we're going to need to do that is setup.env so we will use yarn add as a developer resource .env then in our config file for hard hat we will import dot EnV from and then run dot EnV y dot config foreign you probably already know how important it is to use tools like EnV to protect keys and other secret information but it's particularly important for a smart contract because if your wallet gets compromised then that permanently and irrevocably compromises the entire smart contract as deployed and there's really not any way that you can fix it other than deploying a new smart contract and directing your users to that one so I've already set up a DOT EnV file with this information in it we're going to need the mnemonic which is the 12 words that make up our while it's key and we're going to use alchemy keys for Gorly and Mumbai if you need your own Keys you can go to alchemy's website and sign up for a free account and you should be able to get some some keys that are sufficient for testing next we're going to add a property for Networks and the first one we'll add is base quarterly foreign this is the test Network for coinbases L2 chain and in that we need a URL which is https go early .base.org and then for accounts we'll use our mnemonic which is in process.

env onic and then we're going to say if we don't have that we just want to import an empty string and the reason why we're doing this instead of importing the mnemonic as a string is that this will let us or let one of our colleagues who might be working on the repo as well run all the tests locally on the hard hat Network without needing to set up all of these environment variables it's not just a little bit of extra convenience next we'll go ahead and add the same thing for the girly and Mumbai networks I'm going to go ahead and copy and paste these in to avoid you needing to watch me type a bunch of things but it's the same information just for those Networks one difference you'll see is that the URL is not open and public for these networks so you'll need to use a provider and have uh most likely a key from that provider when you import the URL

Automatic transcript — names and jargon may be misspelled.