Deploy a Smart Contract to the Rinkeby Testnet

Ryan Harris
InstructorRyan Harris
Share this video with your friends

Social Share Links

Send Tweet
Published 3 years ago
Updated 3 years ago

So far we’ve been deploying to a blockchain running locally. Let’s get our smart contract onto the Rinkeby test network.

Create an account on the command line and then get some ether through a faucet. In this lesson, we used https://faucets.chain.link/rinkeby to get our fake ether. Then we use our same deploy script, except with the --network flag that we set to rinkeby.

Instructor: [0:00] Till now, we've been deploying our smart contract to a local blockchain instance, but let's deploy it to the Rinkeby testnet. You can think of this as Ethereum's staging environment.

[0:08] In our terminal, we first need to generate an account to use for the deployment. Let's run yarn generate. You can see here that we've generated a new account. If we come back down, we can type Yarn Account and get the balance information about the account we just created.

[0:28] You can see here we don't have any Ether on the Rinkeby testnet, so we'll need to go to a public faucet to get some. Let's go to the browser. There are multiple faucets from which to request testnet ETH, i.e., fake Ether. We'll come down here. We'll select Ethereum Rinkeby. I'll paste the address of the wallet we just created in VS Code, send a request.

[0:50] When that's done, we can go back to VS Code and run yarn account again. We now have .1 Ether in our account on the Rinkeby network. Let's try to deploy this contract to Rinkeby.

[1:01] Run yarn deploy, like we did before, but this time, give it the optional network flag --network and set it to Rinkeby. Once the contract has been deployed successfully, we can grab its new address on the Rinkeby testnet. We'll come up here. You can see our contract is deployed at this address, so copy and paste that. Then we'll go to the browser.

[1:25] This is the Rinkeby testnet version of the Etherscan block explorer. We can use it to look up our smart contract based on its new address. We'll come here, paste the address, and search. On this page, we have information about the smart contract.

[1:40] If we come down below, you'll see we have two transactions thus far. The first is creating the NFTix Booth smart contract, and the second transaction is transferring ownership of the smart contract to my MetaMask wallet.

[1:52] In review, we deployed our smart contract to the Rinkeby test network and confirmed the transaction was successful on Etherscan.