NFT image and metadata are stored on-chain.
Symbol: GHOST
Name: GHOST ON-CHAIN
Contract address: 0xF8552a96100283BebD16B19F1b0F1cb1f18A11Ff
This is an experimental NFT. The first (demo) version was created in October 15, 2021
This is not the best way to create on-chain NFT image ;-)
Prepare a small image in png format (less than 10kb) or use the image from this repository.
Open Base64 png converter and upload the image. In the “Output Format” field choose Data URI--data:content/type;base64
. Encode it.
Copy Base64 output string and paste it to eg. notepad. Save it. You can paste the string to a web browser to see the image.
It should be something like this.
Open sample_metadata.json and paste the encoded output string to "image": "...",
It should be something like this
Open Base64 file converter, upload and encode the sample_metadata.json. In the “Output Format” field choose Plain text - just the Base 64 file
. Encode it.
It should be something like this. This is the token uri (token id 0) used in GHOST ON-CHAIN NFT.
You can try it on SmartBCH Amber testnet. Check here how to add SmartBCH testnet to MetaMask and add NFT.
Open GhostOnChain.sol in Remix - solidity. Change token name and symbol. Compile it and deploy.
In “Deploy & and run transactions” section use safeMint
function to mint NFT (paste your address in to
field and encoded string in uri
field). Use your sample_metadata.json base64 encoded string (or ghostmetadatabase64.json encoded string for a test) as uri. Click transact
. To check the uri go to tokenURI
function and type 0
. Call the function. You should see 0:
string: data:@file/json;base64,ew0KICAibmFtZSI6ICJHSE9TVCBPTi1DSEFJTiIsDQogICJkZXNjcmlwdGlvbiI6ICJHSE9TVCBvbi1jaGFpbiBORlQgYXJ0d29yayIsDQogICJleHRlcm5hbF91cmwiOiAiaHR0cHM6Ly9tYXpldG9rZW4uZ2l0aHViLmlvL2dob3N0IiwNCiAgImltYWdlIjogImRhdGE6aW1hZ2UvcG5nO2Jhc2U2NCxpVkJPUncwS0dnb0FBQUFOU1VoRVVnQUFBSUFBQUFDQUNBWUFBQUREUG1ITEFBQUFCbUpMUjBRQS93RC9BUCtndmFlVEFBQWZqVWxFUVZSNG5PMmRlWHhVVlpyM2Y4K3B1bFdwVktxeTczdEkyTU9pN0NKS2kwdHJLOXEyMkczYkN1Z2dUUktVUmZ0OXA1ZUpNNzNZU3FLe(...)
GHOST token id 0 transaction - blockchain transaction fee is about 0.01 BCH ;-). Token id 1, 2, … - transaction fee is about 0.0067 BCH
This is how it looks in MetaMask:
Here is another on-chain NFT example.
Have fun ;-)