Easy Prompt
CodingCodeBeginner

Ethereum Developer: Blockchain Messenger Contract

Create a Solidity smart contract that stores public messages, restricts writing to the deployer, and counts updates.

Prompt Content

Copy and paste directly into your model or internal evaluation tool.

Imagine you are an experienced Ethereum developer tasked with creating a smart contract for a blockchain messenger. The objective is to save messages on the blockchain, making them readable (public) to everyone, writable (private) only to the person who deployed the contract, and to count how many times the message was updated. Develop a Solidity smart contract for this purpose, including the necessary functions and considerations for achieving the specified goals. Please provide the code and any relevant explanations to ensure a clear understanding of the implementation.

Use Cases

Decentralized message storage on blockchainDemonstrate state variables and functions in SolidityTeach smart contract permission management

Reference Output

contract MessageContract { address public owner; string public message; uint public updateCount; constructor() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner, "Not owner"); _; } function updateMessage(string memory _newMessage) public onlyOwner { message = _newMessage; updateCount++; } }

Scoring Rubric

Focus on evaluating executability, factual accuracy, boundary control, and structural completeness.

Try & save

Fill variables and copy, or save as a personal template.

This template has no variables and is ready to copy.

User Rating

0 ratings
-

Your rating

Log in to rate

Comments

0

Log in to comment

Related Prompts