# Deploy KRC721 tokens

*Prerequisite*

* Connect your MetaMask wallet to KardiaChain mainnet or testnet. Detail instruction can be found [here](/docs/archived-docs/wallet/metamask-compatible.md).
* Have some KAI in your wallet to use as transaction fee

Deploying a new KRC721 token can be done by using [Remix](https://remix.ethereum.org/) and ERC721 contract from Open Zeppelin open source.

1. Open <https://remix.ethereum.org/>
2. Create new contract `KRC721.sol` and copy code from the following sample

```solidity
// contracts/GameItem.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

contract GameItem is ERC721URIStorage {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    constructor() ERC721("GameItem", "ITM") {}

    function awardItem(address player, string memory tokenURI)
        public
        returns (uint256)
    {
        uint256 newItemId = _tokenIds.current();
        _mint(player, newItemId);
        _setTokenURI(newItemId, tokenURI);

        _tokenIds.increment();
        return newItemId;
    }
}
```

3\. Deploy contract

![Deploy KRC721 contract](/files/wTfpvPtF59HsyuQ3v8cG)

![Deploy successfully](/files/RNNo2WwmHaufhBUuQqlu)

After deployed, new items can be created:

```bash
> gameItem.awardItem(playerAddress, "https://game.example/item-id-8u5h2m.json")
Transaction successful. Transaction hash: 0x...
Events emitted:
 - Transfer(0x0000000000000000000000000000000000000000, playerAddress, 7)
```

And the owner and metadata of each item queried:

```bash
> gameItem.ownerOf(7)
playerAddress
> gameItem.tokenURI(7)
"https://game.example/item-id-8u5h2m.json"
```

This `tokenURI` should resolve to a JSON document that might look something like:

```json
{
    "name": "Thor's hammer",
    "description": "Mjölnir, the legendary hammer of the Norse god of thunder.",
    "image": "https://game.example/item-id-8u5h2m.png",
    "strength": 20
}
```


---

# 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.kardiachain.io/docs/archived-docs/tutorials/krc721-tokens/deploy-krc721-tokens.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.
