A basic Ethereum smart contract that functions as a secure personal wallet. Written in Solidity, it allows anyone to deposit ETH, while only the owner (deployer) can withdraw funds. It includes key smart contract concepts like access control, event logging, and fallback functions.
- ✅ Accept ETH deposits via function calls or direct transfers
- 🔒 Owner-only withdrawals
- 🔎 Check wallet balance anytime
- 📩 Receive and fallback functions for handling ETH transfers
- 🧠 Core Solidity concepts:
payable
,receive
,fallback
,require
, modifiers - 📜 Events for transparent logging of deposits and withdrawals
- Solidity
^0.8.20
- Ethereum Virtual Machine (EVM)
- Remix IDE for testing and deployment
- MetaMask and Goerli/Sepolia Testnet
Sets the contract deployer as the owner.
Allows any user to send ETH to the contract.
Allows only the owner to withdraw a specified amount.
Returns the current ETH balance in the contract.
Handles direct ETH transfers without data.
Handles ETH transfers with unknown function calls.
- Only the owner can withdraw funds.
- Withdrawals fail if the balance is insufficient.
- Emits logs for all ETH-related actions.
- Open Remix IDE
- Paste the code into a new file (
SimpleWallet.sol
) - Compile with
Solidity ^0.8.20
- Deploy using "Injected Web3" (e.g., MetaMask with Goerli or Sepolia)
- Interact with functions like
deposit()
,withdraw()
, andgetBalance()
MIT License
Muhammed Hilmi KT
Web3 Enthusiast | Solidity Developer
Connect with me on LinkedIn