SlideShare a Scribd company logo
How to build a
dApp in Starknet
Vishnu C
Before we start
ZKX is a permissionless protocol for derivatives
built on StarkNet, with a decentralised order
book and a unique way to offer complex financial
instruments as swaps.
Trustless, Permissionless, and Borderless.
Ethereum and Layer 2
Smart contract
A "smart contract" is simply a program that
runs on the blockchain. It's a collection of code
(its functions) and data (its state) that resides at
a specific address on the blockchain.
What is layer 2?
A layer 2 is a separate blockchain that extends
Ethereum and inherits the security guarantees
of Ethereum.
Why do we need layer 2?
StarkNet and Cairo
StarkNet
A permissionless decentralised ZK-Rollup. It
operates as an L2 network over Ethereum
enabling massive scalability without
compromising Ethereum’s composability and
security.
Cairo
The learning curve - quirks of Cairo
Recursion instead of iteration
Everything should be in felt data type
No concept of arrays - use mappings instead
Debugging cairo smart contracts can get quite
complicated
The learning curve - quirks of Cairo
Absence of boolean expressions
Solidity: if (x == 2 && y == 2) { … }
In Cairo, this is not possible!
But there are workarounds like the following:
assert (x - 1) * (y - 1) = 0 can be used for assert x || y
assert x * y = 0 can be used for assert !x || !y
assert x + y = 2 can be used for assert x && y
Starknet and Cairo are amazing!
The community
The amount of documentation and tutorials
Great frameworks for development
Workshops and hackathons
Cairo just keeps getting better!
No need to mention again, but transactions are cheap!
A basic dApp
Stake L1 contract
function stake() - payable
function withdraw(uint256 amount)
Stake L2 contract
func deposit(from_address, user_l1_address, amount) - l1
handler
func withdraw(user_l1_address, amount)
func take_fee(user_l1_address)
func get_balance(user_l1_address) - view function
L1 <—> L2 Communication
One important property of a good L2 system is the ability to
interact with the L1 system it’s built on.
Every StarkNet contract may send and receive messages
to/from any L1 contract.
L1 -> L2 messaging
L1 contract can initiate a message to L2 by calling
sendMessageToL2 function on the StarkNet core
contract.
The arguments for this function are:
toAddress
selector
payload
This invokes function annotated with l1_handler
decorator on the target contract.
L2 -> L1 messaging
L2 contract can send a message to L1 by calling
send_message_to_l1 syscall.
The arguments for this function are:
to_address
payload_size
payload
After the state update that included this transaction is
proved and L1 state is updated, hash of this message is
stored on StarkNet core contract.
L2 -> L1 messaging
Recipient address on L1 can consume this message by
providing the message parameters by calling
consumeMessageFromL2 function on the StarkNet core
contract.
Arguments needed are:
fromAddress
payload
Contracts and Functions
L1
L1
L2
L2
L2
L1
Compile and Deploy
StarkNet
Ethereum
References
Stake dApp Github -
https://github.com/StarkCon/workshop01
StarkNet documentation - https://cairo-
lang.org/docs/hello_starknet/index.html
L1 <-> L2 communication - https://cairo-
lang.org/docs/hello_starknet/l1l2.html
Thank
you!
Twitter: @zkxprotocol
Website: zkx.fi

More Related Content

What's hot

Blockchain Security and Privacy
Blockchain Security and PrivacyBlockchain Security and Privacy
Blockchain Security and Privacy
Anil John
 
Blockchain, cryptography, and consensus
Blockchain, cryptography, and consensusBlockchain, cryptography, and consensus
Blockchain, cryptography, and consensus
ITU
 
Blockchain Security
Blockchain SecurityBlockchain Security
Blockchain Security
Munawar Hussain
 
Blockchain
BlockchainBlockchain
Blockchain
Mohit Singh
 
What is NFT (Non-fungible token) & How do they work?
What is NFT (Non-fungible token) & How do they work?What is NFT (Non-fungible token) & How do they work?
What is NFT (Non-fungible token) & How do they work?
Finlaw Consultancy Pvt Ltd
 
Basic introduction in blockchain, smart contracts, permissioned ledgers
Basic introduction in blockchain, smart contracts, permissioned ledgersBasic introduction in blockchain, smart contracts, permissioned ledgers
Basic introduction in blockchain, smart contracts, permissioned ledgers
Koen Vingerhoets
 
20180711 Metamask
20180711 Metamask 20180711 Metamask
20180711 Metamask
Hu Kenneth
 
