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)
Continue reading “StarkNet ERC721 Workshop: Exercise 7”

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)
Continue reading “StarkNet ERC721 Workshop: Exercise 5”

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)
Continue reading “StarkNet ERC721 Workshop: Exercise 4”

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)
Continue reading “StarkNet ERC721 Workshop: Exercise 3”

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)
Continue reading “StarkNet ERC721 Workshop: Exercise 2”

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)
Continue reading “StarkNet ERC721 Workshop: Exercise 1”

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”