# Smart Contract NFTs

In order to integrate NFTs into a game, we need a smart contract for the NFTs. We'll create an NFT project locally, edit the NFT smart contract, fund the testnet account with STX and upload it there. The clarinet project should be created in the root folder of the cloned repository.

### Create a basic NFT Smart Contract to integrate into the game

Follow Hiro NFT example&#x20;

{% embed url="<https://docs.hiro.so/tutorials/clarity-nft>" %}

## Edit smart contract

### Rename MY-OWN-NFT to character

### Change token-URI

from `https://token.stacks.co/{id}.json` to `ipfs://QmNLo4oeN741Ai5PEafBnDtpXh2XMea8wBUGicTeErCtEB/{id}.json`

### Stacks Explorer

#### **Faucet - request STX for the address**

1. Go to <https://explorer.stacks.co/sandbox/faucet?chain=testnet>​
2. Connect wallet

   <figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F80OG0wKOPO2edA9QxQty%2Fuploads%2Fy1BDhinaQsqBpd3n0rs5%2Fimage.png?alt=media&#x26;token=80dea4df-4eb3-4cbe-bf37-e2e2ef2a25a2" alt=""><figcaption></figcaption></figure>
3. Select last option from the right list and press `Request STX`

   <figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F80OG0wKOPO2edA9QxQty%2Fuploads%2FiQ8UCSdMW132n0Sdxk9P%2Fimage.png?alt=media&#x26;token=153d4b6d-d299-4928-b2bf-c1272440aa99" alt=""><figcaption></figcaption></figure>

#### **Deploy `.nft-trait` and `.my-nft` smart contracts on testnet**

1. Select first option from the right list, paste the nft-trait contract from the local project, rename contract name to `nft-trait`, press `Deploy` and confirm the transaction

   <figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F80OG0wKOPO2edA9QxQty%2Fuploads%2F0t8rnuLkWKD2BDkn9DLo%2Fimage.png?alt=media&#x26;token=9f29b95c-43e8-4e6b-8bdf-8023dd328410" alt=""><figcaption></figcaption></figure>
2. Paste the my-nft contract from the local project, rename contract name to `my-nft` press `Deploy` and confirm the transaction

   <figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F80OG0wKOPO2edA9QxQty%2Fuploads%2FCRxfGaqLPDGXgKmcO3Hd%2Fimage.png?alt=media&#x26;token=05666bdd-f0fd-4f58-8dd0-4886b711684b" alt=""><figcaption></figcaption></figure>

#### **Wait for the smart contracts to get confirmed on the anchor block**

#### **Mint NFTs using the sandbox**

1. Copy `my-nft` contract address

   <figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F80OG0wKOPO2edA9QxQty%2Fuploads%2FMeO2zMyZxkNHswwe7Dno%2Fimage.png?alt=media&#x26;token=1f58066b-2320-4eee-9ce8-2bba582269ab" alt=""><figcaption></figcaption></figure>
2. Go back to sandbox, pick the second option from the right list and paste the contract name there

   <figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F80OG0wKOPO2edA9QxQty%2Fuploads%2FpX8KK7L4qBbtXzUD6OQ7%2Fimage.png?alt=media&#x26;token=b53dfba0-ac60-454f-80e9-b1268b971f83" alt=""><figcaption></figcaption></figure>
3. Select `claim` and call the function

<figure><img src="/files/vSUnA3TR3KkOyXruiQWt" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/x3P0aMtmXC0sEJJMABEv" alt=""><figcaption></figcaption></figure>


---

# 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.degenlab.io/gamefistacks/workshop/nft-web-app-integration/smart-contract-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.
