Tokens and NFTs RPC Commands

This document provides comprehensive documentation for all RPC commands related to tokens and NFTs in Navio. These commands allow you to create, manage, and interact with tokens and non-fungible tokens (NFTs) on the Navio blockchain.

Overview

Navio supports two types of digital assets: - Tokens: Fungible digital assets with a total supply - NFTs: Non-fungible tokens with unique identifiers and metadata

All token and NFT operations use BLSCT (BLS Confidential Transactions) for privacy and security.

Token Creation and Management

createtoken

Creates a new token with specified metadata and maximum supply.

Syntax:

createtoken "metadata" max_supply

Parameters: - metadata (object, required): Token metadata as key-value pairs - max_supply (amount, required): Maximum supply of the token

Returns:

{
  "hash": "transaction_hash",
  "tokenId": "token_id"
}

Example:

navio-cli createtoken '{"name":"MyToken","symbol":"MTK","description":"A sample token"}' 1000000

createnft

Creates a new NFT collection with specified metadata and maximum supply.

Syntax:

createnft "metadata" max_supply

Parameters: - metadata (object, required): NFT collection metadata as key-value pairs - max_supply (number, required): Maximum number of NFTs in the collection

Returns:

{
  "hash": "transaction_hash",
  "tokenId": "token_id"
}

Example:

navio-cli createnft '{"name":"MyNFTCollection","description":"A collection of unique NFTs"}' 1000

Token and NFT Minting

minttoken

Mints additional tokens to a specified address. Only the token creator can mint new tokens.

Syntax:

minttoken "token_id" "address" amount

Parameters: - token_id (string, required): The token ID (hex string) - address (string, required): BLSCT address to receive the minted tokens - amount (amount, required): Amount of tokens to mint

Returns:

"transaction_hash"

Example:

navio-cli minttoken "ba12afc43322f204fe6236b11a0f85b5d9edcb09f446176c73fe4abe99a17edd" "navio1..." 1000

mintnft

Mints a specific NFT from a collection to a specified address. Only the NFT collection creator can mint new NFTs.

Syntax:

mintnft "token_id" nft_id "address" "metadata"

Parameters: - token_id (string, required): The token ID of the NFT collection (hex string) - nft_id (number, required): The specific NFT ID to mint - address (string, required): BLSCT address to receive the minted NFT - metadata (object, required): NFT-specific metadata as key-value pairs

Returns:

"transaction_hash"

Example:

navio-cli mintnft "d46a375d31843d6a303dc7a8c0e0cccaa2d89f442052226fd5337b4d77afcc80" 1 "navio1..." '{"name":"Rare NFT #1","rarity":"legendary"}'

Balance and Information Queries

gettokenbalance

Returns the token balance for a specific token in the wallet.

Syntax:

gettokenbalance "token_id" ("dummy" minconf include_watchonly avoid_reuse)

Parameters: - token_id (string, required): The token ID (hex string) - dummy (string, optional): Must be excluded or set to "*" for backward compatibility - minconf (number, optional, default=0): Minimum confirmations required - include_watchonly (boolean, optional): Include watch-only addresses - avoid_reuse (boolean, optional, default=true): Avoid using dirty outputs

Returns:

"balance_amount"

Example:

navio-cli gettokenbalance "ba12afc43322f204fe6236b11a0f85b5d9edcb09f446176c73fe4abe99a17edd"

getnftbalance

Returns the NFTs owned from a specific collection.

Syntax:

getnftbalance "token_id" ("dummy" minconf include_watchonly avoid_reuse)

Parameters: - token_id (string, required): The token ID of the NFT collection (hex string) - dummy (string, optional): Must be excluded or set to "*" for backward compatibility - minconf (number, optional, default=0): Minimum confirmations required - include_watchonly (boolean, optional): Include watch-only addresses - avoid_reuse (boolean, optional, default=true): Avoid using dirty outputs

Returns:

{
  "nft_id": {
    "metadata_key": "metadata_value"
  }
}

Example:

navio-cli getnftbalance "d46a375d31843d6a303dc7a8c0e0cccaa2d89f442052226fd5337b4d77afcc80"

Transfer Commands

sendtokentoblsctaddress

Sends tokens to a BLSCT address.

Syntax:

sendtokentoblsctaddress "token_id" "address" amount ("memo" verbose)

Parameters: - token_id (string, required): The token ID (hex string) - address (string, required): BLSCT address to send tokens to - amount (amount, required): Amount of tokens to send - memo (string, optional, default=""): Optional memo for the transaction - verbose (boolean, optional, default=false): Return extra transaction information