Blockchain and Bitcoin
Blockchain and BitcoinBlockchain and Bitcoin
Blockchain and Bitcoin
Hugo Rodrigues
 
Non-fungible tokens (nfts)
Non-fungible tokens (nfts)Non-fungible tokens (nfts)
Non-fungible tokens (nfts)
Gene Leybzon
 
Blockchain 101
Blockchain 101Blockchain 101
Blockchain 101
Jithin Babu
 
Blockchain
BlockchainBlockchain
Blockchain
Sai Nath
 
List of 10 Most Expensive NFTs Ever Sold
List of 10 Most Expensive NFTs Ever SoldList of 10 Most Expensive NFTs Ever Sold
List of 10 Most Expensive NFTs Ever Sold
101 Blockchains
 
Blockchain Presentation
Blockchain PresentationBlockchain Presentation
Blockchain Presentation
Zied GUESMI
 
Blockchain solution architecture deliverable
Blockchain solution architecture deliverableBlockchain solution architecture deliverable
Blockchain solution architecture deliverable
Sarmad Ibrahim
 
What is Erc20 token? How it Works/
What is Erc20 token? How it Works/What is Erc20 token? How it Works/
What is Erc20 token? How it Works/
Developcoins
 
Basics of Blockchain Technology
Basics of Blockchain TechnologyBasics of Blockchain Technology
Basics of Blockchain Technology
Nasir Bhutta
 
Smart contracts
Smart contractsSmart contracts
Smart contracts
Philippe Camacho, Ph.D.
 
Bitcoin, Ethereum, Smart Contract & Blockchain
Bitcoin, Ethereum, Smart Contract & BlockchainBitcoin, Ethereum, Smart Contract & Blockchain
Bitcoin, Ethereum, Smart Contract & Blockchain
Jitendra Chittoda
 
How does blockchain work
How does blockchain workHow does blockchain work
How does blockchain work
Shishir Aryal
 
異種ブロックチェーン統合ツールHyperledger Cactiご紹介
異種ブロックチェーン統合ツールHyperledger Cactiご紹介異種ブロックチェーン統合ツールHyperledger Cactiご紹介
異種ブロックチェーン統合ツールHyperledger Cactiご紹介
Hyperleger Tokyo Meetup
 

What's hot (20)

Blockchain Security and Privacy
Blockchain Security and PrivacyBlockchain Security and Privacy
Blockchain Security and Privacy
 
Blockchain, cryptography, and consensus
Blockchain, cryptography, and consensusBlockchain, cryptography, and consensus
Blockchain, cryptography, and consensus
 
Blockchain Security
Blockchain SecurityBlockchain Security
Blockchain Security
 
Blockchain
BlockchainBlockchain
Blockchain
 
What is NFT (Non-fungible token) & How do they work?
What is NFT (Non-fungible token) & How do they work?What is NFT (Non-fungible token) & How do they work?
What is NFT (Non-fungible token) & How do they work?
 
Basic introduction in blockchain, smart contracts, permissioned ledgers
Basic introduction in blockchain, smart contracts, permissioned ledgersBasic introduction in blockchain, smart contracts, permissioned ledgers
Basic introduction in blockchain, smart contracts, permissioned ledgers
 
20180711 Metamask
20180711 Metamask 20180711 Metamask
20180711 Metamask
 
Blockchain and Bitcoin
Blockchain and BitcoinBlockchain and Bitcoin
Blockchain and Bitcoin
 
Non-fungible tokens (nfts)
Non-fungible tokens (nfts)Non-fungible tokens (nfts)
Non-fungible tokens (nfts)
 
Blockchain 101
Blockchain 101Blockchain 101
Blockchain 101
 
Blockchain
BlockchainBlockchain
Blockchain
 
List of 10 Most Expensive NFTs Ever Sold
List of 10 Most Expensive NFTs Ever SoldList of 10 Most Expensive NFTs Ever Sold
List of 10 Most Expensive NFTs Ever Sold
 
Blockchain Presentation
Blockchain PresentationBlockchain Presentation
Blockchain Presentation
 
Blockchain solution architecture deliverable
Blockchain solution architecture deliverableBlockchain solution architecture deliverable
Blockchain solution architecture deliverable
 
What is Erc20 token? How it Works/
What is Erc20 token? How it Works/What is Erc20 token? How it Works/
What is Erc20 token? How it Works/
 
Basics of Blockchain Technology
Basics of Blockchain TechnologyBasics of Blockchain Technology
Basics of Blockchain Technology
 
