developer coding user risk: low
Solidity Blockchain Messenger Smart Contract
The prompt asks the model to act as an experienced Ethereum developer and create a Solidity smart contract for a blockchain messenger that stores messages publicly readable but wri…
PROMPT
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.
ROLES & RULES
Role assignments
- You are an experienced Ethereum developer tasked with creating a smart contract for a blockchain messenger.
EXPECTED OUTPUT
- Format
- code
- Constraints
-
- valid Solidity code
- public readability
- deployer-only writability
- update counting
- include explanations
SUCCESS CRITERIA
- Develop a Solidity smart contract to save messages on the blockchain.
- Make messages readable publicly to everyone.
- Restrict writability privately to the deployer only.
- Count how many times the message was updated.
- Include necessary functions and considerations.
- Provide the code and relevant explanations.
FAILURE MODES
- May fail to make messages publicly readable.
- May not restrict writing to the deployer.
- May omit update count functionality.
- May provide incomplete or incorrect Solidity code.
- May lack necessary security considerations.
CAVEATS
- Missing context
-
- Solidity version (e.g., ^0.8.20)
- Whether to use external libraries like OpenZeppelin
- Gas optimization or security audit requirements
- Ambiguities
-
- Unclear if the contract handles a single message or multiple messages (prompt uses 'messages' plural then 'the message' singular).
QUALITY
- OVERALL
- 0.70
- CLARITY
- 0.90
- SPECIFICITY
- 0.80
- REUSABILITY
- 0.30
- COMPLETENESS
- 0.80
IMPROVEMENT SUGGESTIONS
- Clarify message handling: 'Design for multiple messages stored in an array, each with its own update count.'
- Specify Solidity version: 'Use Solidity ^0.8.20.'
- Add output structure: 'Provide the full contract code, followed by explanations of key functions, events, and security considerations.'
USAGE
Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.
MORE FOR DEVELOPER
- Context7 Library Documentation Expert developer coding
- Structured Python Production Code Generator developer coding
- Angular Standalone Directive Generator developer coding
- Pytest Unit Test Suite Generator developer coding
- Unity Architecture Specialist developer coding
- Web Typography CSS Generator developer coding
- VSCode CodeTour File Expert developer coding
- Senior Python Code Reviewer developer coding
- Structured Cross-Language Code Translator developer coding
- Multi-DB SQL Query Optimizer and Builder developer coding
- Base R Programming Reference Guide developer coding
- Flutter Map SDK Layer Bug Fixer developer coding
- Expert Mobile App Builder for iOS Android developer coding
- Scalable Backend Architect Expert developer coding
- Comprehensive TypeScript Codebase Reviewer developer coding
- Code Improvement and Refactoring Suggester developer coding
- Vercel SPA Blank Screen Diagnoser developer coding
- CLAUDE.md File Generator for AI Coders developer coding
- App Store Screenshots Gallery Generator developer coding
- Spring Boot SOLID Architect Specialist developer coding
- React SaaS Metrics Dashboard Generator developer coding
- Software Optimization Auditor developer coding
- Senior Frontend Task Checklist Architect developer coding
- POSIX Shell Script Developer with Checklists developer coding
- Astro v6 Strict Architecture Rules developer coding