Returns:

"transaction_hash"

Example:

navio-cli sendtokentoblsctaddress "ba12afc43322f204fe6236b11a0f85b5d9edcb09f446176c73fe4abe99a17edd" "navio1..." 100 "Payment for services"

sendnfttoblsctaddress

Sends an NFT to a BLSCT address.

Syntax:

sendnfttoblsctaddress "token_id" nft_id "address" ("memo" verbose)

Parameters: - token_id (string, required): The token ID of the NFT collection (hex string) - nft_id (number, required): The specific NFT ID to send - address (string, required): BLSCT address to send NFT to - memo (string, optional, default=""): Optional memo for the transaction - verbose (boolean, optional, default=false): Return extra transaction information

Returns:

"transaction_hash"

Example:

navio-cli sendnfttoblsctaddress "d46a375d31843d6a303dc7a8c0e0cccaa2d89f442052226fd5337b4d77afcc80" 1 "navio1..." "Gift NFT"

Transaction Management

listblscttransactions

Lists BLSCT transactions in the wallet.

Syntax:

listblscttransactions ("label" count skip include_watchonly)

Parameters: - label (string, optional): If set, should be a valid label name to get transactions for - count (number, optional, default=10): The number of transactions to return - skip (number, optional, default=0): The number of transactions to skip - include_watchonly (boolean, optional): Include transactions to watch-only addresses

Returns:

[
  {
    "account": "account_name",
    "address": "address",
    "category": "send|receive",
    "amount": 1.23,
    "label": "label",
    "vout": 0,
    "confirmations": 6,
    "blockhash": "block_hash",
    "blockindex": 1,
    "blocktime": 1234567890,
    "txid": "transaction_hash",
    "time": 1234567890,
    "timereceived": 1234567890,
    "comment": "comment",
    "to": "recipient_address"
  }
]

Example:

navio-cli listblscttransactions

listblsctunspent

Lists unspent BLSCT outputs in the wallet.

Syntax:

listblsctunspent (minconf maxconf "addresses" include_unsafe query_options)

Parameters: - minconf (number, optional, default=1): Minimum confirmations required - maxconf (number, optional, default=9999999): Maximum confirmations - addresses (array, optional): Array of addresses to filter by - include_unsafe (boolean, optional, default=true): Include outputs that are not safe to spend - query_options (object, optional): JSON object with query options

Returns:

[
  {
    "txid": "transaction_hash",
    "vout": 0,
    "address": "address",
    "account": "account_name",
    "scriptPubKey": "script",
    "amount": 1.23,
    "confirmations": 6,
    "spendable": true,
    "solvable": true,
    "safe": true
  }
]

Example:

navio-cli listblsctunspent

**Parameters:**
- `amount` (amount, required): Amount to lock for staking

**Returns:**
```json
"transaction_hash"

Example:

navio-cli stakelock 1000

stakeunlock

Unlocks previously locked BLSCT outputs.

Syntax:

stakeunlock "address" amount

Parameters: - amount (amount, required): Amount to unlock

Returns:

"transaction_hash"

Example:

navio-cli stakeunlock 1000

Error Codes

Common error codes you may encounter:

  • RPC_INVALID_ADDRESS_OR_KEY: Invalid address or token ID
  • RPC_INVALID_PARAMETER: Invalid parameter provided
  • RPC_WALLET_INSUFFICIENT_FUNDS: Insufficient funds for transaction
  • RPC_WALLET_UNLOCK_NEEDED: Wallet needs to be unlocked
  • RPC_METHOD_DEPRECATED: Method is deprecated

Examples

Creating and Managing a Token

# Create a new token
navio-cli createtoken '{"name":"MyToken","symbol":"MTK","description":"A utility token"}' 1000000

# Mint additional tokens
navio-cli minttoken "token_id_here" "navio1..." 50000

# Check token balance
navio-cli gettokenbalance "token_id_here"

# Send tokens to another address
navio-cli sendtokentoblsctaddress "token_id_here" "navio1..." 1000 "Payment"

Creating and Managing NFTs

# Create an NFT collection
navio-cli createnft '{"name":"Art Collection","description":"Digital art NFTs"}' 100

# Mint a specific NFT
navio-cli mintnft "collection_id_here" 1 "navio1..." '{"name":"Mona Lisa","artist":"Da Vinci"}'

# Check NFT balance
navio-cli getnftbalance "collection_id_here"

# Send NFT to another address
navio-cli sendnfttoblsctaddress "collection_id_here" 1 "navio1..." "Gift"