Smart contracts
Smart contractsSmart contracts
Smart contracts
 
Bitcoin, Ethereum, Smart Contract & Blockchain
Bitcoin, Ethereum, Smart Contract & BlockchainBitcoin, Ethereum, Smart Contract & Blockchain
Bitcoin, Ethereum, Smart Contract & Blockchain
 
How does blockchain work
How does blockchain workHow does blockchain work
How does blockchain work
 
異種ブロックチェーン統合ツールHyperledger Cactiご紹介
異種ブロックチェーン統合ツールHyperledger Cactiご紹介異種ブロックチェーン統合ツールHyperledger Cactiご紹介
異種ブロックチェーン統合ツールHyperledger Cactiご紹介
 

Similar to How to build a dApp in StarkNet

Layer-2 after “The Merge”
Layer-2 after “The Merge”Layer-2 after “The Merge”
Layer-2 after “The Merge”
Jiyun Kim
 
Cryptographic Agility in Corda
Cryptographic Agility in CordaCryptographic Agility in Corda
Cryptographic Agility in Corda
Guy Hochstetler
 
Ethereum vs fabric vs corda
Ethereum vs fabric vs cordaEthereum vs fabric vs corda
Ethereum vs fabric vs corda
Jean-Christophe Busnel
 
Hyperledger
HyperledgerHyperledger
Hyperledger
Vinay Aitha
 
EthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxEthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptx
WijdenBenothmen1
 
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Simone Onofri
 
How to design, code, deploy and execute a smart contract
How to design, code, deploy and execute a smart contractHow to design, code, deploy and execute a smart contract
How to design, code, deploy and execute a smart contract
Joseph Holbrook, Chief Learning Officer (CLO)
 
All About Ethereum
All About EthereumAll About Ethereum
All About Ethereum
Oodles Technologies Pvt. Ltd.
 
Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)
Tomoaki Sato
 
Ethereum
EthereumEthereum
Ethereum
Brian Yap
 
Ethereum Blockchain and DApps - Workshop at Software University
Ethereum Blockchain and DApps  - Workshop at Software UniversityEthereum Blockchain and DApps  - Workshop at Software University
Ethereum Blockchain and DApps - Workshop at Software University
Open Source University
 
以太坊代幣付款委託 @ Open Source Developer Meetup #12
以太坊代幣付款委託 @ Open Source Developer Meetup #12以太坊代幣付款委託 @ Open Source Developer Meetup #12
以太坊代幣付款委託 @ Open Source Developer Meetup #12
Aludirk Wong
 
Algorand Smart Contracts
Algorand Smart ContractsAlgorand Smart Contracts
Algorand Smart Contracts
ssusercc3bf81
 
DockerCon EU 2015: The Missing Piece: when Docker networking unleashing soft ...
DockerCon EU 2015: The Missing Piece: when Docker networking unleashing soft ...DockerCon EU 2015: The Missing Piece: when Docker networking unleashing soft ...
DockerCon EU 2015: The Missing Piece: when Docker networking unleashing soft ...
Docker, Inc.
 
آموزش پرایس اکشن (price action)
آموزش پرایس اکشن (price action)آموزش پرایس اکشن (price action)
آموزش پرایس اکشن (price action)
price act
 
UNIT V - The OMG way-system object model Notes.ppt
UNIT V - The OMG way-system object model Notes.pptUNIT V - The OMG way-system object model Notes.ppt
UNIT V - The OMG way-system object model Notes.ppt
AsmitSilhare1
 
IRJET- Proof of Document using Multichain and Ethereum
IRJET- Proof of Document using Multichain and EthereumIRJET- Proof of Document using Multichain and Ethereum
IRJET- Proof of Document using Multichain and Ethereum
IRJET Journal
 
Ethereum-Cryptocurrency (All about Ethereum)
Ethereum-Cryptocurrency (All about Ethereum) Ethereum-Cryptocurrency (All about Ethereum)
Ethereum-Cryptocurrency (All about Ethereum)
عطاءالمنعم اثیل شیخ
 
Lilypad @ Labweek, Istanbul, 2023.pdf
Lilypad @ Labweek, Istanbul, 2023.pdfLilypad @ Labweek, Istanbul, 2023.pdf
Lilypad @ Labweek, Istanbul, 2023.pdf
Ally339821
 
NFT Layer 2 Development
NFT Layer 2 DevelopmentNFT Layer 2 Development
NFT Layer 2 Development
Mobiloitte Technologies
 

