# Mint a Basic NFT

### Prerequisites

Before getting started, make sure you have the following ready:

1. [Create a Ternoa](/getting-started/wallets/ternoa-wallet.md) account with [Alphanet CAPS](broken://pages/ej9gceaLIhCN2PgUBh42)
2. Install and set up your editor of choice (we will use Visual Studio Code \[VSC] in this tutorial)
3. Install [NodeJS v.14+](https://nodejs.org/en/download/) & NPM
4. [Install & initialize Ternoa-JS](/build-1/javascript/ternoa-js-library-utilities/installation-and-initialization.md)

### Minting a Basic NFT on-chain using Ternoa-JS

To create an NFT on the Ternoa chain, Ternoa-JS provides you with a `createNft` helper to do so. It returns an object promise containing the `NFTCreatedEvent` returned by the Ternoa blockchain.

Replace *IPFS\_CID* in the following code snippet with your CID hash previously generated in [Prepare Basic NFT assets](/build-1/javascript/nft-features-and-pallets/basics-nft-and-collections/nft/prepare-basic-nft-assets.md):

```typescript
import { createNft, getKeyringFromSeed, WaitUntil } from "ternoa-js";

const mintNFT = async () => {
	try {
		const keyring = await getKeyringFromSeed("//TernoaTestAccount");
		const nftData = await createNft(
			"IPFS_CID",
			0,
			undefined,
			false,
			keyring,
			WaitUntil.BlockInclusion
		);
		console.log("The on-chain NFT id is: ", nftData.nftId);
	} catch (e) {
		console.error(e);
	}
};
```

{% hint style="info" %}
Use your own account by updating the `//TernoaTestAccount` with your account seed when retrieving the keyring from the example below.
{% endhint %}

Here are detailed the `createNft` helper parameters:

```markdown
`offchainData`: a string that can be IPFS CID hash that points to a JSON file, a plain text, a small JSON string, or a link to either a static or a dynamic file.
`royalty`: a number (in percentage between 0 and 100) to set the royalties taken by the owner for each NFT sale.
`collectionId`: an optional parameter. If you want your NFT to belong to a collection, add the collection id here otherwise keep it undefined.
`isSoulbound`: (boolean): when set to true, the NFT will be a soulbound NFT. The default is false.
`keyring`: the provided keyring (containing the address) will be used to sign the transaction and pay the execution fee.
`waitUntil`: WaitUntil defines at which point we want to get the results of the transaction execution: BlockInclusion or BlockFinalization.
```

The response returned includes all the information below according to the parameters provided when creating the NFT. Note that `MintFee` refers to the fee paid to mint the NFT in Big Number format (`MintFeeRounded` is the humanized format, easier and more friendly to use).

```markdown
`nftId`: ID of the NFT.
`owner`: The owner of the NFT.
`offchainData`: The off-chain data provided for the NFT.
`royalty`: The royalty fee set for the NFT.
`collectionId`: The ID of the collection, the NFT belongs to.
`isSoulbound`: True if the NFT is soulbound. False if the NFT is not soulbound.
`mintFee`: Minting fee for the NFT. Big Number format
`mintFeeRounded`: Minting fee for the NFT. Basic number format.
```

### Next

The next step will be getting the NFT data from the Ternoa Indexer using the NFT id just generated. Keep it and continue on the [Retrieve a Basic NFT](/build-1/javascript/indexer/featured-requests/basic-and-soulbound-nft.md) guide.

### Support

If you face any trouble, feel free to reach out to our community engineers in our [Discord](https://discord.gg/fUmBkPpnRu).


---

# 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.ternoa.network/build-1/javascript/nft-features-and-pallets/basics-nft-and-collections/nft/mint-a-basic-nft.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.
