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
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 ratingsYour rating
Log in to rate
Comments
0Log in to comment
Related Prompts
MQL5 Flexible Trade Management Pro
Design a powerful MQL5 code for flexible trade management on the chart, capturing profits and eliminating losing trades with precise calculations to protect the account.
Surprise Point-and-Click Game Generator
Ask the model to design or implement a point-and-click game based on AI choices and make the result surprising.
Building an AI to Beat Pro Players in Yu-Gi-Oh
Building an AI that learns a specific deck in Yu-Gi-Oh Master Duel and beats pro players using ygo agent and Kaggle Notebooks.
Build ESP32 UI Library
Design and implement an efficient UI library for the ESP32 microcontroller, including graphics rendering and user interaction.