I wrote this article on the Starknet Edu blog. You can find the article here.
Tag: cairo
Account Abstraction on Starknet, Part II
I wrote this article on the Starknet Edu blog. You can find the article here.
Account Abstraction on Starknet, Part I
I wrote this article on the Starknet Edu blog. You can find the article here.
The Improved Starknet Syntax (Repost)
I wrote this article on the Starknet Edu blog. You can find the article here.
Testing a Cairo 1 Smart Contract with Protostar (Repost)
I wrote this article on the Starknet Edu blog. You can find the article here.
Setting up a StarkNet Dev Environment with Docker (Repost)
I wrote this article on the Starknet Edu blog. You can find the article here.
Setting Up A StarkNet Dev Environment with Python (Repost)
I wrote this article on the Starknet Edu blog. You can find the article here.
Choosing a StarkNet Development Tool (Repost)
I wrote this article on the Starknet Edu blog. You can find the article here.
Updating Python on macOS
Today it was announced that StarkNet 0.10.0 was released to the Goerli testnet. This update means that there’s a new version of the cairo-lang python package (version 0.10.0) whose release notes mentions that it depends on python 3.9 instead of 3.7.
I haven’t used python in a long time as I have relied mostly on node (javascript) for backend development so I’ve found myself re-learning the basics of python. One of those basic skills that I have to familiarize myself with is how to properly update the python binary.
Continue reading “Updating Python on macOS”StarkNet ERC721 Workshop: Exercise 7
Note: This article was updated on Sep 20th, 2022 to use Cairo 0.10
Adding Metadata
- Create a new ERC721 contract that supports metadata. You can use this contract as a base
- The base token URI is the chosen IPFS gateway
- You can upload your NFTs directly on this website
- Your tokens should be visible on Oasis once minted!
- Deploy your new contract
- Call submit_exercise() in the Evaluator to configure the contract you want evaluated
- Claim points on ex7_add_metadata (2 pts)
StarkNet ERC721 Workshop: Exercise 6
Note: This article was updated on Sep 20th, 2022 to use Cairo 0.10
Claiming an NFT
- Mint a NFT with metadata on this dummy ERC721 token, usable here
- Check it on Oasis
- Claim points on ex6_claim_metadata_token (2 pts)
StarkNet ERC721 Workshop: Exercise 5
Note: This article was updated on Sep 20th, 2022 to use Cairo 0.10
Adding Permissions and Payments
- Use dummy token faucet to get dummy tokens
- Use ex5a_i_have_dtk() to show you managed to use the faucet (2 pts)
- Create a function to allow breeder registration.
- This function should charge the registrant for a fee, paid in dummy tokens (check registration_price)
- Add permissions. Only allow listed breeders should be able to create animals
- Deploy your new contract
- Call submit_exercise() in the Evaluator to configure the contract you want evaluated
- Call ex5b_register_breeder() to prove your function works. If needed, send dummy tokens first to the evaluator (2pts)
StarkNet ERC721 Workshop: Exercise 4
Note: This article was updated on Sep 20th, 2022 to use Cairo 0.10
Burning NFTs
- Create a function to allow breeders to declare dead animals (burn the NFT)
- Deploy your new contract
- Call submit_exercise() in the Evaluator to configure the contract you want evaluated
- Call ex4_declare_dead_animal() to get points (2 pts)
StarkNet ERC721 Workshop: Exercise 3
Note: This article was updated on Sep 20th, 2022 to use Cairo 0.10
Minting NFTs
- Create a function to allow breeders to mint new animals with the specified characteristics
- Deploy your new contract
- Call submit_exercise() in the Evaluator to configure the contract you want evaluated
- Call ex3_declare_new_animal() to get points (2 pts)
StarkNet ERC721 Workshop: Exercise 2
Note: This article was updated on Sep 20th, 2022 to use Cairo 0.10
Creating Token Attributes
- Call ex2a_get_animal_rank() to get assigned a random creature to create.
- Read the expected characteristics of your animal from the Evaluator
- Create the tools necessary to record animals characteristics in your contract and enable the evaluator contract to retrieve them trough get_animal_characteristics function on your contract (check this)
- Deploy your new contract
- Mint the animal with the desired characteristics and give it to the evaluator
- Call submit_exercise() in the Evaluator to configure the contract you want evaluated
- Call ex2b_test_declare_animal() to receive points (2 pts)
StarkNet ERC721 Workshop: Exercise 1
Note: This article was updated on Sep 20th, 2022 to use Cairo 0.10
Deploying an ERC721
- Create an ERC721 token contract. You can use this implementation as a base
- Deploy it to the testnet (check the constructor for the needed arguments. Also note that the arguments should be decimals.)
$ starknet-compile contracts/ERC721/ERC721.cairo --output artifacts/ERC721.json
$ starknet deploy --contract artifacts/ERC721.json --inputs arg1 arg2 arg3 --network alpha-goerli
- Give token #1 to Evaluator contract
- Call submit_exercise() in the Evaluator to configure the contract you want evaluated (4 pts)
- Call ex1_test_erc721() in the evaluator to receive your points (2 pts)
StarkNet ERC721 Workshop: Setup
Note: I wrote a better guide on how to setup a local development environment here. Use that guide instead of this one as I’ve updated all the articles on this series to use it.
In this tutorial we will be completing the ERC721 workshop created by the StarkWare team so developers can get familiarized with creating smart contracts with Cairo and deploying them to StarkNet’s test network, Goerli.
I’ll be breaking down the workshop into multiple articles to keep each post to a manageable size and to make it easy to find by search engines. Make sure to follow the link at the end of each article to go to the next section.
Continue reading “StarkNet ERC721 Workshop: Setup”Cairo’s Implicit Arguments Exercise
Write a function that returns the multiplication of the first two arguments if the third argument is an even number or performs an addition if odd.
Continue reading “Cairo’s Implicit Arguments Exercise”Cairo’s Array Creation Exercise
Create an array with the values 1, 2 and 3, and print the last value to the terminal.
Continue reading “Cairo’s Array Creation Exercise”Cairo’s Tail Recursion Exercise
Implement the function y = x^n.
Continue reading “Cairo’s Tail Recursion Exercise”