Fun with ERC721 on StarkNet
Henri Lieutaud / Developer advocate
January 2022
1
@henrilieutaud | @starkwareltd
Availability rollups primer
Slow, inclusive
Fast, exclusive
Current State of Affairs
Trust Big Computer Verify (all transactions), don’t trust
Increase Scale (gas/block limit) Fraud Proof Rollups (Arbitrum, Optimism)
Fast, exclusive
Trust Big Computer Trust a few Big Computers
Fast, semi inclusive
Validity Proofs (StarkNet, zkSync)
Big computer to generate proof
Expensive, semi inclusive (~mining) Fast, inclusive
Small computer to verify proof
ZK-STARK
proof
*With respect to size of computation
Privacy (Zero Knowledge, ZK)
Prover’s private inputs are shielded
Scalability
Exponentially small verifier running time*
Nearly linear prover running time*
Prover verifier
v
π
ZK-STARK Proofs
Verify (all transactions), don’t trust
*With respect to size of computation
Privacy (Zero Knowledge, ZK)
Prover’s private inputs are shielded
Scalability
Exponentially small verifier running time*
Nearly linear prover running time*
Prover
Verify STARK proof, don’t trust
π, Statenew
ZK-STARK
v
v
v
v
v
v
π, Statenew
π, Statenew
π, Statenew
π, Statenew
π, Statenew
π, Statenew
ZK-STARK Proofs
Two L2 Offerings
Largest L2 by TPS
(¼ Ethereum’s, on the rise)
8
@henrilieutaud | @starkwareltd
$270B 65M $1.25B
9
Launched - June 2020
10M
NFTs Minted
Tx Settled
600K
NFT Mints/Proof
Total Value Locked
Cumulative Trading
486
Gas/tx
As of December 9, 2021
@henrilieutaud | @starkwareltd
Launched November 29, since then:
● StarkNet Developer Discord exploding:
○ 20K users, 3K joined last week
○ 2K weekly active users
10
@henrilieutaud | @starkwareltd
● 20+ teams building dApps, including:
○ 3 AMMs
○ Games, NFT projects
○ Voting, bridges, and more
Ethereum-style permissionless interaction with the network
Developing on StarkNet
Cairo
13
● Specially designed, provable language, dedicated for Smart Contracts
● Cairo is not bounded by the EVM
@henrilieutaud | @starkwareltd
Syntax tutorial on GitHub
➔ Coming soon: Solidity -> Cairo transpiler
Standard implementations
15
@henrilieutaud | @starkwareltd
● Open Zeppelin - developing a set of boiler plate smart contracts for Cairo
○ Today - use an implementation included in therepo (courtesy of Oasis)
● Cairo standards reuse Solidity standards - naming convention for external functions
Boiler plate smart contracts are great or StarkNet onboarding!
Importing functions
17
@henrilieutaud | @starkwareltd
● The importing pattern is not enforced by the compiler, and is being discussed by the community
○ Base contracts define core functions. They have no external functions and no constructor
○ Front end contracts import internal functions from base contracts, and wrap them in
external functions
Impot Functions Inherit Functions
Account abstraction
19
@henrilieutaud | @starkwareltd
● Transactions on StarkNet are different than Ethereum - they do not have an originator (“From”)
● They are sent to an “entry point” - an “account smart contract” in charge of:
○ Authenticating the user
○ Replay protection
○ Funds protection
○ Allows many different UX to be built upon
● This is not currently enforced
○ transactions can be sent to any contract, while the sender is seen as 0 by the receiver
Integrated Development Environments
21
3 main tools to interact with StarkNet:
@henrilieutaud | @starkwareltd
*All three are under development and require duct tape here and there
Today’s tutorial is based on Nile
HardHat
(Javascript)
StarkNet
CLI
Nile
(Python)
briq
The NFT building protocol
this but
literally
use use your NFTs in a growing metaverse
build
continue to create by disassembling NFTs back into briqs
your own NFTs with briqs
- Online briq builder available
- ERC721 briq & set contracts
deployed on StarkNet mainnet &
testnet
- +1k NFT creations, 2.5K followers
briq alpha
first NFT project deployed
on StarkNet mainnet
- Difficult language but generally
good feedback from the compiler
- Math-heavy logic is particularly
tricky because of field
- Ecosystem is growing nicely
- Devnet wallet, Nile, …
- Lots of public interest
Feedback
first NFT project deployed
on StarkNet mainnet
Github: github/briqNFT
Twitter: @briqNFT
Sylve: @sylvechv
Lancelot: @wraitii
Getting to work
ERC721 Workshop
30
Your objective - gather points.
Follow these steps to collect all points
1. Read the ReadMe for a high level understanding
2. Read the valuator.cairo code for a low level understanding
3. Use the ERC721 code and customize it
4. Deploy your contract
5. Submit your contract address to the evaluator
6. Ask the evaluator to correct your contract
7. Check for points
@henrilieutaud | @starkwareltd
Go to Github:
Thanks!
January 2022
31
@henrilieutaud | @starkwareltd
Henri Lieutaud / Developer Advocate
To go further
32
Jobs
- Dapp Developer at Shard labs.
- Open source developer at Open Zeppelin.
- Cairo engineers at Immutable.
- Chainlink integration team.
- Blockchain software engineer at JellyFi.
Resources on StarkNet
- Official Cairo documentation
- Community links - list of examples
curated by the StarkWare team
- Awesome StarkNet - a curated list of
resources by Georgios Konstantopoulos
Cool stuff built on StarkNet
- Physics simulation by @guiltygyoza
- briq V1 contracts
- Qasr, an ETH <> StarkNet NFT bridge
- Tictactoe by @guiltygyoza
@henrilieutaud | @starkwareltd

