Adding a Way to Deploy the Contract

Learn how to deploy contracts on the blockchain.

Deploying contracts

To deploy our contract on the blockchain, we’ll need to have the JSON description of the contract’s Application Binary Interface (ABI). Luckily, this is something that Hardhat creates for us when it compiles the contract.

Inside the Hardhat project, find the artifacts/contracts folder. Inside, there should be a folder for our contract. Copy the JSON file in that folder to contract/Contract.json in our front-end project.

artifacts
__contracts
__contract
__Contract.json

We’ll be importing that file from our Next.js application:

import Contract from "../contract/Contract";

Let’s add a button to initiate the creation of the contract. We’ll make use of the MainButton component for this purpose. We’ll create a function called handleStartPartnership that will take care of the contract creation when the button is clicked. ...