Now that we've have our Ropsten ETH and added it our MetaMask wallet, we'll learn how to deploy our Number
smart contract to the Ropsten testnet. We will be using the free version of QuickNode Link as our rcp-url.
Instructor: [0:01] With that, we can now deploy our contract to the Ropsten test network. Instead of taking a look on our local machine to look at state, we will go to a block explorer. What we'll want to do is we'll want to go back over here. With us on this test network, we can do the exact same steps that we did before. [0:25] The first thing that we'll want to do is we'll scroll up to whenever we ran our forge create. We'll need to change the private key here. The private key, we will want to grab this from MetaMask. We can go back to our window here, and we will click on here.
[0:50] We can go to Account Details, export our private key, type in your password, and click. Let's go ahead and copy this. Our private key here, paste that in, and our constructor args will say 10. Then, there's another argument. We're going to shut down our Anvil server here since we don't need it anymore, and we're going to pass in an RPC URL flag.
[1:22] Since we are not running an Ethereum server on our local machine, we will need to go grab an RPC from somewhere. There are a lot of different services that provide RPC access. I use QuickNode. You can go to quicknode.com and sign up for an account. It just asks for your email. From there, you can go to the dashboard here and we'll create an endpoint.
[1:46] Here, we're on Ethereum and we want to grab the Ropsten endpoint since that's where we got all of our Ethereum. Over here, we don't want to have any add-ons. Cool. Here is a free plan and discover. Here, we will create that.
[2:11] Now, all we need right here is this HTTP provider, so we can grab that, and we can just paste it right there. Then, whenever we hit this, you can see that this will begin compiling.
[2:29] Don't be worried if this takes a little bit longer than it did previously because now instead of waiting for our own machine to pick up what, "Hey, we sent a transaction, and it immediately mines it for us," we need to wait for the Ropsten test network to receive the transaction and deploy it.
[2:47] Here you can see that this is our public key on MetaMask. If you double-checked this against the account that you created on MetaMask, you would see that this is your public address. We can see that we deployed it here, and there's a transaction hash. We'll look this up in a little bit.