# BRC-721: NFTs

The BRC-721 token standard on Bitcoin is similar to ERC-721 on Ethereum. It can represent virtually anything in Bitcoin:

* collectible items
* memberships
* lottery tickets
* in-game items
* and more

## Write a BRC-721 smart contract

Extending the OpenZeppelin ERC-721 contract, we can create a hypothetical PFP NFT collection (CryptoWizards) on Bitcoin.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";

contract CryptoWizards is ERC721URIStorage {
 
    constructor() ERC721("CryptoWizards", "WIZ") {}

    function safeMint(address to, uint256 tokenId, string memory uri) public {
        _safeMint(to, tokenId);
        _setTokenURI(tokenId, uri);
    }
}
```

## Compile the contracts

To compile your contracts, use the built-in `hardhat compile` task.

```bash
cd smart-contract-examples
npm install
npx hardhat compile
```

## Deploy the contracts

Review config file `hardhat.config.ts`. The network configs should look like this.

```js
  networks: {
    mynw: {
      url: "http://localhost:10002",
      accounts: {
        mnemonic: "<your mnemonic with funds>"
      },
      timeout: 100_000,
    },
    blockscoutVerify: {
      blockscoutURL: "http://localhost:4000", // your explorer URL
      ...
    }
  }
```

Run the deploy scripts using `hardhat-deploy`.

```bash
npx hardhat deploy --tags NFT
```

{% hint style="warning" %}
Make sure the accounts in hardhat.config.ts have some $BVM.
{% endhint %}

## Interact with the contracts

Once the contracts are deployed, you can interact with them. We've prepared a few `hardhat tasks` to make it easy for you to interact with the contracts.

```bash
# ./CryptoWizards/wizard100.jpg
npx hardhat mint-nft --metadata wizard100.json --tokenid 100

# output should contain the URI
npx hardhat get-nft --uri bfs://22213/0xfe94d57c6ef567d26e3524f54dc2772329092ffd/0xd3b0932Dff95a56c6024328162a3040F5e717F76/100
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bvm.network/bvm/bitcoin-dapps/evm-code-tutorials/brc-721-nfts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
