Loading video player...
💡 Building the Light Switch Smart Contract on Monad | Solidity Tutorial + Deployment Script Explained In this episode, Knox from Pro Staking dives into the heart of Monad development — writing and deploying your first smart contract that actually stores and updates data on-chain. We’ll build the Light Switch contract in Solidity, define its core logic, and explore how users can pay 0.5 MON to toggle its state. This tutorial walks through both the smart contract file and the deployment script, explaining how data is stored, how payments are handled, and how ownership and withdrawals work — all on the Monad Testnet. 🧠 What You’ll Learn How to create a new Solidity smart contract (LightSwitch.sol) How to write a payable toggle function that flips state on the blockchain How to define events (SwitchToggled) and capture user actions How to set a toggle price (0.5 MON using ether keyword) How to assign ownership and withdraw funds from the contract How to write and use a deployment script (LightSwitch.s.sol) with Foundry 🪙 Smart Contract Flow Default state = OFF User pays 0.5 MON to toggle Contract updates the Boolean state Event logs new state + sender address Owner can withdraw accumulated funds 🧰 Tools & Resources Foundry (Forge) for compiling and deploying contracts Solidity 0.8+ for writing the LightSwitch logic Monad Testnet RPC for deployment Source code: GitHub → github.com/DataKnox/monad-light-switch 🔗 Connect with Knox Follow on X/Twitter → @Knox Validator Infrastructure → Pro Staking ⏱️ Timestamps 0:00 Intro – what a smart contract does 0:30 Setting up your LightSwitch Solidity file 1:20 Writing the smart contract logic (isOn, togglePrice) 3:00 Understanding payable functions & 0.5 MON cost 4:00 Handling events and sender addresses 5:00 Adding owner withdrawals 6:00 Deployment script overview (LightSwitch.s.sol) 7:00 Key outputs for connecting your front end #Monad #SmartContracts #Solidity #BlockchainDevelopment #Web3 #EVM #Foundry #DApp #ProStaking #Knox #MonadTestnet #CryptoDevelopment