Secret Network: Create an NFT on Secret Network with Data Stored on IPFS
Learn how to create a Secret Network NFT with assets stored on IPFS.
Last updated
Learn how to create a Secret Network NFT with assets stored on IPFS.
Last updated
Secret Network is a decentralized network built on top of the Cosmos SDK that enables private computation and confidential smart contracts. Secret Network allows developers to create applications with privacy-preserving features such as encrypted data storage, private transactions, and private smart contract execution. This opens up a range of use cases, including financial services, supply chain management, healthcare, and more, where privacy and security are paramount.
Read below to learn how to create a Secret Network NFT with assets stored on IPFS.
To do this, navigate to console.filebase.com. If you don’t have an account already, sign up, then log in.
Select ‘Create Bucket’ in the top right corner to create a new bucket for your NFTs.
Bucket names must be unique across all Filebase users, be between 3 and 63 characters long, and can contain only lowercase characters, numbers, and dashes.
Once uploaded, it will be listed in the bucket.
Choose the method you prefer, and take note of the IPFS CID for your image. We will reference this later.
private metadata.json
file and a public metadata.json
file. An example of each can be found below:Private Metadata:
Public Metadata:
Replace FILEBASE_IPFS_CID with the Filebase IPFS CID you took note of previously. Then save both of these as private-metadata.json
and public-metadata.json
respectively. Upload these files to Filebase in the same manner you used to upload the image file, then take note of each of their unique CID values.
git clone https://github.com/secretchaingirl/secret-contracts-guide.git
cd secret-contracts-guide
docker run -it --rm \\
-p 26657:26657 -p 26656:26656 -p 1317:1317 \\
--name secretdev enigmampc/secret-network-sw-dev:v1.0.2
docker exec -it secretdev /bin/bash
secretcli keys list --keyring-backend test
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup default stable
rustup target list --installed
rustup target add wasm32-unknown-unknown
rustup install nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
cargo generate --git https://github.com/enigmampc/secret-template --name nft-ipfs
src
folder, then open the contract.rs
file. Replace the existing contents with the following src
folder:git clone https://github.com/baedrik/snip721-reference-impl
mv snip721-reference-imp/src nft-ipfs/src
cd nft-ipfs
cargo wasm
execute_msg.json
file’s existing content with the following:Replace the following values to match your configuration:
Token_id: Optional unique ID for the token.
Owner: Your wallet address.
Public Metadata -> token_URI: Your Filebase IPFS link to the public metadata file.
Private Metadata -> token_URI: Your Filebase IPFS link to the private metadata file.
Royalties -> Recipient: Wallet address that will receive crypto royalties from this token.
This smart contract uses the SNIP-721 standard, which mints a single token and can only be used by an authorized minting address.
docker run --rm -v "$(pwd)":/contract \\
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \\
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \\
enigmampc/secret-contract-optimizer