Similar to How to build a dApp in StarkNet (20)

Layer-2 after “The Merge”
Layer-2 after “The Merge”Layer-2 after “The Merge”
Layer-2 after “The Merge”
 
Cryptographic Agility in Corda
Cryptographic Agility in CordaCryptographic Agility in Corda
Cryptographic Agility in Corda
 
Ethereum vs fabric vs corda
Ethereum vs fabric vs cordaEthereum vs fabric vs corda
Ethereum vs fabric vs corda
 
Hyperledger
HyperledgerHyperledger
Hyperledger
 
EthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxEthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptx
 
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
 
How to design, code, deploy and execute a smart contract
How to design, code, deploy and execute a smart contractHow to design, code, deploy and execute a smart contract
How to design, code, deploy and execute a smart contract
 
All About Ethereum
All About EthereumAll About Ethereum
All About Ethereum
 
Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)
 
Ethereum
EthereumEthereum
Ethereum
 
Ethereum Blockchain and DApps - Workshop at Software University
Ethereum Blockchain and DApps  - Workshop at Software UniversityEthereum Blockchain and DApps  - Workshop at Software University
Ethereum Blockchain and DApps - Workshop at Software University
 
以太坊代幣付款委託 @ Open Source Developer Meetup #12
以太坊代幣付款委託 @ Open Source Developer Meetup #12以太坊代幣付款委託 @ Open Source Developer Meetup #12
以太坊代幣付款委託 @ Open Source Developer Meetup #12
 
Algorand Smart Contracts
Algorand Smart ContractsAlgorand Smart Contracts
Algorand Smart Contracts
 
DockerCon EU 2015: The Missing Piece: when Docker networking unleashing soft ...
DockerCon EU 2015: The Missing Piece: when Docker networking unleashing soft ...DockerCon EU 2015: The Missing Piece: when Docker networking unleashing soft ...
DockerCon EU 2015: The Missing Piece: when Docker networking unleashing soft ...
 
آموزش پرایس اکشن (price action)
آموزش پرایس اکشن (price action)آموزش پرایس اکشن (price action)
آموزش پرایس اکشن (price action)
 
UNIT V - The OMG way-system object model Notes.ppt
UNIT V - The OMG way-system object model Notes.pptUNIT V - The OMG way-system object model Notes.ppt
UNIT V - The OMG way-system object model Notes.ppt
 
IRJET- Proof of Document using Multichain and Ethereum
IRJET- Proof of Document using Multichain and EthereumIRJET- Proof of Document using Multichain and Ethereum
IRJET- Proof of Document using Multichain and Ethereum
 
Ethereum-Cryptocurrency (All about Ethereum)
Ethereum-Cryptocurrency (All about Ethereum) Ethereum-Cryptocurrency (All about Ethereum)
Ethereum-Cryptocurrency (All about Ethereum)
 
Lilypad @ Labweek, Istanbul, 2023.pdf
Lilypad @ Labweek, Istanbul, 2023.pdfLilypad @ Labweek, Istanbul, 2023.pdf
Lilypad @ Labweek, Istanbul, 2023.pdf
 
NFT Layer 2 Development
NFT Layer 2 DevelopmentNFT Layer 2 Development
NFT Layer 2 Development
 

More from TinaBregovi

Building LSD Use Cases on Bifrost
Building LSD Use Cases on BifrostBuilding LSD Use Cases on Bifrost
Building LSD Use Cases on Bifrost
TinaBregovi
 
Urbit Launch Event
Urbit Launch EventUrbit Launch Event
Urbit Launch Event
TinaBregovi
 
Layer Hack: Boba Network: Understanding Hybrid Compute
Layer Hack: Boba Network: Understanding Hybrid ComputeLayer Hack: Boba Network: Understanding Hybrid Compute
Layer Hack: Boba Network: Understanding Hybrid Compute
TinaBregovi
 
Layer Hack: zkSync - Intro to zkEVM
Layer Hack: zkSync - Intro to zkEVMLayer Hack: zkSync - Intro to zkEVM
Layer Hack: zkSync - Intro to zkEVM
TinaBregovi
 
Rollup-as-a-service and why it matters to the next-gen of dApps
Rollup-as-a-service and why it matters to the next-gen of dAppsRollup-as-a-service and why it matters to the next-gen of dApps
Rollup-as-a-service and why it matters to the next-gen of dApps
TinaBregovi
 
Layer Hack: AltLayer Workshop
Layer Hack: AltLayer WorkshopLayer Hack: AltLayer Workshop
Layer Hack: AltLayer Workshop
TinaBregovi
 
