Fork & deploy your Smart Contract
Fork, deploy and customize your NFT contract
To deploy your Smart Contract, you will need to prepare 2 elements, the presale's unrevealed URI (the metadata of the NFT the buyers will get when buying during your presale) as well as the collection total supply. To generate the URI of your unrevealed NFT, please browse to Craft mint page and input the values of the unrevealed NFT. You'll only need to input the name, description, image, and attributes as other parameters are not supported. Then, click on "Create" and then you'll only need to complete the first step: "Upload file". Once your NFT has been uploaded to IPFS, you can copy the hash, this will be your "unrevealed URI".
Note: Please repeat the operation with the logo of your collection/company, it will be useful later. (Copy both hash starting with "Q" somewhere)
generate unrevelaed URI
If you're not comfortable with the command-line interface, we made an easy way to deploy your SCORE. Please note that you won't be able to access to the contract codebase and bring additional features with this option. This step will allow you to choose between two types of reveal. Option 1: Reveal on Mint (recommended for beginners) This option will allow your buyers to have their revealed or final NFT directly after minting and you won't have to handle the reveal phase yourself Option 2: Manual reveal (or static metadata)
This option will allow you to handle the reveal the NFTs yourself according to your own logic or is appropriate if your NFT won't have any reveal mechanic. You will have to specify the "Unrevealed URI" and the "Max supply" yourself
Please browse to Craft Network contract creation UI, you'll be able to input the unrevealed URI (as seen above) as well as your collection total size. Click on "deploy" and you're done! You can click on the explorer link to find your contract address and move on to the next step. Please note that this option will include an additional 1% fee on the presale volume!
To host your NFT collection, you will need a Smart Contract (reffered here as SCORE), you'll be able to fork (copy) from the official template and learn how to deploy it on Mainnet.
Step 1: Create/Sign in on Github
You'll need a Github Account to get the repository of the "Multitoken Presale Template", please create an account or sign in.
Step 2: Fork and clone the repository
Browse to the Multitoken Presale Template and click on the "Fork" button in the upper right corner of the screen. Then you'll need to confirm by clicking the "Create Fork" button. It will allow you to dupplicate the codebase under your Github profile.
You'll be redirected to your own fork of the repository, it should look like
Clone the repository on your computer, if you're not familiar with this process, click on "Code" and "Download Zip" and then unzip it on your computer or follow this guide.
That's it! You have now your own version of the smart contract ready to be deployed
Step 3: Install dependencies
This part will show you how to deploy your Smart Contract on ICON. It involves operation on the terminal, if you're seeking help, don't hesitate to ask some on the #🔨build-your-project channel of the Craft Discord server.
To deploy your Smart contract, you'll need to install JDK 11, here are the instructions:
Open a terminal and input the following:
Install brew (if it's not installed already)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install JDK and go
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk11
brew install go
Open a terminal and install the following:
sudo apt install openjdk-11-jdk
wget -c https://go.dev/dl/go1.16.15.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
Windows is currently not supported unless you use WSL and follow Linux instructions. Please join the Discord server if you have questions on Windows setup.
You need to checkout the "goloop" repository for building the
goloopCLI. Please change `/path/to/goloop` by the path of your cloned goloop folder
git clone https://github.com/icon-project/goloop.git
Then build the
GOBUILD_TAGS= make goloop
If the last installation output is successful you're good to go!
Step 4: Build and deploy the SCORE
This is the finale stage before your SCORE is live on the ICON blockchain, first you'll need to locate the folder of the "multitoken-presale" folder that you cloned/downloaded earlier. You'll need to open a new terminal and reach the folder. (You can input "cd " click and drag your folder on the terminal to go there)
cd <your folder>
./gradlew clean build optimizedJar
These commands will build your SCORE and create a folder to host your master_key. The master key is a keystore (json of an ICON wallet) that will be the creator and admin of the contract. You can't deploy from Ledger yet, to get your keystore, please head out to Hana/ICONex and click on the "export keystore" action of your wallet.
Then, you can download the file in the "res" folder we have just created. You can then rename the file to master.json. Please make sure that you have at least 50 ICX on the wallet to cover fees and future operations! And finally here is the command to deploy your contract:
goloop rpc sendtx deploy ./app/build/libs/app-0.1.0-optimized.jar/ \
--uri http://ctz.solidwallet.io/api/v3 \
--key_store ./res/master.json --key_password <password> \
--nid 1 --step_limit=3000000000 \
--content_type application/java \
--param TOBEREVEALED_URI=<URI> \