β οΈ Important: Please complete Challenge #0 first if you haven't already, as it contains essential instructions related to dependencies needed for all upcoming challenges.
π« Create a simple NFT project:
π·ββοΈ In this project, you'll build and deploy smart contracts to create, manage, and interact with NFTs. Use a React-based frontend to enable users to mint NFTs, assign them to specific addresses, check token ownership, and burn tokens directly. π
π The final deliverable is an app that lets users interact with the NFT contract. Deploy your contracts to a testnet, then build and upload your app to a public web server.
Before you begin, you need to install the following tools:
- Node (>= v18.17)
- Yarn (v1 or v2+)
- Git
Then download the challenge to your computer and install dependencies by running:
β οΈ IMPORTANT: Please make sure to run the below commands through WSL only. In PowerShell, you'll get an error because some files are not supported on Windows.
git clone -b nft https://github.com/abhi152003/speedrun_stylus
cd speedrun_stylus
yarn installIn the same terminal, after all the dependencies have installed, run the below commands to start the local devnode in Docker. You'll need to spin up the Stylus nitro devnode by running the script through commands. This script will deploy the contract and generate the ABI so you can interact with the contracts written in RUST:
Contracts will be deployed through the cargo stylus command using the pre-funded account's private key so users can perform any transaction through the frontend while interacting with the contract.
cd speedrun_stylus # if not done
cd packages
cd cargo-stylus
cd nftNow open your Docker desktop and then return to your IDE and run the command below to spin up the nitro devnode in Docker. This will deploy the contract and generate the ABI so you can interact with the contracts written in RUST:
bash run-dev-node.shThis command will spin up the nitro devnode in Docker. You can check it out in your Docker desktop. This will take some time to deploy the RUST contract, and then the script will automatically generate the ABI. You can view all these transactions in your terminal and Docker desktop. The Docker node is running at localhost:8547.
β οΈ This guide provides step-by-step instructions to resolve the Command not found error caused by CRLF line endings in shell scripts when running in a WSL environment.
Shell scripts created in Windows often have CRLF line endings, which cause issues in Unix-like environments such as WSL. To fix this:
-
Install
dos2unix(if not already installed):sudo apt install dos2unix
-
Convert the script's line endings:
dos2unix run-dev-node.sh
-
Make the Script Executable:
chmod +x run-dev-node.sh
-
Run the Script in WSL
bash run-dev-node.sh
Then in a second WSL terminal window, you can run below commands to start your π± frontend:
cd speedrun_stylus ( if not done )
cd packages ( if not done )
cd nextjs
yarn run dev OR yarn devπ± Open http://localhost:3000 to see the app.
β½ You'll be redirected to the below page after you complete checkpoint 0
Then you have to click on the debug contracts to start interacting with your contract. Click on "Debug Contracts" from the Navbar or from the Debug Contracts Div placed in the middle of the screen
The interface allows you to:
- Mint NFT
- Mint to recipient address
- Check the Owner
- Burn token
- Track all transactions in the Block Explorer
Below are the examples of above all interactions that can be done with the NFT smart contract written in the RUST
After that, you can easily view all of your transactions from the Block Explorer Tab
πΌ Take a quick look at your deploy script run-dev-node.sh in speedrun_stylus/packages/cargo-stylus/nft/run-dev-node.sh.
π If you want to edit the frontend, navigate to speedrun_stylus/packages/nextjs/app and open the specific page you want to modify. For instance: /debug/page.tsx. For guidance on routing and configuring pages/layouts checkout the Next.js documentation.
π° You don't need to provide any specifications to deploy your contract because contracts are automatically deployed from the run-dev-node.sh
You can check that below :
The above command will automatically deploy the contract functions written inside speedrun_stylus/packages/cargo-stylus/nft/src/lib.rs
This local account will deploy your contracts, allowing you to avoid entering a personal private key because the deployment happens using the pre-funded account's private key.
We are deploying all the RUST contracts at the
localhost:8547endpoint where the nitro devnode is spinning up in Docker. You can check the network where your contract has been deployed in the frontend (http://localhost:3000):
π Deploy your NextJS App
vercelFollow the steps to deploy to Vercel. Once you log in (email, github, etc), the default options should work. It'll give you a public URL.
If you want to redeploy to the same production URL you can run
yarn vercel --prod. If you omit the--prodflag it will deploy it to a preview/test URL.
You can verify your smart contract by running:
cargo stylus verify -e http://127.0.0.1:8547 --deployment-tx "$deployment_tx"
# here deployment_tx can be received through the docker desktop's terminal when you have depoloyed your contract using the below command:
cargo stylus deploy -e http://127.0.0.1:8547 --private-key "$your_private_key"
# here you can use pre-funded account's private-key as wellIt is okay if it says your contract is already verified.
Explore more challenges or contribute to this project!
π Head to your next challenge here.







