Simple Smart Contract:
solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract MessageStore {
string public message;
constructor(string memory initMessage) {
message = initMessage;
}
function updateMessage(string memory newMessage) public {
message = newMessage;
}
}
Key Concepts:
State Variables: Store data permanently
Constructor: Runs once on deployment
Functions: Define contract behavior
Try it in Remix:
Go to Remix IDE
Create a new file and paste the contract code
Compile the contract
Deploy it using the JavaScript VM
Interact using the deployed UI