Layer Hack Launch Event
Layer Hack Launch EventLayer Hack Launch Event
Layer Hack Launch Event
TinaBregovi
 
Bridging with StarkNet
Bridging with StarkNetBridging with StarkNet
Bridging with StarkNet
TinaBregovi
 
How To Build Better NFTs with Briq
How To Build Better NFTs with BriqHow To Build Better NFTs with Briq
How To Build Better NFTs with Briq
TinaBregovi
 
NFTs on StarkNet
NFTs on StarkNetNFTs on StarkNet
NFTs on StarkNet
TinaBregovi
 
Braavos Wallet Workshop.pdf
Braavos Wallet Workshop.pdfBraavos Wallet Workshop.pdf
Braavos Wallet Workshop.pdf
TinaBregovi
 
StarkNet Autumn Hackathon Launch Event.pptx
StarkNet Autumn Hackathon Launch Event.pptxStarkNet Autumn Hackathon Launch Event.pptx
StarkNet Autumn Hackathon Launch Event.pptx
TinaBregovi
 
Harmony Marketplace SDK.pptx
Harmony Marketplace SDK.pptxHarmony Marketplace SDK.pptx
Harmony Marketplace SDK.pptx
TinaBregovi
 
Coinbase Node
Coinbase NodeCoinbase Node
Coinbase Node
TinaBregovi
 
Get Ready for Coinbase Node
Get Ready for Coinbase NodeGet Ready for Coinbase Node
Get Ready for Coinbase Node
TinaBregovi
 
MANIFOLD MEV Bounty Competition
MANIFOLD MEV Bounty CompetitionMANIFOLD MEV Bounty Competition
MANIFOLD MEV Bounty Competition
TinaBregovi
 
Public SP Meeting
Public SP MeetingPublic SP Meeting
Public SP Meeting
TinaBregovi
 
Ecosystem WG
Ecosystem WGEcosystem WG
Ecosystem WG
TinaBregovi
 
Welcome to the Web 3.0
Welcome to the Web 3.0Welcome to the Web 3.0
Welcome to the Web 3.0
TinaBregovi
 
Introduction to IPFS & Filecoin - longer version
Introduction to IPFS & Filecoin - longer versionIntroduction to IPFS & Filecoin - longer version
Introduction to IPFS & Filecoin - longer version
TinaBregovi
 

More from TinaBregovi (20)

Building LSD Use Cases on Bifrost
Building LSD Use Cases on BifrostBuilding LSD Use Cases on Bifrost
Building LSD Use Cases on Bifrost
 
Urbit Launch Event
Urbit Launch EventUrbit Launch Event
Urbit Launch Event
 
Layer Hack: Boba Network: Understanding Hybrid Compute
Layer Hack: Boba Network: Understanding Hybrid ComputeLayer Hack: Boba Network: Understanding Hybrid Compute
Layer Hack: Boba Network: Understanding Hybrid Compute
 
Layer Hack: zkSync - Intro to zkEVM
Layer Hack: zkSync - Intro to zkEVMLayer Hack: zkSync - Intro to zkEVM
Layer Hack: zkSync - Intro to zkEVM
 
Rollup-as-a-service and why it matters to the next-gen of dApps
Rollup-as-a-service and why it matters to the next-gen of dAppsRollup-as-a-service and why it matters to the next-gen of dApps
Rollup-as-a-service and why it matters to the next-gen of dApps
 
Layer Hack: AltLayer Workshop
Layer Hack: AltLayer WorkshopLayer Hack: AltLayer Workshop
Layer Hack: AltLayer Workshop
 
Layer Hack Launch Event
Layer Hack Launch EventLayer Hack Launch Event
Layer Hack Launch Event
 
Bridging with StarkNet
Bridging with StarkNetBridging with StarkNet
Bridging with StarkNet
 
How To Build Better NFTs with Briq
How To Build Better NFTs with BriqHow To Build Better NFTs with Briq
How To Build Better NFTs with Briq
 
NFTs on StarkNet
NFTs on StarkNetNFTs on StarkNet
NFTs on StarkNet
 
Braavos Wallet Workshop.pdf
Braavos Wallet Workshop.pdfBraavos Wallet Workshop.pdf
Braavos Wallet Workshop.pdf
 
StarkNet Autumn Hackathon Launch Event.pptx
StarkNet Autumn Hackathon Launch Event.pptxStarkNet Autumn Hackathon Launch Event.pptx
StarkNet Autumn Hackathon Launch Event.pptx
 
