Skip to content

0xhokusai/hokusai-get-started

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started with Hokusai 🌊

This document covers the setup and basic usages of Hokusai.
After completing this tutorial, you'll be able to use Hokusai and start integrating NFT on your website.

Table of Contents

Getting Started
Using Hokusai
Hokusai Links

Getting Started

To get started with Hokusai, first, clone this repository and follow the below tutorial.

git clone https://github.com/0xhokusai/hokusai-get-started.git

The installation requires the following steps:

  • Obtain API key
  • Create your wallet
  • Publish NFT metadata
  • Access NFT metadata

1. Obtain your API key

Submit your request for an API key here. You will receive the key, which contains HOKUSAI_API_KEY and HOKUSAI_CONTRACT_ID. Currently, it takes 2-3 business days to issue the API Key.

2. Create your wallet

To mint an NFT, you must have your wallet address. We recommend using Metamask for wallet software.

Metamask is a software cryptocurrency wallet used to interact with the Ethereum blockchain. These articles provide a great introduction on how to set up Metamask.

3. Publish NFT metadata

Metadata is data that provides information about other data. NFT metadata contains information about its name, description, and image. We use nft.storage to publish NFT metadata.

3.1 Setup nft.storage

Follow the setup guideline for nft.storage here.

3.2 Add your API keys

Copy the .env.sample file and fill in your own API keys in .env file.

cp .env.sample .env # and rewrite API Keys

3.3 Install required packages via yarn

yarn # install the required packages

In case you have not installed yarn, follow the setup here.

3.4 Publish metadata

You can publish metadata using our sample image (hokusai.png) by running the following codes

yarn store-metadata 

You will get a URL for the metadata like this

HTTPS URL for the metadata: https://dweb.link/ipfs/bafyreieaaqfof34kfqyvwe4arta6jsuwuauim4d24qo22ct2xnvjnlnrb4//metadata.json # example metadata URL

3.4 Access metadata

You can access the metadata uploaded on IPFS via HTTPS URL by running the code below. IPFS is a distributed system for storing and accessing files, websites, applications, and data. Learn more about IPFS here.

curl https://dweb.link/ipfs/bafyreieaaqfof34kfqyvwe4arta6jsuwuauim4d24qo22ct2xnvjnlnrb4/metadata.json # example metadata url

{
    "name":"nft.storage store test",
    "description":"Using the nft.storage metadata API to create ERC-1155 compatible metadata.",
    "image":"ipfs://bafybeicsu73gednfaa5svozuoac4ebpi76nn4auhygcvkvbn4kk2vdv5ey/hokusai.png"
}

Using Hokusai

Congratulations! You're ready to use Hokusai. Check out Hokusai Document for the full documentation. Now, let's try minting and getting an NFT. If you using the Mumbai testnet, change the baseUrl of src/getNft.ts and src/mintNft.ts's to "https://mumbai.hokusai.app".

Mint an NFT

To mint an NFT, run the code below

yarn mint-nft {to} {tokenUri}
{
  txHash: '0x8765feaa11a7e0f9f4a84f21415434d80dd9be27728a8f6eff4d402e4d0c2766' # example Transaction Hash
}

You may refer to our documentation here for parameter descriptions.

Get an NFT

tokenId issued by Hokusai can be viewed via polygonscan. You can search by txHash received from minting.

yarn get-nft {tokenId}
{ id: {tokenId}, tokenUri: 'https://example.com/1' } # example response

Transfer an NFT

To transfer an NFT, you need to perform 2 steps:

  1. Fill in the private key of your wallet in .env file (Get the private key)
  2. Run the code below
yarn transfer-nft {to} {tokenId}
{
  txHash: '0xdec77ee7148dc796dd08d656a256e1466daf2763c08cfe104f76e8baf318f3ed' # example Transaction Hash
}

Burn an NFT

To Burn an NFT, you need to perform 2 steps:

  1. Fill in the private key of your wallet in .env file (Get the private key)
  2. Run the code below
yarn burn-nft {tokenId}
{
  txHash: '0x67eca6ca63d542f4b01fd60d53feda89ce64f42394c27b77fa3fccbb15244d3c' # example Transaction Hash
}

⚠️ The private key is very sensitive information. You should make sure no one else sees.

So far, you have minted an NFT, got NFT info and transfered an NFT via Hokusai. See what else you can do with our API on Hokusai Document 🥳

Hokusai Links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published