StarkNet ERC20 + ERC721

  • 1.
    Fun with ERC721on StarkNet Henri Lieutaud / Developer advocate January 2022 1 @henrilieutaud | @starkwareltd
  • 2.
  • 3.
    Slow, inclusive Fast, exclusive CurrentState of Affairs Trust Big Computer Verify (all transactions), don’t trust
  • 4.
    Increase Scale (gas/blocklimit) Fraud Proof Rollups (Arbitrum, Optimism) Fast, exclusive Trust Big Computer Trust a few Big Computers Fast, semi inclusive
  • 5.
    Validity Proofs (StarkNet,zkSync) Big computer to generate proof Expensive, semi inclusive (~mining) Fast, inclusive Small computer to verify proof ZK-STARK proof
  • 6.
    *With respect tosize of computation Privacy (Zero Knowledge, ZK) Prover’s private inputs are shielded Scalability Exponentially small verifier running time* Nearly linear prover running time* Prover verifier v π ZK-STARK Proofs Verify (all transactions), don’t trust
  • 7.
    *With respect tosize of computation Privacy (Zero Knowledge, ZK) Prover’s private inputs are shielded Scalability Exponentially small verifier running time* Nearly linear prover running time* Prover Verify STARK proof, don’t trust π, Statenew ZK-STARK v v v v v v π, Statenew π, Statenew π, Statenew π, Statenew π, Statenew π, Statenew ZK-STARK Proofs
  • 8.
    Two L2 Offerings LargestL2 by TPS (¼ Ethereum’s, on the rise) 8 @henrilieutaud | @starkwareltd
  • 9.
    $270B 65M $1.25B 9 Launched- June 2020 10M NFTs Minted Tx Settled 600K NFT Mints/Proof Total Value Locked Cumulative Trading 486 Gas/tx As of December 9, 2021 @henrilieutaud | @starkwareltd
  • 10.
    Launched November 29,since then: ● StarkNet Developer Discord exploding: ○ 20K users, 3K joined last week ○ 2K weekly active users 10 @henrilieutaud | @starkwareltd ● 20+ teams building dApps, including: ○ 3 AMMs ○ Games, NFT projects ○ Voting, bridges, and more Ethereum-style permissionless interaction with the network
  • 11.
  • 12.
    Cairo 13 ● Specially designed,provable language, dedicated for Smart Contracts ● Cairo is not bounded by the EVM @henrilieutaud | @starkwareltd Syntax tutorial on GitHub ➔ Coming soon: Solidity -> Cairo transpiler
  • 13.
    Standard implementations 15 @henrilieutaud |@starkwareltd ● Open Zeppelin - developing a set of boiler plate smart contracts for Cairo ○ Today - use an implementation included in therepo (courtesy of Oasis) ● Cairo standards reuse Solidity standards - naming convention for external functions Boiler plate smart contracts are great or StarkNet onboarding!
  • 14.
    Importing functions 17 @henrilieutaud |@starkwareltd ● The importing pattern is not enforced by the compiler, and is being discussed by the community ○ Base contracts define core functions. They have no external functions and no constructor ○ Front end contracts import internal functions from base contracts, and wrap them in external functions Impot Functions Inherit Functions
  • 15.
    Account abstraction 19 @henrilieutaud |@starkwareltd ● Transactions on StarkNet are different than Ethereum - they do not have an originator (“From”) ● They are sent to an “entry point” - an “account smart contract” in charge of: ○ Authenticating the user ○ Replay protection ○ Funds protection ○ Allows many different UX to be built upon ● This is not currently enforced ○ transactions can be sent to any contract, while the sender is seen as 0 by the receiver
  • 16.
    Integrated Development Environments 21 3main tools to interact with StarkNet: @henrilieutaud | @starkwareltd *All three are under development and require duct tape here and there Today’s tutorial is based on Nile HardHat (Javascript) StarkNet CLI Nile (Python)
  • 17.
  • 18.
  • 19.
    use use yourNFTs in a growing metaverse build continue to create by disassembling NFTs back into briqs your own NFTs with briqs
  • 21.
    - Online briqbuilder available - ERC721 briq & set contracts deployed on StarkNet mainnet & testnet - +1k NFT creations, 2.5K followers briq alpha first NFT project deployed on StarkNet mainnet
  • 22.
    - Difficult languagebut generally good feedback from the compiler - Math-heavy logic is particularly tricky because of field - Ecosystem is growing nicely - Devnet wallet, Nile, … - Lots of public interest Feedback first NFT project deployed on StarkNet mainnet
  • 23.
  • 24.
  • 25.
    ERC721 Workshop 30 Your objective- gather points. Follow these steps to collect all points 1. Read the ReadMe for a high level understanding 2. Read the valuator.cairo code for a low level understanding 3. Use the ERC721 code and customize it 4. Deploy your contract 5. Submit your contract address to the evaluator 6. Ask the evaluator to correct your contract 7. Check for points @henrilieutaud | @starkwareltd Go to Github:
  • 26.
    Thanks! January 2022 31 @henrilieutaud |@starkwareltd Henri Lieutaud / Developer Advocate
  • 27.
    To go further 32 Jobs -Dapp Developer at Shard labs. - Open source developer at Open Zeppelin. - Cairo engineers at Immutable. - Chainlink integration team. - Blockchain software engineer at JellyFi. Resources on StarkNet - Official Cairo documentation - Community links - list of examples curated by the StarkWare team - Awesome StarkNet - a curated list of resources by Georgios Konstantopoulos Cool stuff built on StarkNet - Physics simulation by @guiltygyoza - briq V1 contracts - Qasr, an ETH <> StarkNet NFT bridge - Tictactoe by @guiltygyoza @henrilieutaud | @starkwareltd