Harmony Marketplace SDK.pptx
Harmony Marketplace SDK.pptxHarmony Marketplace SDK.pptx
Harmony Marketplace SDK.pptx
 
Coinbase Node
Coinbase NodeCoinbase Node
Coinbase Node
 
Get Ready for Coinbase Node
Get Ready for Coinbase NodeGet Ready for Coinbase Node
Get Ready for Coinbase Node
 
MANIFOLD MEV Bounty Competition
MANIFOLD MEV Bounty CompetitionMANIFOLD MEV Bounty Competition
MANIFOLD MEV Bounty Competition
 
Public SP Meeting
Public SP MeetingPublic SP Meeting
Public SP Meeting
 
Ecosystem WG
Ecosystem WGEcosystem WG
Ecosystem WG
 
Welcome to the Web 3.0
Welcome to the Web 3.0Welcome to the Web 3.0
Welcome to the Web 3.0
 
Introduction to IPFS & Filecoin - longer version
Introduction to IPFS & Filecoin - longer versionIntroduction to IPFS & Filecoin - longer version
Introduction to IPFS & Filecoin - longer version
 

Recently uploaded

Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 

Recently uploaded (20)

Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 

How to build a dApp in StarkNet

  • 1. How to build a dApp in Starknet Vishnu C
  • 3. ZKX is a permissionless protocol for derivatives built on StarkNet, with a decentralised order book and a unique way to offer complex financial instruments as swaps. Trustless, Permissionless, and Borderless.
  • 5. Smart contract A "smart contract" is simply a program that runs on the blockchain. It's a collection of code (its functions) and data (its state) that resides at a specific address on the blockchain.
  • 6. What is layer 2? A layer 2 is a separate blockchain that extends Ethereum and inherits the security guarantees of Ethereum.
  • 7. Why do we need layer 2?
  • 9. StarkNet A permissionless decentralised ZK-Rollup. It operates as an L2 network over Ethereum enabling massive scalability without compromising Ethereum’s composability and security.
  • 10. Cairo
  • 11. The learning curve - quirks of Cairo Recursion instead of iteration Everything should be in felt data type No concept of arrays - use mappings instead Debugging cairo smart contracts can get quite complicated
  • 12. The learning curve - quirks of Cairo Absence of boolean expressions Solidity: if (x == 2 && y == 2) { … } In Cairo, this is not possible! But there are workarounds like the following: assert (x - 1) * (y - 1) = 0 can be used for assert x || y assert x * y = 0 can be used for assert !x || !y assert x + y = 2 can be used for assert x && y
  • 13. Starknet and Cairo are amazing! The community The amount of documentation and tutorials Great frameworks for development Workshops and hackathons Cairo just keeps getting better! No need to mention again, but transactions are cheap!
  • 15.
  • 16.
  • 17. Stake L1 contract function stake() - payable function withdraw(uint256 amount)
  • 18. Stake L2 contract func deposit(from_address, user_l1_address, amount) - l1 handler func withdraw(user_l1_address, amount) func take_fee(user_l1_address) func get_balance(user_l1_address) - view function
  • 19. L1 <—> L2 Communication
  • 20. One important property of a good L2 system is the ability to interact with the L1 system it’s built on. Every StarkNet contract may send and receive messages to/from any L1 contract.
  • 21. L1 -> L2 messaging L1 contract can initiate a message to L2 by calling sendMessageToL2 function on the StarkNet core contract. The arguments for this function are: toAddress selector payload This invokes function annotated with l1_handler decorator on the target contract.
  • 22. L2 -> L1 messaging L2 contract can send a message to L1 by calling send_message_to_l1 syscall. The arguments for this function are: to_address payload_size payload After the state update that included this transaction is proved and L1 state is updated, hash of this message is stored on StarkNet core contract.
  • 23. L2 -> L1 messaging Recipient address on L1 can consume this message by providing the message parameters by calling consumeMessageFromL2 function on the StarkNet core contract. Arguments needed are: fromAddress payload
  • 25. L1
  • 26. L1
  • 27. L2
  • 28. L2
  • 29. L2
  • 30. L1
  • 33.
  • 35.
  • 36.
  • 37.
  • 38. References Stake dApp Github - https://github.com/StarkCon/workshop01 StarkNet documentation - https://cairo- lang.org/docs/hello_starknet/index.html L1 <-> L2 communication - https://cairo- lang.org/docs/hello_starknet/l1l2.html