Part 3: Mint an NFT

You've just finished deploying your first NFT contract and verified its existence on Etherscan. The next step is to mint your first NFT from the contract. We deployed the contract with Shipyard, and we'll also be running a Shipyard script to mint the NFT.

Note: as of now, there won't be a collection page for your NFT collection. Even though the contract has been deployed, OpenSea does not create a collection page until we detect the first mint event for the contract.

Mint an NFT

Navigate to /script/Mint.s.sol where you'll see the following code

contract MintScript is Script {
    MintInterface targetContract;

    function setUp() public {
        // Replace the address of the target NFT contract here.
        targetContract = MintInterface(address(0));

    function run() public {
        // Call the function to mint a token. Note that the mint function on the
        // Dockmaster contract can only be called by an address with two leading
        // zeros in its address.

        // Replace the address below with the address that should recieve the
        // token.;

On Line 6, you'll need to replace address(0) with address(<your_contract>) so the script knows which contract to attempt to mint from.

Next, run the following command to actually mint your first NFT.

forge script script/Mint.s.sol --tc MintScript --private-key $WALLET_PRIVATE_KEY --fork-url $SEPOLIA_RPC_URL --broadcast

View on Etherscan

Lets check to make sure the mint was successful. Go back to Etherscan and search for your contract address. Click on the "NFT Transfers" tab, and you'll be able to see a mint event. Note that this screenshot shows two mint events because I ran the mint script two times.

View on OpenSea

Great! Now that you've confirmed that the mint actually occurred, it's time to check out the NFT on OpenSea.

Navigate to your profile and OpenSea's testnet website. In the "Created" tab, you'll see your newly minted NFT!! Click on it and you'll see something like this: